WebUserControl - 'WebUserControl.ascx.cs' does not contain a definition for..?'

I'm having a problem with a webusercontrol that contains a button embedded within an editor control. The button has a server side method "Editor_SubmitClicked" but for some reason this definition is not found.

here is the error message:

Error      4      'WebUserControl.ascx.cs' does not contain a definition for 'Editor_SubmitClicked' and no extension method 'Editor_SubmitClicked' accepting a first argument of type 'WebUserControl.ascx.cs' could be found (are you missing a using directive or an assembly reference?)      

Any ideas?

Who is Participating?
ororioleConnect With a Mentor Commented:
Change ClassName="WebUserControl.ascx.cs"  to CodeBehind="WebUserControl.ascx.vb" Inherits="<yourNamespace>.WebUserControl1"
Check if the method call and actual method has same parameter types and same number of parameters and return type
ChiBellaAuthor Commented:
Yes, I pulled this code out of a web form directly where it works with no problem.

<ed:Editor ID="editorQ1" runat="server" Appearance="custom" Height="180" 
 ModeHTML="false" ModeSwitch="false" ShowQuickFormat="false" Width="400"
and code behind ascx:
protected void Editor_SubmitClicked(object sender, EventArgs e)
//update database here...

Open in new window

Train for your Pen Testing Engineer Certification

Enroll today in this bundle of courses to gain experience in the logistics of pen testing, Linux fundamentals, vulnerability assessments, detecting live systems, and more! This series, valued at $3,000, is free for Premium members, Team Accounts, and Qualified Experts.

have you added tag prefix ed in web.config?

can you post the code that is giving error
ChiBellaAuthor Commented:
This is a compile error...where the EditorSubmit_Clicked event in the code behind cannot be found.

I have tags for the editor in the ascx page:

<%@ Control Language="C#" ClassName="WebUserControl.ascx.cs"  %>
<%@ Register Assembly="obout_Editor" Namespace="OboutInc.Editor" TagPrefix="ed" %>

Open in new window

Oops, make that CodeBehind="WebUserControl.ascx.cs" Inherits="<yourNamespace>.WebUserControl1"
TechTiger007Connect With a Mentor Commented:
The below error means that  your compiler is looking for the method in the class "WebUserControl.ascx.cs". I think your class name is not this.
"'WebUserControl.ascx.cs' does not contain a definition for'WebUserControl.ascx.cs' does not contain a definition for"

Your tags attributes are wrong. Follow the steps suggested by ororiole to fix this error
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.