Scroll Into View For Page Postback


Scroll Into View For Page Postback

Feb, 10, 2011

When placed into a utilities class this snippet will auto write the javascript that will scroll to an item on page postback.


 public static void ScrollIntoView(Control controlToScroll)
    {
        Page page = HttpContext.Current.Handler as Page;
        page.RegisterStartupScript("key2", "<script> document.getElementById('" + controlToScroll.ClientID + "').scrollIntoView();</script>");
    }


Tags: Javascript, Snippet, C#

Contact

Recent Posts

Entity Framework update-database "Could not load file or assembly or one of its dependencies. The system cannot find the file specified."

I spun wheel for a while on this one. Every time I ran the update-database or add-migration command I was getting "Could not load file or assembly 'MyProject.Name' or one of its dependencies. The... Read More

You get nahzing, Lebowski!

Windows 8 CP to Windows 8 RP doesn't give you many choices on what I get to keep when I upgrade. Guess I won't be needing that "Help me decide" link.... Read More

 
@nickspiers