Jump to content

Check out our Community Blogs

Register and join over 40,000 other developers!

Recent Status Updates

View All Updates

- - - - -

ASP.NET Error: Compiler Error Message: CS1061

html asp.net c# error click event

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 Tchpowdog


    CC Regular

  • Member
  • PipPipPip
  • 44 posts

Posted 27 June 2014 - 07:16 AM

I keep getting this error:


Compiler Error Message: CS1061: 'ASP.results_aspx' does not contain a definition for 'LinkButton2_Click' and no extension method 'LinkButton2_Click' accepting a first argument of type 'ASP.results_aspx' could be found (are you missing a using directive or an assembly reference?)


This is my html code:

Line 195: <asp:Label ID="Label1" runat="server" Text="|"></asp:Label>
Line 196: &nbsp;
Line 197: <asp:LinkButton ID="LinkButton2" runat="server" ForeColor="White" OnClick="LinkButton2_Click">Home</asp:LinkButton>
Line 198: &nbsp;
Line 199: <asp:Label ID="Label116" runat="server" Text="|"></asp:Label>

This is my code behind:

protected void LinkButton2_Click(object sender, EventArgs e)

If I delete the linkbutton, the page works.  If I take the "OnClick" event out of the linkbutton tag, page works... I'm baffled, please help!


#2 lespauled


    CC Leader

  • Expert Member
  • PipPipPipPipPipPipPip
  • 1360 posts

Posted 27 June 2014 - 10:56 AM

More than likely, your designer file is out of sync with your page.  One solution would be to remove the control, then add another one.  Then double click on the control to add the onclick method.  Then build it.


If that works, welcome to the wonderful world of webforms in Visual Studio.

My Blog: http://forum.codecal...699-blog-77241/
"Women and Music: I'm always amazed by other people's choices." - David Lee Roth

#3 BlackRabbit


    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 27 June 2014 - 06:51 PM

It's exactly what Lespauled said!


The world of non reliable refactoring, and faulty graphic design interfaces :D

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download