ASP.NET自带机制不刷新页面

CS部分:
using System.Web.UI;

public partial class portal_pages_sa_manage_manage_panel : System.Web.UI.Page, ICallbackEventHandler
{
     
public string CallBackValue = string.Empty;

     
string ICallbackEventHandler.GetCallbackResult()
     {
         
return CallBackValue;
     }

     
//只能接受一个参数,不太爽
     void ICallbackEventHandler.RaiseCallbackEvent(string eventArgument)
     {
         
//以下为自定义的操作内容,随意发挥。
         
//string oldIds = this.hdnIdNew.Value;   //注意:不能获取隐藏控件的值
         string[] infos = eventArgument.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
         
string[] arrIds = new string[infos.Length];
         StringBuilder strIds 
= new StringBuilder();
         
string strSplit = "";
         
int n = 0;
         
foreach (string str in infos)
         {
             
if (str.Length > 3)
             {
                 strIds.Append(strSplit).Append(str);
                 strSplit 
= ",";
             }
             
else
             {
                 arrIds[n] 
= str;
                 n
++;
             }
         }
     }
}

 

JS调用部分:

 

    <script type="text/javascript">
    
function CallServer(ids)
    {
        
//ids就是传到后台的参数,只能一个
        <%=Page.ClientScript.GetCallbackEventReference(this"ids""ReceiveServerData",null%>
    }

    
function ReceiveServerData(rValue)
    {
        
//成功提示
    }

function funSelAll()
{
    
var str= "";
    .
    CallServer(str);
    
return false;
}
    
</script>
posted @ 2009-04-02 17:05  边缘凉风  阅读(439)  评论(0编辑  收藏  举报