Hello,
I have been trying to add a user control at runtime to a page:
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
The problem is this does not give me access to the user control
properties. So I tried the following:
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
However MyUserControl is not recognized.
How can solve this?
I looked everywhere and I can't find the solution.
Thanks,
Miguel 5 1211
In 2.0, you need to add a @Reference directive atop your page...somethng
like:
<%@Reference Control="~/controls/user.ascx" %>
which'll then make the type available in codebehind.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Hello,
I have been trying to add a user control at runtime to a page:
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
The problem is this does not give me access to the user control
properties. So I tried the following:
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
However MyUserControl is not recognized.
How can solve this?
I looked everywhere and I can't find the solution.
Thanks,
Miguel
Hello,
But why do I need a reference in my master page if I am doing
everything in my master page code behind code?
Thanks,
Miguel
Karl Seguin wrote:
In 2.0, you need to add a @Reference directive atop your page...somethng
like:
<%@Reference Control="~/controls/user.ascx" %>
which'll then make the type available in codebehind.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Hello,
I have been trying to add a user control at runtime to a page:
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
The problem is this does not give me access to the user control
properties. So I tried the following:
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
However MyUserControl is not recognized.
How can solve this?
I looked everywhere and I can't find the solution.
Thanks,
Miguel
Karl,
I did add the reference and I still have the problem.
I can't access my user control properties in the code behind code of
where I add it.
Any idea?
Thanks,
Miguel
shapper wrote:
Hello,
But why do I need a reference in my master page if I am doing
everything in my master page code behind code?
Thanks,
Miguel
Karl Seguin wrote:
In 2.0, you need to add a @Reference directive atop your page...somethng
like:
<%@Reference Control="~/controls/user.ascx" %>
which'll then make the type available in codebehind.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Hello,
>
I have been trying to add a user control at runtime to a page:
>
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
>
The problem is this does not give me access to the user control
properties. So I tried the following:
>
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
>
However MyUserControl is not recognized.
>
How can solve this?
>
I looked everywhere and I can't find the solution.
>
Thanks,
Miguel
>
The new compilation model in 2.0 makes every page+codebehind get compiled
into it's own assembly.
Just like any other assemblies, you can't use them unless they are
referenced in your project.
Since the assembly name is dynamic, you use the @reference attribute to hook
it up for it.
I don't like it, but it's how it works..
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@l12g2000cwl.googlegro ups.com...
Hello,
But why do I need a reference in my master page if I am doing
everything in my master page code behind code?
Thanks,
Miguel
Karl Seguin wrote:
>In 2.0, you need to add a @Reference directive atop your page...somethng like:
<%@Reference Control="~/controls/user.ascx" %>
which'll then make the type available in codebehind.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message news:11*********************@f1g2000cwa.googlegro ups.com...
Hello,
I have been trying to add a user control at runtime to a page:
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
The problem is this does not give me access to the user control
properties. So I tried the following:
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
However MyUserControl is not recognized.
How can solve this?
I looked everywhere and I can't find the solution.
Thanks,
Miguel
Hi Karl,
I solved it using another way which I prefer.
I place all user controls inside the namespace MyWebSite.
Then I add then namespace in Web.Config.
I prefer this way. It is working ... for now :-)
Thanks,
Miguel
Karl Seguin wrote:
The new compilation model in 2.0 makes every page+codebehind get compiled
into it's own assembly.
Just like any other assemblies, you can't use them unless they are
referenced in your project.
Since the assembly name is dynamic, you use the @reference attribute to hook
it up for it.
I don't like it, but it's how it works..
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@l12g2000cwl.googlegro ups.com...
Hello,
But why do I need a reference in my master page if I am doing
everything in my master page code behind code?
Thanks,
Miguel
Karl Seguin wrote:
In 2.0, you need to add a @Reference directive atop your page...somethng
like:
<%@Reference Control="~/controls/user.ascx" %>
which'll then make the type available in codebehind.
Karl
-- http://www.openmymind.net/ http://www.fuelindustries.com/
"shapper" <md*****@gmail.comwrote in message
news:11*********************@f1g2000cwa.googlegrou ps.com...
Hello,
I have been trying to add a user control at runtime to a page:
Dim myUserControl As Control = LoadControl("MyUserControl.ascx")
The problem is this does not give me access to the user control
properties. So I tried the following:
Dim myUserControl As MyUserControl =
CType(LoadControl("MyUserControl.ascx"), MyUserControl)
However MyUserControl is not recognized.
How can solve this?
I looked everywhere and I can't find the solution.
Thanks,
Miguel
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Barbara Alderton |
last post by:
I have the following scenario:
I have a user control that contains a registered menu control. The menu and
other information on the user control is specific to the user accessing the
site. ...
|
by: MattB |
last post by:
I have a page header that I made as a user control (ascx) that I drop on
every page in my application. The application is an eCommerce application
and I have a total for items in the cart on the...
|
by: Steve Booth |
last post by:
I have a web form with a button and a placeholder, the button adds a user
control to the placeholder (and removes any existing controls). The user
control contains a single button. I have done all...
|
by: thomson |
last post by:
Hi all,
i do have a user control with 4 buttons, and all the events
are firing properly,
My problem is that i need to right an event handler in the user
control, which gets fired after a...
|
by: Jonathan Wood |
last post by:
Okay, as evidenced by other questions, I am an experienced programmer very
new to ASP.NET.
I have a vertical navigation bar. It is all one color with several panels
inside it with a different...
|
by: Tony Johansson |
last post by:
Hello!
I have one solution file that consist of three project.
One project that build the exe file called A
One project that build a user control dll. Here we have a class called B
One project...
|
by: tony |
last post by:
Hello!
This is a rather long mail but it's a very interesting one.
I hope you read it. I have tried several times to get an answer to this mail
but I have
not get any answer saying something...
|
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...
|
by: Tom |
last post by:
Is there any way to 'download' a control that could access hardware on
a PC? Reason is that I am considering retooling a client-server app of
ours over to ASP.NET (VB.NET). However, currently that...
|
by: Aussie Rules |
last post by:
Hi,
Is there a way to have a screen/form designer functionality in a vb.net2008
program for the end user to use ?
I want to be able to distribute my application, and allow the end user to...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
| |