处理客户回发事件 [英] Handling client post back event

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

问题描述

你好!

我有一个问题,我需要处理一些元素的点击事件,如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!

推荐答案

__ doPostBack(''btnClick'',''Second args'');

使用下面的代码代码

__doPostBack(''btnClick'',''Second args'');
use below code at code behind
if (Request["__EVENTTARGET"] == "btnClick")
{
   string secandArg = Request["__EVENTARGUMENT"];
}





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



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


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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆