Monday, 15 September 2014

asp.net - How to Check Only one RadioButton of a Row with Different Fileds binded in Row? -



asp.net - How to Check Only one RadioButton of a Row with Different Fileds binded in Row? -

i have grid 5 columns, in 3 radiobuttons of different fileds. want have status of checking 1 radiobutton of row,

my code is

<asp:templatefield itemstyle-horizontalalign="center" headertext="directpol"> <itemtemplate> <asp:radiobutton id="rddirectpol" runat="server" checked='<%#convert.toboolean(eval("pol"))%>'/> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="directpod"> <itemtemplate> <asp:radiobutton id="rddirectpod" runat="server" checked='<%# convert.toboolean(eval("pod")) %>' /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="indirectpol"> <itemtemplate> <asp:radiobutton id="rdindirectpol" runat="server" checked='<%#convert.toboolean(eval("ispol"))%>' /> </itemtemplate> </asp:templatefield>

in doing can see 3 can checked @ 1 time, want restrict 1 @ time..., can 1 please help me

set groupname property:

<asp:templatefield itemstyle-horizontalalign="center" headertext="directpol"> <itemtemplate> <asp:radiobutton id="rddirectpol" runat="server" checked='<%#convert.toboolean(eval("pol"))%>' groupname="group1" /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="directpod"> <itemtemplate> <asp:radiobutton id="rddirectpod" runat="server" checked='<%# convert.toboolean(eval("pod")) %>' groupname="group1" /> </itemtemplate> </asp:templatefield> <asp:templatefield itemstyle-horizontalalign="center" headertext="indirectpol"> <itemtemplate> <asp:radiobutton id="rdindirectpol" runat="server" checked='<%#convert.toboolean(eval("ispol"))%>' groupname="group1" /> </itemtemplate> </asp:templatefield>

this way, 1 radiobutton checked each radiobutton same groupname. in case, you'll have set 1 groupname per row.

asp.net gridview datagridview

No comments:

Post a Comment