PC Review


Reply
Thread Tools Rating: Thread Rating: 3 votes, 3.67 average.

asp.net scrolling

 
 
venky
Guest
Posts: n/a
 
      2nd Feb 2005
I have a question. In asp.net page, how do u scroll to particular
position in a page. I have a button at the end of my page, when i click
the button, i do some validation and if the validation fails, i want to
scroll to particular postition in the page. Instead the page stays in
the same place where the button is.


any idea or inputs on scrolling?

 
Reply With Quote
 
 
 
 
SA
Guest
Posts: n/a
 
      2nd Feb 2005
Because scrolling is a client-side function, you will need to implement this
client-side using a combination of JavaScript and anchor tags.

Then, you will need to figure out which control didn't pass the validation
and call your JavaScript function with a parameter that will position the
page at the right place.

This is a brief, untested example

<script language="JavaScript">
function navToLocal(anchorName)
{
// JavaScript code here to navigate to the anchor tag with the
specified name.
}
</script>

<a name="SomeName"></a><asp:TextBox runat="server"...></asp:TextBox>

<script language="vb" runat="server">
' Find out which control didn't validate and which anchor tag
' that control corresponds to.
' On page load, set an onload attribute on the body that will
' correctly call the navToLocal function.
</script>


Can't write most of the code of the top of my head, but I am sure Google
search will reveal most of what you need.

HTH
--

---

Sven.

"venky" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> I have a question. In asp.net page, how do u scroll to particular
> position in a page. I have a button at the end of my page, when i click
> the button, i do some validation and if the validation fails, i want to
> scroll to particular postition in the page. Instead the page stays in
> the same place where the button is.
>
>
> any idea or inputs on scrolling?
>



 
Reply With Quote
 
 
 
 
Mark Rae
Guest
Posts: n/a
 
      2nd Feb 2005
"venky" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...

>I have a question. In asp.net page, how do u scroll to particular
> position in a page. I have a button at the end of my page, when i click
> the button, i do some validation and if the validation fails, i want to
> scroll to particular postition in the page. Instead the page stays in
> the same place where the button is.


Is your intended goal simply to show the user where the validation has
failed? In which case, I would *strongly* suggest you set focus to the field
which has failed validation by using the JavaScript focus() method. If the
field is currently off the edge of the screen, this will cause the page to
scroll automatically for you so that the field is visible.


 
Reply With Quote
 
Peter Blum
Guest
Posts: n/a
 
      3rd Feb 2005
Microsoft's validation controls are not really designed for client-side
expandability. For example, if you took the suggestion of setting focus to a
field with the error, how would you write code that finds the first field
with the error and connect it up to Microsoft's scripts that fire when the
button is pressed. You will do some creative hacking to figure it out.

I want to let you know about an alternative that solves this. I rewrite
ASP.NET validation in "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx). It has 22 validators, support for
validation groups, and support for many more browsers in client-side
validation, like Mozilla, Opera 7 and Safari.

I listened to developers who were asking for many enhancements to ASP.NET
and addressed their needs. In your case, you will find these features:
1. There is an option to have it set focus to the first field with the error
upon submit or after you change a field. It can also change the style of
fields with errors, blink the error message, and put up an alert.
2. My ValidationSummary control can offer hyperlinks on its error messages.
When you click on a hyperlink, it jumps to the field with that error.
3. My ValidationSummary control has a setting that makes the page scroll to
show it when you click submit.

I include a utility to quickly switch a page from Microsoft's to my
validators.

--- Peter Blum
www.PeterBlum.com
Email: (E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"venky" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>I have a question. In asp.net page, how do u scroll to particular
> position in a page. I have a button at the end of my page, when i click
> the button, i do some validation and if the validation fails, i want to
> scroll to particular postition in the page. Instead the page stays in
> the same place where the button is.
>
>
> any idea or inputs on scrolling?
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
scrolling and scrolling and scrolling =?Utf-8?B?Y29sZCZzbm93eQ==?= Windows XP New Users 2 6th Dec 2005 04:44 PM
Scrolling problem with ListView, TextBox and Scrolling Panel Jon Abaunza Microsoft Dot NET Compact Framework 0 17th Nov 2005 04:57 PM
Vertical scrolling in Listview with "scrolling = false" nzpcmad Microsoft Dot NET Framework Forms 0 19th Nov 2004 02:33 AM
scrolling all the controls inside Panel while holding and scrolling panel's scroll bar at same time. =?Utf-8?B?QW1yaXQ=?= Microsoft VB .NET 2 28th Apr 2004 02:01 PM
Excel - Scrolling Scrolling Scrolling (Problem) ajw150 Microsoft Excel Misc 1 26th Apr 2004 10:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:32 AM.