Position at the top from a .NET program

Return to previous page

  • 4/7/2015
  • 325 Views

Comments

325 Views

Position at the top from a .NET program

Last updated 6 years ago

Comments

Common

(Enter the content of this article below)

Advanced

 
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 after a postback. So the user never sees the error message *Bummer*

DotNetNuke has a handy solution implemented.

You can use the DNN solution in this way:

'position 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.
Subscribe to DNN Digest

DNN Digest is our monthly email newsletter. It highlights news and content from around the DNN ecosystem, such as new modules and themes, messages from leadership, blog posts and notable tweets. Keep your finger on the pulse of the ecosystem by subscribing.  


Copyright 2017 by DNN Corp Terms of Use Privacy
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out