c# - TreeView Control -
i developing application using c#. using radiobuttonlist control inside treeview. getting collection of items database. based on collection items need select radiobuttonlist items.
for example database got collection in way: read(r) write(w)
based on colletion need set user permissions.
if question right want bind radiobutton list based on items in database based on current row item on grid. if thats case here solution.
lets have grid called mygrid, radiobuttonlist called myradio , hiddenfield called myhidden (this bind value have on "r" , "w")
all have when rowdatabound event occurs have assign value myradio
for example, have radiobuttonlist such
<asp:radiobuttonlist id="myradio" runat="server"> <asp:listitem value="r">read</asp:listitem> <asp:listitem value="w">write</asp:listitem> </asp:radiobuttonlist>
so code behind should this
protected void mygrid_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { radiobuttonlist rdoanswer = (radiobuttonlist)e.row.findcontrol("myradio"); hiddenfield hdnvalue = (hiddenfield)e.row.findcontrol("myhidden"); rdoanswer.selectedvalue = hdnvalue.value; } }
Comments
Post a Comment