how to add single select radio button in datagrid... URGENT

S

Sriram

Hi All,
I am adding a radiobutton in a datagrid. Now if I want to select a single radio button I am unable to achieve this. I have tried both RadioButton and HtmlInputRadioButton. Is there any way out.

Thanks in advance.

Regards,
Sriram Mallajyosula
 
A

Alvin Bruney [MVP]

search this newsgroup i posted the complete source code for this a couple weeks ago.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hi All,
I am adding a radiobutton in a datagrid. Now if I want to select a single radio button I am unable to achieve this. I have tried both RadioButton and HtmlInputRadioButton. Is there any way out.

Thanks in advance.

Regards,
Sriram Mallajyosula
 
S

Sriram

Hi Alvin,
I am unable to find it in the newsgroup. Can you please post the code once again.

Thanks in advance.
Regards,
Sriram Mallajyosula
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message search this newsgroup i posted the complete source code for this a couple weeks ago.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hi All,
I am adding a radiobutton in a datagrid. Now if I want to select a single radio button I am unable to achieve this. I have tried both RadioButton and HtmlInputRadioButton. Is there any way out.

Thanks in advance.

Regards,
Sriram Mallajyosula
 
A

Alvin Bruney [MVP]

put this in your item databound event handler

[snip]
else if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
{
System.Text.StringBuilder resource = new System.Text.StringBuilder(256);
Label lbl = (Label)e.Item.FindControl("Dig");
if(lbl != null)
{
resource.Append(e.Item.Cells[1].Text.Trim());
lbl.Text = "<input type=radio name='samegroup' value='" + resource.ToString() + "'>";
}
else
throw new OutOfMemoryException("Out of memory");


add a template column to your datagrid and label it Dig either in the designer or in the html page
<Columns>
<asp:TemplateColumn HeaderText="Dig">
<ItemStyle HorizontalAlign="Center"></ItemStyle>
<ItemTemplate>
<asp:Label id="Dig" runat="server">Dig</asp:Label>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hi Alvin,
I am unable to find it in the newsgroup. Can you please post the code once again.

Thanks in advance.
Regards,
Sriram Mallajyosula
"Alvin Bruney [MVP]" <vapor at steaming post office> wrote in message search this newsgroup i posted the complete source code for this a couple weeks ago.

--
Regards,
Alvin Bruney
[ASP.NET MVP http://mvp.support.microsoft.com/default.aspx]
Got tidbits? Get it here... http://tinyurl.com/27cok
Hi All,
I am adding a radiobutton in a datagrid. Now if I want to select a single radio button I am unable to achieve this. I have tried both RadioButton and HtmlInputRadioButton. Is there any way out.

Thanks in advance.

Regards,
Sriram Mallajyosula
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,906
Latest member
SkinfixSkintag

Latest Threads

Top