radio button issue in asp.net
-
<td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> in below written code in DataList I am using radio button now suppose 3 records are coming but I want to check any one radio button only but right now It is allowing multiple checked. <asp:DataList ID="DataHotel" runat="server" Width="100%" CellPadding="0" CellSpacing="0"> <HeaderTemplate> <table width="100%" style="background-color: #f5f4f4"> <tr> <td colspan="4" style="background-color: #b5f0a0; font-size: 15px"> Hotels</td> </tr> <tr> <td></td> <td> <b>Hotel Name</b></td> <td> <b>Lowest Average Rate</b></td> <td> <b>Highest Average Rate</b></td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> <td> <%# Eval("HotelName") %> <asp:HiddenField ID="hdnNAME" runat="server" Value='<%# Eval("hotelID") %>' /> </td> <td> <%# Eval("lowestavgprice")%> </td> <td> <%# Eval("Highestavgprice")%> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:DataList>
You get the best out of others when you give the best of yourself.
-
<td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> in below written code in DataList I am using radio button now suppose 3 records are coming but I want to check any one radio button only but right now It is allowing multiple checked. <asp:DataList ID="DataHotel" runat="server" Width="100%" CellPadding="0" CellSpacing="0"> <HeaderTemplate> <table width="100%" style="background-color: #f5f4f4"> <tr> <td colspan="4" style="background-color: #b5f0a0; font-size: 15px"> Hotels</td> </tr> <tr> <td></td> <td> <b>Hotel Name</b></td> <td> <b>Lowest Average Rate</b></td> <td> <b>Highest Average Rate</b></td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> <td> <%# Eval("HotelName") %> <asp:HiddenField ID="hdnNAME" runat="server" Value='<%# Eval("hotelID") %>' /> </td> <td> <%# Eval("lowestavgprice")%> </td> <td> <%# Eval("Highestavgprice")%> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:DataList>
You get the best out of others when you give the best of yourself.
just give the grupname same to all
cheers, Abhijit
-
just give the grupname same to all
cheers, Abhijit
It is not like that. I am taking this control once inside DataList and howmany times it will come depends upon no. of records fetching from database. when I am taking groupname="Hotel" then also It's considering separate. thanks
You get the best out of others when you give the best of yourself.
-
<td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> in below written code in DataList I am using radio button now suppose 3 records are coming but I want to check any one radio button only but right now It is allowing multiple checked. <asp:DataList ID="DataHotel" runat="server" Width="100%" CellPadding="0" CellSpacing="0"> <HeaderTemplate> <table width="100%" style="background-color: #f5f4f4"> <tr> <td colspan="4" style="background-color: #b5f0a0; font-size: 15px"> Hotels</td> </tr> <tr> <td></td> <td> <b>Hotel Name</b></td> <td> <b>Lowest Average Rate</b></td> <td> <b>Highest Average Rate</b></td> </tr> </HeaderTemplate> <ItemTemplate> <tr> <td> <asp:RadioButton GroupName="Hotel" ID="rbtnSelect" runat="server" ></asp:RadioButton> </td> <td> <%# Eval("HotelName") %> <asp:HiddenField ID="hdnNAME" runat="server" Value='<%# Eval("hotelID") %>' /> </td> <td> <%# Eval("lowestavgprice")%> </td> <td> <%# Eval("Highestavgprice")%> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </asp:DataList>
You get the best out of others when you give the best of yourself.
http://www.codeproject.com/KB/webforms/GridViewRadiobuttons.aspx[^] this will help u :-O
Pradeep Reddy