[英]The click event of button isn't trigged in 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>
最好的祝福
如果您的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" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.