Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
8
Reply
How to set focus on a control in asp.net?
Vd Tripathi
Aug 23 2016 9:33 AM
402
Reply
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.
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
8
)
Next Recommended Forum
How to learn MVC
How to add openXml or closedxml or microsoft.office