I have a gridview1 that displays customers with their codes.
The gridview contains 3 columns: The 1st contains an item tamplate with radiobutton(radioButton1) in it. The 2nd is a bound column that binds with CustomerID column of sql Customers table. The 3rd is a bound column that binds with CustomerFullName column of sql Customers table.
Below the gridview1 control I have a button (viewCustomerIDButton) and a textbox (customerIDTextBox).
All I want is when I check the radiobutton and click the button, my asp.net application grabs the CustomerID of the checked radiobutton gridview row and display it in the textbox.
Can anyone let me know how to do this by c# code for my asp.net web forms?
Please help!

5 Years
Discussion Span
Last Post by hericles

I'm assuming the text box is going to show more information than you have already extracted from the database i.e. another SELECT statement is needed.
You can improve the usability by removing the radio button and using a link button for the name. Then the user just needs to click the name for the code to execute. The link button can call another SELECT statement using its command object, which you set to be equal to the customer's name.
If you want to stay with the radio button you will need to iterate through the grid view rows looking for all radio button types until you find the selected one and then get the value of the next column of the current row and then use that to get the new information.

Does that make sense?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.