Linkbutton submits the form but OnClick event does not get fired

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
 
J

Jacob Yang [MSFT]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top