2015-03-03 69 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

相關問題