473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pointing at code behinh in User Control-C#

I have built a user control. When a button is clicked I want it to go
to a subroutine in the code behind. But it wants me to put it in the
asp code as a script. So how do I point to the code in the other file.
I have tried things and all I get is other errors.

I want to fix this error, but it has to find it in the code behind.

Error 4 'ASP.WebUserControl' does not contain a definition for
'Button1_Click' C:\Documents and Settings\kevinrep\My
Documents\Visual Studio 2005\WebSites\NewProp\Companies.ascx 31

This is probably something simple, but I just do not know what to do.

Thanks,
riprip

May 10 '06 #1
3 1202
Are you referencing the file with the new CodeFile attribute of the Page
Directive? Also, make sure that the class in the codefile is declared as a
partial class.

Hope this helps,
Mark Fitzpatrick
Microsoft MVP - FrontPage

<aa*******@yahoo.com> wrote in message
news:11**********************@j73g2000cwa.googlegr oups.com...
I have built a user control. When a button is clicked I want it to go
to a subroutine in the code behind. But it wants me to put it in the
asp code as a script. So how do I point to the code in the other file.
I have tried things and all I get is other errors.

I want to fix this error, but it has to find it in the code behind.

Error 4 'ASP.WebUserControl' does not contain a definition for
'Button1_Click' C:\Documents and Settings\kevinrep\My
Documents\Visual Studio 2005\WebSites\NewProp\Companies.ascx 31

This is probably something simple, but I just do not know what to do.

Thanks,
riprip

May 10 '06 #2
Mark,

I figured it out by creating a new user control. The wizard had on
option to create a code behind file. So I recreated the user control
by copying everything in the new user control and copying the code I
needed to the new user control code file. Then I excluded the old user
control from the project so that I could rename the new control to the
original name. Then I had to clean up the renaming in some of the
files to the new name. It worked.

The reason I did all that is that I did not know how to create the C#
code fine in the project. I knew I had to use the CodeFile attribute
and Inherits attribute, but I did not know what to put in them. Now I
know.

Now I have another problem so I guess I will have to make a new post if
I can not figure it out.

Thanks for getting back to me.

Riprip

May 10 '06 #3
I forgot to say this was with ASP.NET express 2.0.

Riprip

May 10 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Colin | last post by:
Hi there, I really need your help on this. I'm trying to learn to using the VS.2003 to create a User Control. In my aspx code has no problem to use the property "grossWaye" that has "register" in...
1
by: Daveyk0 | last post by:
Hello there, I have a front end database that I have recently made very many changes to to allow off-line use. I keep copies of the databases on my hard drive and link to them rather than the...
3
by: Scott Collens | last post by:
Hi there, does anyone know if it is possible to set a value in a user control and pick it up in the code behind. I'm trying to reuse the same user control and code behind for multiple pages but...
2
by: Earl Teigrob | last post by:
I have run into a situation where I need to run the !IsPostBack code under one circumstance, even if it is a postback. Something that may complicate matters more is that this is a double postback...
6
by: Earl Teigrob | last post by:
I am writing an application that dynamically loads user controls at run time based on user options. I would like to give my users the ability to build their own user controls and add them to my...
3
by: christophe.verne | last post by:
Hi all, It's the first time I'm using groups so i hope I am posting on the good group. I''m not familiar with callback and function pointer and here is what I'd like to do: typedef struct...
16
by: mailforpr | last post by:
How do I do that? The thing is, the only information I have about the iterator is the iterator itself. No container it is belonging to or anything. Like template<Iteratorvoid...
2
by: rn5a | last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with the IDs 'txt1' & 'txt2' respectively. To use this user control in an ASPX page, the following Register directive will be...
21
by: tvnaidu | last post by:
This is the Java script I am using fo rlogin page, but cursor not pointing to login box, any idea how can I point cursor to login box when this page loaded?. here admin login take to control page and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.