I have an asp.net c# web forms application with a formview. When I click "Edit" on the formview, I have set the focus to a textbox. This works just fine.
protected void fv_comp_status_list_DataBound(object sender, EventArgs e)
{
if (fv_comp_status_list.CurrentMode == FormViewMode.Edit)
{
TextBox tb = (TextBox)fv_comp_status_list.Row.Cells[0].FindControl("pol_numTextBox");
tb.Focus();
}
}
The problem is that the textbox is at the bottom of the screen. I want to set focus on the textbox and also have it move (scroll) to the top of the screen. This will allow the user to see the entire form, withhout having to scroll initially.
How can I modify the code to set the textbox (pol_numTextBox) at the top of the page on DataBound once the focus is set?