Solved

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

Posted on 2008-10-31
7
1,219 Views
Last Modified: 2013-12-17
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?

0
Comment
Question by:ChiBella
  • 3
  • 2
  • 2
7 Comments
 
LVL 13

Expert Comment

by:TechTiger007
Comment Utility
Check if the method call and actual method has same parameter types and same number of parameters and return type
0
 

Author Comment

by:ChiBella
Comment Utility
Yes, I pulled this code out of a web form directly where it works with no problem.




 

WebUserControl.ascx
 

<ed:Editor ID="editorQ1" runat="server" Appearance="custom" Height="180" 

 ModeHTML="false" ModeSwitch="false" ShowQuickFormat="false" Width="400"

OnClickSubmit="Editor_SubmitClicked">
 
 
 

and code behind ascx:
 

protected void Editor_SubmitClicked(object sender, EventArgs e)

    {

//update database here...
 

           }

Open in new window

0
 
LVL 13

Expert Comment

by:TechTiger007
Comment Utility
have you added tag prefix ed in web.config?

can you post the code that is giving error
0
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 

Author Comment

by:ChiBella
Comment Utility
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

0
 
LVL 16

Accepted Solution

by:
ororiole earned 250 total points
Comment Utility
Change ClassName="WebUserControl.ascx.cs"  to CodeBehind="WebUserControl.ascx.vb" Inherits="<yourNamespace>.WebUserControl1"
0
 
LVL 16

Expert Comment

by:ororiole
Comment Utility
Oops, make that CodeBehind="WebUserControl.ascx.cs" Inherits="<yourNamespace>.WebUserControl1"
0
 
LVL 13

Assisted Solution

by:TechTiger007
TechTiger007 earned 250 total points
Comment Utility
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
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now