按钮单击事件不起作用 [英] Button Click event not working

查看:69
本文介绍了按钮单击事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的aspx页面上有按钮和下拉列表。当我在

页面指令标签中设置EnableViewState =false时,按钮点击事件没有触发。为什么?

解决方案

请在按钮标签中检查按钮事件。 EnableViewState =false不会对按钮产生任何影响。因此,请检查您背后的代码和onclick属性的事件名称。



 <   asp:按钮    id   =  btnSubmit    runat   =  server    onclick   =  btnSubmit_Click     xmlns:asp   = #unknown    /  >  





  protected   void  btnSubmit_Click( object  sender,EventArgs e) 
{
Response.Write( Test);
}


可能你可以试试这个属性'AutoEventWireup'让它'真',但我必须说你需要让EnableViewState为true ,只需尝试以上设置并检查。


后面的代码出错,因此没有显示任何内容。

谢谢大家

I have buttons and dropdownlist on my aspx page.when i set the EnableViewState = "false" in the
page directive tag then the button click event is not firing.Why?

解决方案

Please check you button event in button tag. EnableViewState="false" does not create any effect on button. So check your event name on code behind and onclick property of button.

<asp:button id="btnSubmit" runat="server" onclick="btnSubmit_Click" xmlns:asp="#unknown" />



protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Response.Write("Test");
        }


May be you can try with this property 'AutoEventWireup' making it 'true', however I must say you need to make EnableViewState true, Just try above settings and check.


There was an error in code behind and hence it wasn't showing anything.
Thanks all of you


这篇关于按钮单击事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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