本文介绍了处理客户回发事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好!

我有一个问题,我需要处理一些元素的点击事件,如td我的表格获得回发购买我在服务器上注册的事件未被解雇的事件。



i实现了IPostBackEventHandler接口并实现了RaisePostBackEvent打击:



客户代码:

hello!
i have a question i need to handle the click event of some element like a "td" my form get postbacked buy the event i registered for that event on server isnt fired.

i implemented the IPostBackEventHandler interface and implemented the RaisePostBackEvent as blow:

client code :

window.onload = function ()
{
    document.getElementById("TestTd").onclick = function (e)
    {
        __doPostBack("First args", "Second args");
    }
}



和服务器上的代码


and code at server

public void RaisePostBackEvent (string eventArgument)
    {
        this.InfoLabel.Text = "Handled";
    }





因为我说提交表单getts但是执行了RaisePostBack方法dos

非常感谢!



as i said the form getts submitted but RaisePostBack method dosnt get executed.
thanks alot!

推荐答案

if (Request["__EVENTTARGET"] == "btnClick")
{
   string secandArg = Request["__EVENTARGUMENT"];
}





尽量避免__EVENTTARGET的空间,即btnClick,希望它能解决你的问题



try to avoid space for __EVENTTARGET ie btnClick, hope it will solve your problem


这篇关于处理客户回发事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 02:00