简体   繁体   English

在MVC 4的ASPX视图中不触发ASP按钮单击事件

[英]Asp Button Click Event Not Firing in aspx view in mvc 4

I have asp button on aspx view in mvc. 我在MVC的aspx视图上有asp按钮。 When I click on button it's not giving any response 当我点击按钮时,它没有给出任何回应

<script runat="server">
    private void GetReport(string mode = "")
    {
     ..................
    }
    protected void btnShowReport_Click(object sender, EventArgs e)
    {
        //This Event Not Firing.
        GetReport("print");
    }

 </script> 

 <form id="form1" runat="server" >
         //This Button Click is not Working
      <asp:Button ID="btnShowReport" OnClick="btnShowReport_Click" runat="server" Text="Get Last Report"  />

 </form>

If you are using MVC, avoid these asp.net controls. 如果使用的是MVC,请避免使用这些asp.net控件。 Use plain HTML controls or use HTML helpers. 使用纯HTML控件或使用HTML帮助器。 One of the purposes of using ASP.NET MVC is to have grater control over the code that gets rendered. 使用ASP.NET MVC的目的之一是对所呈现的代码进行更好的控制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM