In several of my UserControls I add properties. If I access these properties
in the CodeBehind of the pages that use the controls, I recieve an error
when compiling. The reason for this is because the compiler tries to compile
the pages that use the UserControls before compiling the UserControls, and
therefore does not know that the property exists when compiling. The only
way around this that I have found is to use the CType() function as follows:
CType(MyUserCtr lInstance, MyUserCtrlClass ).AddedProperty
instead of:
MyUserCtrlInsta nce.AddedProper ty
Even though this works, it is a lot of extra CType() functions that would
not be necessary if I could simply have my UserControls compiled first. Is
there any way to make the compiler look at my UserControls first without
putting them in a separate assembly? Thanks.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/ 5 1159
Well, if the UserControls are not compiled (or at least resolved properly),
the classes that depend on them would not compile.
And btw, what is the datatype of MyUserCtrlInsta nce? Is it simply
UserControl --- if so, yes, you are already in trouble.
--
Happy Hacking,
Gaurav Vaish | www.mastergaurav.com www.edujini-labs.com http://eduzine.edujinionline.com
-----------------------------------------
"Nathan Sokalski" <nj********@hot mail.comwrote in message
news:uI******** ******@TK2MSFTN GP04.phx.gbl...
In several of my UserControls I add properties. If I access these
properties in the CodeBehind of the pages that use the controls, I recieve
an error when compiling. The reason for this is because the compiler tries
to compile the pages that use the UserControls before compiling the
UserControls, and therefore does not know that the property exists when
compiling. The only way around this that I have found is to use the
CType() function as follows:
CType(MyUserCtr lInstance, MyUserCtrlClass ).AddedProperty
instead of:
MyUserCtrlInsta nce.AddedProper ty
Even though this works, it is a lot of extra CType() functions that would
not be necessary if I could simply have my UserControls compiled first. Is
there any way to make the compiler look at my UserControls first without
putting them in a separate assembly? Thanks.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
Out of curiuosity nathan, What langauge are you using
C#? or VB.NET
And what version of .NET are you using? 1.x or 2.0 ?
I put controls in my App_Code all the time for quicker testing and
development and this usually works fine for me.
"Nathan Sokalski" wrote:
In several of my UserControls I add properties. If I access these properties
in the CodeBehind of the pages that use the controls, I recieve an error
when compiling. The reason for this is because the compiler tries to compile
the pages that use the UserControls before compiling the UserControls, and
therefore does not know that the property exists when compiling. The only
way around this that I have found is to use the CType() function as follows:
CType(MyUserCtr lInstance, MyUserCtrlClass ).AddedProperty
instead of:
MyUserCtrlInsta nce.AddedProper ty
Even though this works, it is a lot of extra CType() functions that would
not be necessary if I could simply have my UserControls compiled first. Is
there any way to make the compiler look at my UserControls first without
putting them in a separate assembly? Thanks.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
"Nathaniel Greene" <Na************ **@community.no spamwrote in message
news:28******** *************** ***********@mic rosoft.com...
Out of curiuosity nathan, What langauge are you using
C#? or VB.NET
Fairly obviously VB.NET, judging by the fact that he's talking about
CType(), and the fact that he's crossposted, among others, to
microsoft.publi c.dotnet.langua ges.vb
Nathan Sokalski wrote:
In several of my UserControls I add properties. If I access these properties
in the CodeBehind of the pages that use the controls, I recieve an error
when compiling. The reason for this is because the compiler tries to compile
the pages that use the UserControls before compiling the UserControls, and
therefore does not know that the property exists when compiling. The only
way around this that I have found is to use the CType() function as follows:
CType(MyUserCtr lInstance, MyUserCtrlClass ).AddedProperty
instead of:
MyUserCtrlInsta nce.AddedProper ty
Even though this works, it is a lot of extra CType() functions that would
not be necessary if I could simply have my UserControls compiled first. Is
there any way to make the compiler look at my UserControls first without
putting them in a separate assembly? Thanks.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
Nathan, have you tried the Build | Rebuild Web Site menu item in VS.NET
2005? I was having the same problem. However when you rebuild the
entire web site it then compiles everything and you can pick up the
properties.
Hope this helps,
Corey
I do use Rebuild in VS.NET 2005, but I still receive the error. I have a
feeling that it is possible that my problem might be in that there is an
error somewhere else that is preventing the controls from compiling, since
it seems like this happens sometimes and not others. However, I am not sure
how to find where the other error is (if my suspicion is true) since it does
not list it in the compilation errors because it does not get to that point
in the compilation.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
"Corey B" <co***********@ gmail.comwrote in message
news:11******** **************@ s34g2000cwa.goo glegroups.com.. .
>
Nathan Sokalski wrote:
>In several of my UserControls I add properties. If I access these properties in the CodeBehind of the pages that use the controls, I recieve an error when compiling. The reason for this is because the compiler tries to compile the pages that use the UserControls before compiling the UserControls, and therefore does not know that the property exists when compiling. The only way around this that I have found is to use the CType() function as follows:
CType(MyUserCt rlInstance, MyUserCtrlClass ).AddedProperty
instead of:
MyUserCtrlInst ance.AddedPrope rty
Even though this works, it is a lot of extra CType() functions that would not be necessary if I could simply have my UserControls compiled first. Is there any way to make the compiler look at my UserControls first without putting them in a separate assembly? Thanks. -- Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
Nathan, have you tried the Build | Rebuild Web Site menu item in VS.NET
2005? I was having the same problem. However when you rebuild the
entire web site it then compiles everything and you can pick up the
properties.
Hope this helps,
Corey This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Kate |
last post by:
Hi:
I have a picturebox control, and at runtime various usercontrols are
added to it to make a diagram. As dynamically added usercontrols, they
are of type VBExtender.
Is there a way to save the diagram as a .wmf file? (The diagram might
extend beyond the confines of the actual picturebox on the screen.)
I have seen examples of how to print all the controls in a picturebox
|
by: Emma |
last post by:
Hi,
I'm developing a GUI with almost all Usercontrols. It's been working
wonderfull up till a few weeks ago, and really crashed yesterday.
Suddenly I can no longer add some of my usercontrols to any of the others
(I've also tried to create new usercontrols and windowforms and add them to
the new control, but that doesn't work any better). It's really frustrating
since I've been able to add them and run the program before.
|
by: Anders K. Jacobsen [DK] |
last post by:
Hi
I have some common UserControls i want to share between to sites (on the
same mashine but on diffrent virtual paths).
right now i have on solution file with aprox 10 projects. 2 of these is
webprojetcs wich need to shere some common userControls. Optimally i want a
class libarary project wich contains the controls so i could import the DLL
and use the controls. But that of course doesnt work.
|
by: N. Demos |
last post by:
I have a user control with code behind of which two instances are
created/declared in my aspx page. The aspx page has code behind also, as
I need to access methods of the usercontrols on page submit.
I've read several post here and articles on the web on this topic. What
little I have learned from them is that you have to pre-compile the
usercontrol in order to access it in the aspx code behind. I did this,
compiling the usercontrol...
|
by: YYZ |
last post by:
I swear I've done my research, and now I was just hoping someone could
explain this to me.
I've got a base class (usercontrol) that I am using just as an
interface. Meaning, I've defined several MustOverride subs in there,
and also a public property.
I'm going to inherit a bunch of usercontrols from this one superclass
(terminology correct?) and then they all have to make sure they can
respond to that set of functions that I've...
| |
by: Anders Borum |
last post by:
Hello!
I was wondering if I am the only person missing the option of outputting a
single dll for a website (just like the good old v1.1 compilation model)?
What I'm looking for is the ASP.NET framework to keep away from creating
random namespaces for each directory. The new build projects from the
Microsoft team shows promising, but I am not aware if the compilation model
is flexible enough to allow the "old" model ..
|
by: seigo |
last post by:
Hello,
I faced with the following problem. I have a PlaceHolder on a page and
a few UserControls which have custom events, for instance:
public delegate void SelectHandler(object sender, SelectEventArgs
e);
public event SelectHandler OnSelect;
protected void Page_Load(object sender, EventArgs e)
|
by: Nathan Sokalski |
last post by:
In several of my UserControls I add properties. If I access these properties
in the CodeBehind of the pages that use the controls, I recieve an error
when compiling. The reason for this is because the compiler tries to compile
the pages that use the UserControls before compiling the UserControls, and
therefore does not know that the property exists when compiling. The only
way around this that I have found is to use the CType() function as...
|
by: Nathan Sokalski |
last post by:
I have a page which I dynamically add several usercontrols (*.ascx files) to
using the following code:
Public Sub Refresh()
For Each section As DataRow In Me.GetSections().Rows
CType(Me.FindControl("admin" & CStr(section("buttontext")).Replace(" ",
"")), adminsection2).RefreshSection()
Next
End Sub
|
by: hirebrian |
last post by:
If you run accross the error message:
"Element '%' is not a known element. This can occur if there is a
compilation error in the Web site"
where '%' is the value of the tagName attribute on a web user control
you have delcared in your web.config file, then you might try
prefixing your src attribute value with the ~ (tilda) character. As
you probably know, this character tells ASP.NET to resolve the path
from the application root.
|
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
| |
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |