November 2006 - Posts

Today I figured out how to Scroll back to the top of a Page when one of my users click on the Pager Controls at the bottom of a Page. I wanted all of the other AJAX postbacks to not scroll, but I did want the postbacks to scroll to the top when the pager controls were clicked.  The pager control's client ID's are not set, so the postbackElement ID is set equal to the DataView, so knowing that information you can use the PageRequestManager to scroll to the top only if the the pager controls are clicked.  (This works for both the Top and Bottom Pager controls):

<script type="text/javascript" language="javascript">

var postbackElement;

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest);

Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(pageLoaded)

function beginRequest(sender, args) {

        postbackElement = args.get_postBackElement();

}

function pageLoaded(sender, args)

{

        if (typeof(postbackElement) === "undefined") {

            return;

        }

        if ((postbackElement.id) === "ctl00_C1_JobsGridView") {

               window.scrollTo(0,0);

            }

}

</script>

 

WOW. Just WOW.  I submitted 5 designs for the project I'm working on to the folks over at XHTMLized.com to be cut into proper XHTML and CSS late last week and they delivered everything today.  XHTMLized.com is a company that will take a design (mine were .psd's) and cut everything for you into valid XHTML and CSS that works on all major browsers.  They said it would be done by Wed. of this week (which was already a major plus), but they delivered everything a day early. I showed everything to Jason Alexander and Rob Howard and all they could say was WOW too.  The markup is the best I have ever seen - standards compliant, SEO optimized, works on all major browsers including IE7, Opera, Firefox, and Safari!  These guys just saved me at least two weeks...I'll definitely be using them again.

-Shane 

More Posts