hello..

m developing web application ..in it m going to use RadioButtonList control...

well.. problem is want to get value for RadioButtonList control from databse..

here is ma code..

this is aspx code file..

< asp:RadioButtonList ID="RadioButtonList1" runat="server" 
            RepeatDirection="Horizontal">
            <asp:ListItem>Web</asp:ListItem>
            <asp:ListItem>DeskTop</asp:ListItem>
        </asp:RadioButtonList>

this is aspx.cs code file

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                strcon.Open();

                OleDbCommand cmd = new OleDbCommand("select webapp from TestData", strcon);
                cmd.CommandType = CommandType.Text;

                  OleDbDataReader reader = cmd.ExecuteReader();

              while (reader.Read())
                {
                     RadioButtonList1 .SelectedValue = reader ["webapp"].ToString ();

              }
           strcon.Close();
            }
        }

here i had used access databse as primary ...

in tht thr is table named TestData with webapp field...

while reading data from databse it does not give any result..


i had also tried to bind RadioButtonList control with databse bt the list items doesn't thr...only giving true & false..

tell me whr m going wrong?

thanks ...

set

<asp:ListItem value="Web">Web</asp:ListItem>

ok..

What else to do?..

its not giving me the result..

thanks in advance...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.