RadioButtonList within DataGrid

  • Thread starter Mike Chamberlain
  • Start date
M

Mike Chamberlain

Hi.

I'm trying to make a datagrid with a RadioButtonList on each row:

<asp:TemplateColumn HeaderText="Action">
<ItemTemplate>
<asp:RadioButtonList runat="server">
<asp:listitem runat="server" value="stop" />
<asp:listitem runat="server" value="go" />
</asp:radiobuttonlist>
</ItemTemplate>
</asp:TemplateColumn>

I want to be able to associate each button list with the row's ID field
from the data source, so on postback I can determine the selected action
that relates to that ID.

The problem is I don't understand how to access the selected values.
Can anyone help?

Mike
 
B

Brock Allen

Assign an ID to the RadioButtonList. Then in your event handler (like the
DataGrid's ItemCommand) you should have access to the DataGridItem (essentially
the row in the datagrid) and you just need to call FindControl("YourIDForTheRadioButtonList").
 

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

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,818
Latest member
SapanaCarpetStudio

Latest Threads

Top