且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ASP中的Bootstrap按钮不会触发按钮单击事件

更新时间:2023-10-13 12:48:28

错字,它应该是
 runat =   server 

例如

< button onserverclick =Next_Clickrunat =serverid =MyButton &GT; 


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">