Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Custom Web User Control Error When Using 2 Instances

Status
Not open for further replies.

apc2003

Programmer
Aug 29, 2003
54
0
0
GB
Hi,

I have a ASP.net Custom Web User Control that I have developed for our ASP.net application.

Everything works great, until I try to declare a second instance in the C# side of the code.

Without the C# declaration for the second instance it works fine declaring the second instance in the HTML side isn't a problem, but i need to set the properties in the C# side and obviously to do this I need a declaration for the second control.

I have declared the second instance just like the first but given it a different name and html id from the first.

Code:
C#
apcButton apcButton1 = new apcButton();
apcButton apcButton2 = new apcButton(); // This line errors
The Error I get is as follows:
Compiler Error Message: CS0117: 'ASP.WebForm1_aspx' does not contain a definition for 'apcbutton2'

Can anyone suggest a fix or what is going wrong?

Regards in advance...
 
could you post the code for the constructor?

--------------------------
"two wrongs don't make a right, but three lefts do" - the unknown sage
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top