ASP中的Bootstrap按钮不会触发按钮单击事件 [英] Bootstrap button in ASP-do not trigger button click event

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

问题描述





我在apsx中创建了bootstrap按钮,我想触发按钮点击事件。这就是我的代码看起来



in .apsx

 <   a     href   =     class   =  btn btn-xs button page-2-btn >  next <   / a  >  





in .cs



 受保护  void  Next_Click(  object  sender,EventArgs e)
{
string connStr = <跨度class =code-string>初始目录= LoginCheck;数据来源= MYCOMPUTER;用户ID = sa;密码= abc12345;;

}



但是,我看到后面的代码,即.cs函数未被调用,保持断点我看到它没有被调用。请任何帮助将不胜感激。



谢谢



我尝试了什么:



我试过runat =sever和onserverclick,即使那样也不行

解决方案

错字,它应该是

 runat =   server 

例如

< button onserverclick =Next_Clickrunat =serverid =MyButton > 


Hi,

I have created bootstrap button in apsx, I want to trigger the button click event for this. This is what my code looks

in .apsx

<a href="#" class="btn btn-xs button page-2-btn">next</a>



in .cs

protected void Next_Click(object sender, EventArgs e)
    {
        string connStr = "Initial Catalog=LoginCheck; Data Source=MYCOMPUTER; User id=sa; password=abc12345;";
        
    }


However, I see that the code behind i.e .cs function is not invoked, on keeping the break point I see it does not get called. Please any help will be appreciated.

Thanks

What I have tried:

I have tried runat="sever" and onserverclick , even that did not work

解决方案

Typo, it should be

runat="server"

e.g.

<button onserverclick="Next_Click" runat="server" id="MyButton">


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

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