Click here to Skip to main content
15,886,799 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
ASP.NET
<asp:RadioButtonList ID="rbtnoption" runat="server"  RepeatDirection="Vertical"></asp:RadioButtonList>


asp.cs code:
C#
DataSet ds1 = new DataSet();
ds1 = obj.getOneQuestionExam(res);
if (ds1.Tables[0].Rows.Count > 0)
{
    lblquestion.Text = ds1.Tables[0].Rows[0]["q_title"].ToString();
    lblqid.Text = ds1.Tables[0].Rows[0]["id"].ToString();
    //dloption.DataSource = ds1.Tables[0];
    //dloption.DataBind();
    rbtnoption.DataTextField = "q_option";
    rbtnoption.DataValueField = "oid";
    rbtnoption.DataBind();
Posted
Updated 20-Feb-15 22:26pm
v2
Comments
King Fisher 22-Feb-15 23:59pm    
Do you getting any error?

C#
rbtnoption.DataSource = ds1.Tables[0];
rbtnoption.DataTextField ="q_option";
   rbtnoption.DataValueField = "oid";
   rbtnoption.DataBind();
 
Share this answer
 
v3
You have to assign Dataset values to the RadiobuttonList Datasource .so please Uncomment the below lines and let me know if you get any erros

C#
rbtnoption.DataSource = ds1.Tables[0];
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900