Click here to Skip to main content
15,907,687 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi to all...

Kindly provide me some help w/ my problem.

I have a gridview w/ a fixed the header row inside a div tag, each data row has an Edit link. When the Edit link is clicked, I display a textbox on the selected row (via edittemplate of the gridview) so the user can change value.

If the user clicks a row that is found at the bottom of the grid, i'd like to set focus to that textbox on the selected row, or at least scroll to that row inside the div tag.

I'm using this code to set focus on the selected row:

protected void grvTasks_RowDataBound(object sender, GridViewRowEventArgs e)
{
TextBox txtTask = e.Row.FindControl("txtTask") as TextBox;
if (txtTask != null) txtTask.Focus();
}

The gridview focuses on the row, that is fine, however, my fixed header row is being pushed out of the div tag (goes above the div tag).

What is a good way to set focus on a selected row in a gridview w/ a fixed header row inside a div tag?

Thanks in advance...
Posted

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