Tech Boek

10

Jumping to the top when asp.net gives a postback is not that easy. (ASP 2.0)

Case: you need to press a save button in a very long list, and need to show an error message (which is at the top of the page).

The location of your page is maintained.  So the user never sees the error message *Bummer*

DotNetNuke has a handy solution implemented.

You can use this solution in this way:

 

'posision at the top
Dim t As HtmlInputHidden = Page.FindControl("ScrollTop")
If t IsNot Nothing Then t.Value = 0
 
 

 

So how does this work? 

The DNN framework adds this to the end of the pages:

<input name="ScrollTop" type="hidden" id="ScrollTop" value="0" />
<input name="__dnnVariable" type="hidden" id="__dnnVariable" value="__dnn_pageload__dnn_setScrollTop();" />

 

So by changing the value of the hidden field ScrollTop, you can position wherever you want.

 

Posted in: DotNetNuke

Post Rating

Comments

There are currently no comments, be the first to post one.

Post Comment

Naam (verplicht)

E-mail (verplicht)

Website

CAPTCHA Afbeelding
Enter the code shown above: