Solved

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

Posted on 2008-10-31
7
1,221 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
ID: 22854151
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
ID: 22854242
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
ID: 22854269
have you added tag prefix ed in web.config?

can you post the code that is giving error
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:ChiBella
ID: 22854303
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
ID: 22855735
Change ClassName="WebUserControl.ascx.cs"  to CodeBehind="WebUserControl.ascx.vb" Inherits="<yourNamespace>.WebUserControl1"
0
 
LVL 16

Expert Comment

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

Assisted Solution

by:TechTiger007
TechTiger007 earned 250 total points
ID: 22856022
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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
C# Single Form 8 43
Search an image for an image 3 31
C# bracket error 3 33
vb.net winforms sizing/resolution? 4 34
The object model of .Net can be overwhelming at times – so overwhelming that quite trivial tasks often take hours of research. In this case, the task at hand was to populate the datagrid from SQL Server database in Visual Studio 2008 Windows applica…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

832 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