RadioButton in a DataGrid

From: news.microsoft.com (Saurabh@gtx.com)
Date: 09/27/02


From: "news.microsoft.com" <Saurabh@gtx.com>
Date: Thu, 26 Sep 2002 16:57:23 -0700


Hi

I have been trying to put a radiobutton server control inside a datagrid .
but the radio buttons being generated on the webform are not mutually
exclusive.
here is the code:

<asp:datagrid id="datagridVendor" runat="server" Width="460px" Height="25px"
AutoGenerateColumns="False" AllowPaging="True" AllowSorting="True">
     <Columns>
      <asp:TemplateColumn SortExpression="VendorName" HeaderText="Vendor
Name">
             <ItemTemplate>
                   <asp:RadioButton id="rb" Enabled=True Runat=server
GroupName="Grp1" ></asp:RadioButton>
              </ItemTemplate>
      </asp:TemplateColumn>
     </Columns>
 </asp:datagrid>

Now the reason why they are not mutaully exclusive at run time is that
ASP.NET changes the IDs of these radio buttons. Here is what i see when I do
a "View Source" in the browser.

<input id="datagridVendor__ctl2_rb" type="radio"
name="datagridVendor:_ctl2:Grp1" value="rb" />
<input id="datagridVendor__ctl3_rb" type="radio"
name="datagridVendor:_ctl3:Grp1" value="rb" />

Any idea why is this happening ???????

Thanks in advance.

Saurabh



Relevant Pages

  • Strange WebForms behavior in Visual Studio .NET 2003
    ... I'm experiencing some strange behavior in Visual Studio .NET 2003 ... I developed a WebForm with 6 text entries, each with a set of two radio ... in the webform designer I set the visible property to false. ... I took each element and gave it a name and number, like TextBox1. ...
    (microsoft.public.vstudio.general)
  • Re: Strange WebForms behavior in Visual Studio .NET 2003
    ... > I developed a WebForm with 6 text entries, each with a set of two radio ... in the webform designer I set the visible property to false. ... > I took each element and gave it a name and number, like TextBox1. ... Then...the trick to radio buttons dynamically affecting the web page is ...
    (microsoft.public.vstudio.general)
  • listcontrol, checkboxlist, radiobuttonlist, placeholder
    ... I created a new webform with a PlaceHolder and a Button. ... If I do select the radio button, then I get the same exception ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Radiobuttonlist - can I have all radio buttons de-selected?
    ... > Is it possible to have a radiobuttonlist control appear on a webform ... > without any radio buttons checked to begin with? ... added 5 buttons (using the Items property) ...
    (microsoft.public.dotnet.framework.aspnet)
  • Radiobuttonlist - can I have all radio buttons de-selected?
    ... Is it possible to have a radiobuttonlist control appear on a webform ... without any radio buttons checked to begin with? ... TIA, ...
    (microsoft.public.dotnet.framework.aspnet)