Customizing the datagrid to use radio buttons requires a couple lines of
code. I provide an example here as alternative to downloading and installing
a component.
In your datagrid itemdatabound event handler, this line of code adds a
radiobutton to each row.
if(e.Item.ItemType == ListItemType.Item || e.Item.ItemType ==
ListItemType.AlternatingItem)
{
Label lbl = (Label)e.Item.FindControl("Dig");
if(lbl != null)
lbl.Text = "<input type=radio name='samegroup' value='" +
e.Item.Cells[1].Text + "'>";
}
The code assumes that you have created a datagrid with an item template
column contianing a field called "Dig". This part is entirely optional as
you can just add the lbl control to any column.
The reason why mutually exclusive radio buttons don't work from the
code-behind is that the datagrid implements the INamingContainer interface
which forces each implementor to generator unique names for the html content
rendered clientside. Therefor, the mutually exclusivity is lost with the
unique renaming. Using javascript like the code provided above ensures that
the radio button created clientside has a family groupname.
--
Regards,
Alvin Bruney
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Jay" <ja**********@hotmail.com> wrote in message
news:O6yQb.40536$zP6.39600@okepread02...
why am i getting the following error message when I compile the
RowSelectorColumn DOT NET project that I downloaded from the site that you
suggested?
I got it from http://aspnet.4guysfromrolla.com/articles/122602-1.aspx
Cryptographic failure while signing assembly
Thank You for any and all help with this matter.
"Michael" <raterus@localhost> wrote in message
news:ux**************@tk2msftngp13.phx.gbl... http://aspnet.4guysfromrolla.com/articles/122602-1.aspx
"Jay" <ja**********@hotmail.com> wrote in message
news:3W7Qb.35047$zP6.19983@okepread02... I noticed somewhere on the net that a post mentioned that there was a bug in the datagrid, radio buttons and a repeater. Something about the radio
buttons are not mutually exclusive. (will this be fixed soon)
I am trying to create a survey form where the 4 radio buttons are
created dynamically for each question in the database. Is there an example of
this somewhere. The radio buttons are based on a seperate table called survey answers. What I am looking for is what does the html look like and
how do I write the code to handle the server side events.
Thank You All for participating