locked
Fill fields with selected gridview row data RRS feed

  • Question

  • User1055443156 posted

    Hi

    in my page

    i have a gridview  with 3 coumns has data filling from database and   below this   page has 3 textbox fields

     

    here what i need  when i click a row in gridview i want to display selected row data in 3 textboxes

     


    Tuesday, April 12, 2011 1:59 PM

Answers

  • User-1635004338 posted

    Hi,

    If you select the row in GridView , you can handle the SelectedIndexChanged event of GridView to do it like this:

    protected void GridView1_SelectedIndexChanged(object sedner, EventArgs e)
        {
            TextBox1.Text = GridView1.SelectedRow.Cells[0].Text;
            TextBox2.Text = ((Label)GridView1.SelectedRow.FindControl("Label1")).Text;
        }

    Thanks,

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, April 14, 2011 4:34 AM

All replies