2015-03-03 70 views
0

触发我在我的网页按钮,你可以在这里看到:按钮的Click事件不会在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; [email protected];" 
     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; [email protected];" 
     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

_it这个配置并不WORK_请解释。什么不行?事件没有被触发?没有返回值,你没有得到你需要的重定向?调试器可以帮助你很多,使用它。 – Steve 2015-03-03 08:03:43

+0

是的确切事件不triggers – 2015-03-03 08:04:22

+0

我把一个新的按钮,但它不能再工作 – 2015-03-03 08:04:58

回答

0

如果您eventClick调用回传和消防在Page_Load功能,而不去点击事件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" /> 
+0

我添加了配置文件,但我不知道哪个部分应该我添加代码? – 2015-03-03 08:23:13

+0

请勿添加配置文件。在您现有的web.config 下的''标记 – 2015-03-03 08:26:12

+0

@EA在那里有什么进展? – 2015-03-03 08:35:35

相关问题