Linkbutton submits the form but OnClick event does not get fired

  • Thread starter Thread starter Stan
  • Start date Start date
S

Stan

This is very weird - linkbutton submits the form, but the
event handler is not being called:

<asp:linkbutton Runat=server CssClass=NormalA
OnClick=btnTest_Click>Test</asp:linkbutton>

protected void btnTest_Click(object sender,
System.EventArgs e)
{
Response.Write ("Test");
}

I can't figure out why...

Thanks,

-Stan
 
Hi Stan,

I have tested this issue on my side but I cannot reproduce the problem.
Please try the following testing steps on your side. ( I am using VS.NET
2003/WinXP SP1/IE 6.0 SP1)

1. Create a default C# Web application.

2. Drag a LinkButton control to the Webform1.aspx. The following is the
HTML code.

<asp:LinkButton id="LinkButton1" style="Z-INDEX: 104; LEFT: 232px;
POSITION: absolute; TOP: 160px"
runat="server" Width="88px" Height="24px">LinkButton</asp:LinkButton>

3. Double click the LinkButton to add the event handler in the
WebForm1.aspx.cs file.

private void LinkButton1_Click(object sender, System.EventArgs e)
{
Response.Write ("Test");
}

4. Build and test this issue.

If I have misunderstood your concern, please feel f

Best regards

Jacob Yang
Microsoft Online Partner Support
Get Secure! ¨C www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
 
Back
Top