473,320 Members | 2,088 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,320 software developers and data experts.

Need Help with user control

WW
I have created a web user control and it work fine from my aspx page and I
can access its valuse from my aspx page using Run at server attribute.

BUT there are some page where I am using code behind files. The problem is
that when I try to access it from code behind files..then I get the message
that control is not declared.. Can somebody let me know how to access it
from code behind files.

Thanks in advance

Feb 9 '06 #1
2 859
You have to declare that control in your codebehind class.
For standard .NET controls wizard do it automatically when you drop them on
page.
For UserControls it does not do it. Just do it manually

protected clsMyControl myControl;

myControl name must match the ID you gave it in HTML.
George
"WW" <in**@ww.com> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I have created a web user control and it work fine from my aspx page and
I can access its valuse from my aspx page using Run at server attribute.

BUT there are some page where I am using code behind files. The problem is
that when I try to access it from code behind files..then I get the
message that control is not declared.. Can somebody let me know how to
access it from code behind files.

Thanks in advance

Feb 9 '06 #2
Example.

Protected Withevents MyCalendar1 as Calander

make sure the declared name is the same as the id= in the HTML.

--
Terry Burns
http://TrainingOn.net

"WW" <in**@ww.com> wrote in message
news:OH**************@TK2MSFTNGP11.phx.gbl...
I have created a web user control and it work fine from my aspx page and
I can access its valuse from my aspx page using Run at server attribute.

BUT there are some page where I am using code behind files. The problem is
that when I try to access it from code behind files..then I get the
message that control is not declared.. Can somebody let me know how to
access it from code behind files.

Thanks in advance

Feb 9 '06 #3

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

Similar topics

19
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate...
2
by: Kiran | last post by:
Hi, I use a lot of web user controls for web development. And I need all your views on this. (1)Does the functionality(Logic part) of a web user control should be included in the aspx page...
6
by: junk | last post by:
Senerio: I have a custom user control which contains two control arrays. The user control has a group box in which the two control arrays are dynamically built. The two control arrays are...
3
by: 100grand | last post by:
Modify the Inventory Program to use a GUI. The GUI should display the information one product at a time, including the item number, the name of the product, the number of units in stock, the price...
6
by: Cralis | last post by:
Hi guys, Someone once said, 'You can do that with reflection'. I can't recall what it was I was trying to do at the time, but then he said, 'Any developer knows what reflection is...'. I kept...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.