Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

radiobuttonlist in datagrid's footer

Status
Not open for further replies.

vcllvc

Programmer
Jul 12, 2001
136
US
I have a radiobuttonlist control in my datagrid's footer, how do i get the selected value from the radiobuttonlist immediately, when someone clicked on it? I need the selected value to do something within the datagrid.

Thanks in advance.

 
Set the AutoPostBack property of the radiobuttonlist to TRUE

In the HTML create an event handler for the SelectedIndexChanged property:

Code:
<asp:RadioButtonList id="rbl1" runat="server" AutoPostBack="True" [b]OnSelectedIndexChanged="test"[/b]>

Code for the event:
Code:
Public Sub test(ByVal sender As System.Object, ByVal e As System.EventArgs)
   Dim rbl As RadioButtonList = sender
   'Get the value clicked.... I just wrote it out to the scree as an example
   Response.Write(rbl.SelectedItem.Text)
End Sub
 
thanks.
I find out my major problem is if I want the items in my radiobuttonlist to be blank or empty. The selectedIndex is always equal to 0, not the item that I selected.

Does anyone know any way to work around this?

 
What does your question mean? If you have no items in the list, the selected index will always be -1. Give an example please.
 
It just like a survey form.
I want to create a radiobutton list on each row within the datagrid and I want to show the item's name on the top of the column, instead of showing them on each row.
 
You are not being clear on what you want. First you said you have have a radiobuttonlist in the footer, now you are talking about one in each row. Sorry but I am very confused on what you want.
 
oh, you are right. There are two different questions.
First one is about the footer. Second one is about each row. Sorry about that. I am working on a project and some time there are too many issues come up and even I got confused myself.

 
If you want a radiobuttonlist in each row, create a template column and add the radiobuttonlist in the template column you want. It sounds like you want to add it to the itemtemplate column.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top