Click here to Skip to main content
15,897,704 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
How to get Particular Cell Value into Text Box from Selected Radio Button in Grid View.

Can U Help?
Posted
Updated 18-Sep-17 3:48am
Comments
CodeBlack 9-Oct-13 9:23am    
can you explain more about your exact problem with code samples ?

Lets your gridview id is gv_form, your textbox id is textbox1 and your radiobutton id is rdb1 then use the following code to get the values of column name "Column1"

for (int i = 0; i <= gv_form.Rows[i].Count - 1; i++)
            {
                GridViewRow row = gv_form.Rows[i];
                RadioButton rdb = (RadioButton)row.FindControl("rdb1");

                if (rdb.Checked == true)
                {
                    textbox1.text = row[i]["Column1"].ToString();
                }

            }


Thanks & Regards,
BlueSathish
 
Share this answer
 
Create a radiobutton CheckedChanged event get the gridview row by it's naming container
And find your cell value by it's index

protected void RadioButton1_CheckedChanged(object sender, EventArgs e)
{
RadioButton btn = (RadioButton)sender;
//Get the row that contains this button
GridViewRow gvr = (GridViewRow)btn.NamingContainer;
string cellValue = gvr.Cells[0].Text;
}
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900