Hi,
I have one asp.net page, which has a Button (Submit button) that has PostBackUrl ="#" that helps to maintain scroll position during page post back.
I have set MaintainScrollPositionOnPostback="true" in Page directive on the page.
Submit button code behind is something like this ...
protected void SubmitButton_Click(object sender, EventArgs e)
{
try
{
txtName.Focus();
}
catch (Exception ex)
{
//error
}
}
Where txtName is a textbox on the page which I need to focus. (Not exactly focus to textbox only but some other logic that I have removed from here.)
So can someone please help me to get rid of this issue.
Thanks.
Vishwakant.

Ajay MalikPosted Aug 24, 2016, 12:10 AM
First, by using the control's Focus method. Second, calling page's SetFocus method and passing ID of the control in this SetFocus method.
The following code snippet sets default focus on TextBox1.
Midhun TpPosted Aug 23, 2016, 10:57 AM
Vishwakant TripathiPosted Aug 23, 2016, 10:49 AM
Midhun TpPosted Aug 23, 2016, 10:35 AM
Vishwakant TripathiPosted Aug 23, 2016, 10:03 AM
Midhun TpPosted Aug 23, 2016, 9:58 AM
Vishwakant TripathiPosted Aug 23, 2016, 9:55 AM
Midhun TpPosted Aug 23, 2016, 9:50 AM