Groups | Blog | Home
all groups > asp.net webcontrols > march 2004 >

asp.net webcontrols : Single Selection of RadioButton in DataGrid


KingBEE
3/30/2004 10:04:08 AM
Dear all experts,
How do I create radiobutton with only single-selection in DataGrid?
I am using the template columns.
Please help me...


thank you !!


Alvin Bruney [MVP]
3/30/2004 11:54:42 AM
Mutally exclusive radio buttons cannot be created in .NET because of a quirk
with the INamingContainer implementation. The hack around it is to stream it
out as javascript. Here is one approach in the itemcreated event handler.

Label lbl = (Label)e.Item.FindControl("Dig");

lbl.Text = "<input type=radio name='samegroup' value='myValue'>";


The code assumes you have created a column with a label called "Dig". The
radio button will replace the label. The name is set the same for each
button so mutually exclusivity is allowed.

--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
[quoted text, click to view]

AddThis Social Bookmark Button