Today I came across to one thread asking for a help to scroll the page so that it displays error Panel. then i decided to create two generic methods in the utility class of my project as follows :
if the button is a postback button :
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 button is an asynchronous postback button :
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);
}