按钮的单击事件未在asp.net中触发

时间:2015-03-03 08:00:22

标签: javascript jquery asp.net

我的页面中有按钮,您可以在此处看到:

  <div class="buttonPossion">
                    <asp:Button ID="btnFinal" runat="server" Text="دانلود مقاله" CssClass="buttonBlue" OnClick="btnFinal_Click"/>
                </div>

此按钮的点击事件为:

protected void btnFinal_Click(object sender, EventArgs e)
    {
        int count =
            dbcontext.tblJurorArticles.Where(i => i.articleid == articleId && i.jurorUsername == Session["juror"])
                     .Count();
        if (count == 1)
        {
            Response.Redirect("../AdminPortal/DownloadArticleHandler.ashx?File=" +
                              obj.Return_filelocation_article(articleId.ToString()));
        }
        else
        {
            Response.Redirect("asda");
        }
    }

但是当我点击按钮时它不起作用。重要的是我的所有按钮都被禁用了。

如果需要html代码,我可以将其包含在我的问题中。

webconfig

 <?xml version="1.0"?>
<!--
  For more information on how to configure your ASP.NET application, please visit
  http://go.microsoft.com/fwlink/?LinkId=169433
  -->
<configuration>
  <connectionStrings>
    <add name="DB-Conference-CivilConstruction" connectionString="Data Source=176.9.90.204,9992;Initial Catalog=DB-Conference-CivilConstruction;User ID=DB-Conference-CivilConstruction-user; password=123qweQWE@;"
      providerName="System.Data.SqlClient" />
    <!--<add name="DB-Conference-CivilConstruction" connectionString="Data Source=192.168.223.75;Initial Catalog=DB-Conference-CivilConstruction;User ID=DB-Conference-CivilConstruction-user; password=123qweQWE@;"
      providerName="System.Data.SqlClient" />-->

  </connectionStrings>
   <system.webServer>
   <security>
      <requestFiltering>
         <requestLimits maxAllowedContentLength="1073741824" />
      </requestFiltering>
   </security>
 </system.webServer>

  <system.web>
    <compilation debug="true" targetFramework="4.0"/>
   <httpRuntime maxRequestLength="1048576" />
    <pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID"/>
  </system.web>
</configuration>

祝你好运

1 个答案:

答案 0 :(得分:0)

如果您的eventClick调用回发并触发page_Load函数而不移动到您的click事件hundler,并且您确定OnClick属性具有正确的事件hundler名称,则必须检查您的web.config

在本节

<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="xxx" />
  </appSettings>

将其更改为

<appSettings>
    <add key="aspnet:MaxHttpCollectionKeys" value="5000" />
  </appSettings>

如果“MaxHttpCollectionKeys”不存在,请添加它。

并在

下更改此配置
<configuration> 
<system.web>
<httpRuntime maxRequestLength="xxx" />

<configuration> 
    <system.web>
    <httpRuntime maxRequestLength="51200" />