protected void page_Init(object sender, EventArgs e)
{
sss.Invoke(sender, sssobj);
Page page = (Page)sender;
foreach (string name in page.Request.Form.AllKeys)//查找form里面所有的字典 其实应该取__EVENTARGUMENT隐藏域的
{
try
{
System.Web.UI.Control control = page.FindControl(page.Page.Request.Form[name]);//查找这个控件
if (control != null)
{
string value = page.Request.Form[Page.postEventSourceID];
IPostBackEventHandler ip = control as IPostBackEventHandler;
if (ip != null)//能转换成IPostBackEventHandler 那么就激发它
{
ip.RaisePostBackEvent(value);
break;
}
IPostBackDataHandler backDataHandler = control as IPostBackDataHandler;
if (backDataHandler != null)//能转换成IPostBackDataHandler 就把__EVENTTARGET隐藏域的值传给控件 然后激发更改事件
{
System.Collections.Specialized.NameValueCollection nameValueCollection=new System.Collections.Specialized.NameValueCollection();
nameValueCollection.Add(page.Request.Form[control.ClientID],page.Request.Form[control.ClientID]);
backDataHandler.LoadPostData(control.ClientID, nameValueCollection);
backDataHandler.RaisePostDataChangedEvent();
}
}
break;
}
catch
{
}
}
}
这样简单的处理就完了,
我希望各位来帮我改进改进,因为我毕竟还不太了解ASp.net的处理机制。。。
您可能感兴趣的文章: