•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C# section within the Software Development category of DaniWeb, a massive community of 397,336 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,929 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C# advertiser:
Set page's scroll position programmatically according to server side processing
Last edited : Feb 4th, 2008.
//this two generic methods will be put in the class file(where utilities exist) // if the control is a postback control public static void ScrollIntoView(Control controlToScroll) { Page page = HttpContext.Current.Handler as Page; page.RegisterStartupScript("key2", "<script> document.getElementById('" + controlToScroll.ClientID + "').scrollIntoView();</script>"); } // if the control is an asyncronous postback control public static void ScrollIntoViewForAsync(Control controlToScroll) { Page page = HttpContext.Current.Handler as Page; ScriptManager.RegisterClientScriptBlock(page, typeof(page), "key2", "document.getElementById('" + controlToScroll.ClientID + "').scrollIntoView();", true); }
Post Comment
•
•
•
•
DaniWeb Marketplace (Sponsored Links)