Answered by:
Fill fields with selected gridview row data

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
-
User551462331 posted
you need to tweak example in below link a bit to suit u r requirment.
hope this helps...
Tuesday, April 12, 2011 3:17 PM -
User1055443156 posted
Hi
I went througth ur example but i want not to display any slected button in gridview
only i will mouse over the row
Wednesday, April 13, 2011 3:27 AM -
Wednesday, April 13, 2011 2:38 PM
-
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 -
User16212438 posted
To get a click on a row to do the select, see this post.
Thursday, April 14, 2011 10:55 AM