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!

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?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.