__EVENTTARGET是按键点击回传空 [英] __EVENTTARGET is empty on postback of button click

查看:163
本文介绍了__EVENTTARGET是按键点击回传空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我aspx页面上的按钮

I have a button on aspx page

<asp:Button runat="server" CssClass="sc-ButtonHeightWidth" ID="btnFirstSave" Text="Save" OnClick="btnSave_Click" />

我想获得code事件目标和事件背后的来源做基于它的一些验证。我试着用低于code。

I am trying to get the event target and event source in code behind to do some validation based on it. I tried with below code.

string ctrlname = page.Request.Params.Get("__EVENTTARGET");
string ctrlname = Request.Form["__EVENTTARGET"];
string ctrlname = Request.Params["__EVENTTARGET"];

但上面的所有人都让我空值。如何获得这引起每次回传控制。我做错了点儿以上?

But all the above are giving me empty values. How to get the control which caused postback everytime. Am i doing anyting wrong above?

FYI:我已经尝试过在这个链接提到的解决方案。但其只返回按钮上的文字对我来说。我想buttonID。

FYI : I already tried the solution mentioned in this LINK. But its only returning button text for me. I want the buttonID.

推荐答案

我已经设置usesubmitbehavior为false,截至目前。在上面的注释通过Damith给出一个好的解决方案。截至目前其工作罚款,我没有任何问题。要知道,对于该酒店的阅读此链接

I have set usesubmitbehavior to false as of now. A good solution given by Damith above in the comment. As of now its working fine for me without any problem. To know about the property Read this LINK

希望这会帮助别人。

这篇关于__EVENTTARGET是按键点击回传空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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