Link Button in asp.net click event not firing
24,524
I have created demo project and copy same code as you have written.It is working fine
<asp:LinkButton ID="lbDownloadFile" name = "lbDownloadFile" Text="Click me" runat="server" CausesValidation="false" OnClientClick="lbDownloadFile_Click"
onclick="lbDownloadFile_Click" />
in code behind file
protected void lbDownloadFile_Click(object sender, EventArgs e)
{ //here is my debug pointer/breakpoint
}
I have just added text on link button.
Author by
Abdur Rahim
Updated on July 30, 2022Comments
-
Abdur Rahim almost 2 years
<asp:LinkButton ID="lbDownloadFile" name = "lbDownloadFile" runat="server" CausesValidation="false" onclick="lbDownloadFile_Click" />
I have this link button. on click:
protected void lbDownloadFile_Click(object sender, EventArgs e) { //here is my debug pointer/breakpoint ......................... }
but this event is not firing. my Page_Load() event is firing. How to solve this problem?
protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { if (Session[Antrage_AnfrageSessionNames.AgntNr] == null) { Response.Redirect("../UserSessionError.aspx"); } try { if (Request.QueryString["Kundennummer"].ToString() != null) { //If kundennummer exists in QueryString then stores it to further use kundennummer = Request.QueryString["Kundennummer"].ToString(); } } catch { kundennummer = string.Empty; } } }
EDIT:
I am adding the code, what FireFox firebug shows me respective to the LinkButton.
I think the auto generated href is the main problem here.
-
Admin about 10 yearsI think the OP have dynamically added the
Text
. This is not a problem, This problem coming from page-load event. But OP did't put that code. :)