Get Help:Ask a Question in our Forums|Report a Bug|More Help Resources
Last post Nov 12, 2012 09:23 AM by haggis999
Nov 10, 2012 01:55 PM|LINK
I have a page in my ASP.NET 3.5 website that may display some error messages after the user has entered data in some textboxes and hit a 'Continue' button. The problem is that such messages may not be obvious if they appear in a lower part of the page than
the user is currently viewing. The need to scroll down the page is not self-evident in these circumstances.
In the event of an error, I want to move the focus to an anchor that is placed in a suitable location in the html markup but I don't want to trigger a postback, as that would wipe out the user input and the error message (I'm using an asp:UpdatePanel). Can
anyone suggest some code that would force this move to an anchor point?
Nov 10, 2012 03:12 PM|LINK
Nov 10, 2012 05:21 PM|LINK
Nov 10, 2012 06:37 PM|LINK
Gee, what a coincidence. I just made comments on this thread,
that seem appropriate for your situation.
Nov 12, 2012 09:23 AM|LINK
I am not a full time programmer and I raised my original question after a break of about 9 months since I last did any serious ASP.NET coding. My skills were thus a little rusty. Last night, I realised that there was no need for me to develop new skills
Moving focus to an anchor point was only a passing thought. Moving focus to a button was just as good a solution in my circumstances - and I suddenly remembered that buttons have a Focus method. Simply placing MyButton.Focus() at a relevant point in my code
did the job.