datagrid中点击修改列时如何不刷新整个页面
datagrid中点击修改列时如何不刷新整个页面,或者刷新后可以返回到当前位置.
------解决方案--------------------不刷新?用asp.net ajax
放在updatepanel里面就行
------解决方案--------------------/// <summary>
/// 防止页面滚动
/// </summary>
private void RetainScrollPosition()
{
System.Text.StringBuilder saveScrollPosition = new System.Text.StringBuilder();
System.Text.StringBuilder setScrollPosition = new System.Text.StringBuilder();
RegisterHiddenField( "__SCROLLPOS ", "0 ");
saveScrollPosition.Append( " <script language= 'javascript '> \n ");
saveScrollPosition.Append( "function saveScrollPosition() {\n ");
saveScrollPosition.Append( "document.forms[0].__SCROLLPOS.value=myDiv.scrollTop;\n ");
saveScrollPosition.Append( "}\n ");
saveScrollPosition.Append( "myDiv.onscroll=saveScrollPosition;\n ");
saveScrollPosition.Append( " </script> \n ");
RegisterStartupScript( "saveScroll ", saveScrollPosition.ToString());
if (Page.IsPostBack)
{
setScrollPosition.Append( " <script language= 'javascript '> \n ");
setScrollPosition.Append( "function setScrollPosition() {\n ");
setScrollPosition.Append( "myDiv.scrollTop= " + Request[ "__SCROLLPOS "] + ";\n ");
setScrollPosition.Append( "}\n ");
setScrollPosition.Append( "mybody.onload=setScrollPosition;\n ");
setScrollPosition.Append( " </script> \n ");
RegisterStartupScript( "setScroll ", setScrollPosition.ToString());
}
}