Solved

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

Posted on 2008-10-31
7
1,222 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
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 

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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Object Oriented Programming, C#, referencing, scoping. 13 69
No Data for DropDown List 2 28
transition to visual .net from vb6 5 39
Get month and date in a format 4 32
Flash (http://en.wikipedia.org/wiki/Adobe_Flash) has evolved over the years to where it has become a masterful tool for displaying content screen.  It has excellent layout placement, UI precision as well as rendering capabilities. This, along with t…
This article describes relatively difficult and non-obvious issues that are likely to arise when creating COM class in Visual Studio and deploying it by professional MSI-authoring tools. It is assumed that the reader is already familiar with the cla…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

837 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