Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Linkbutton submits the form but OnClick event does not get fired

Reply
Thread Tools

Linkbutton submits the form but OnClick event does not get fired

 
 
Stan
Guest
Posts: n/a
 
      12-02-2003
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

 
Reply With Quote
 
 
 
 
Jacob Yang [MSFT]
Guest
Posts: n/a
 
      12-03-2003
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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Embedded <divs> with events: How to prevent the parent div's eventfrom being fired when the embedded div's event is fired? Num GG Javascript 2 11-17-2008 08:56 PM
Trying to use return false to not allow link to be accessed after onclick event is fired Terry Javascript 6 10-21-2007 11:25 PM
Trying to use return false to not allow link to be accessed after onclick event is fired. Terry Javascript 1 10-15-2007 07:56 PM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net 3 09-08-2005 09:41 AM
Linkbutton does not look like a linkbutton Sathyaish ASP .Net Datagrid Control 1 09-08-2005 08:44 AM



Advertisments