Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: How to databind radiobuttonlist....ASAP


Message #1 by "Mel C Solomon" <melsolomon@e...> on Thu, 2 Aug 2001 15:34:03 -0800

..hello, i'm having problem databinding radiobuttonlist....

...the data is pull-out from the databases....



1. I try to include it in a repeater...



<asp:Repeater id="myrp" runat="server">

<HeaderTemplate>

<table width=80% align=center>

<tr>

<td bgcolor="darkblue" align=center><asp:Label id="lblqid" runat=server Text='<%# DataBinder.Eval(Container.DataItem,
"qid")%>'/>

</td>

</tr>

</HeaderTemplate>



<ItemTemplate>

<tr>

<td><asp:Label id="question" runat=server Text='<%# DataBinder.Eval(Container.DataItem, "question")%>'/><br>

<br>

<asp:RadioButton id="achoice1" runat=server

GroupName="RBchoice"

Checked="True"

Text='<%# DataBinder.Eval(Container.DataItem, "choice1")%>'/>

<br>

<asp:RadioButton id=choice2 runat=server

GroupName="RBchoice"

Text='<%# DataBinder.Eval(Container.DataItem, "choice2")%>'/>

<br>



<asp:RadioButton id=choice3 runat=server

GroupName="RBchoice"

Text='<%# DataBinder.Eval(Container.DataItem, "choice3")%>'/>

<br>



<asp:RadioButton id=choice4 runat=server

GroupName="RBchoice"

Text='<%# DataBinder.Eval(Container.DataItem, "choice4")%>'/>

</td>

</tr>



</ItemTemplate>

<FooterTemplate>

</table>

</FooterTemplate>

</asp:Repeater>





....but i cann't test like this..



if(choice1.GroupName=="RBChoice")

{

///yadada..yadada..

}







2. I tried this...



<asp:RadioButtonList id="RB" runat=server>

<asp:ListItem Selected="True"><%# DataBinder.Eval(Container.DataItem, "choice1")%></asp:ListItem><br>



<asp:ListItem><%# DataBinder.Eval(Container.DataItem, "choice2")%></asp:ListItem><br>

//

//

//the rest..



</asp:RadioButtonList>



...but it says radiobuttonlist doesn't have definition for "DataItem..



....if that the cases...HOW TO DATABIND RADIOBUTTONLIST ...DATA ARE PULL OUT FROM THE DATABASE???



...ANY CODE SNIPPET IS HIGHLY APPRECIATED...





Regards,

mel:-)



__________________________________

www.edsamail.com



__________________________________

www.edsamail.com


  Return to Index