I'm fond of web controls in ASP.NET, but the need for <@ Register%>
blocks at the top of each page is a pain.
ASP.NET 2.0 has a way to centrally register controls in the web.config
file, but it is poorly documented and appears to be broken.
I have added my standard user controls to my web.config file. The MSDN
examples are flat wrong, by the way (bad XML case and attribute names,
won't compile). The proper syntax for registering server and user
controls is as follows:
<configuration> <system.web><pa ges><controls>
<add tagPrefix="RST" namespace="RST. UI" assembly="RST.U I" />
<add tagPrefix="RST" tagName="Header "
src="~/controls/header.ascx" />
</controls></pages></system.web></configuration>
Ok, so now I can use declarative instantiation on any ASPX page,
without the need for a page-level @Register directive:
<RST:Header runat="server" id="MyHeader" />
And, with at least one instance of a particular control created that
way, I can programmaticall y create others:
Public Sub Page_Load()
' ClassName="Head er" in the header.ascx
Dim o As New ASP.Header
End Sub
The problem is, I am usually creating *every* instance of some controls
dynamically in the Page_Load() method. But without at least one
declarative instance or an @Register directive, I get the following
error:
Type 'ASP.MyHeader' is not defined.
What am I missing here? Creating dummy instances of every control class
is even worse than having an army of @Register directives on every page. 5 1843
I will admit that I have not tried using web.config in place of the
@register directive, but in your example you have an attribute of
assembly="RST.U I"
I could be wrong, but aren't assemblies usually .dll files? I think that
there might be a way to add a line in the AssemblyInfo.vb (or whatever file)
file that does what you want. Try looking into that, although I won't make
any promises since I prefer the simple @register technique, I don't think
it's that bad when all you have to do is a little copy & pasting. Good Luck!
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
<ri************ *@gmail.com> wrote in message
news:11******** *************@g 49g2000cwa.goog legroups.com... I'm fond of web controls in ASP.NET, but the need for <@ Register%> blocks at the top of each page is a pain.
ASP.NET 2.0 has a way to centrally register controls in the web.config file, but it is poorly documented and appears to be broken.
I have added my standard user controls to my web.config file. The MSDN examples are flat wrong, by the way (bad XML case and attribute names, won't compile). The proper syntax for registering server and user controls is as follows:
<configuration> <system.web><pa ges><controls> <add tagPrefix="RST" namespace="RST. UI" assembly="RST.U I" /> <add tagPrefix="RST" tagName="Header " src="~/controls/header.ascx" /> </controls></pages></system.web></configuration>
Ok, so now I can use declarative instantiation on any ASPX page, without the need for a page-level @Register directive:
<RST:Header runat="server" id="MyHeader" />
And, with at least one instance of a particular control created that way, I can programmaticall y create others:
Public Sub Page_Load() ' ClassName="Head er" in the header.ascx Dim o As New ASP.Header End Sub
The problem is, I am usually creating *every* instance of some controls dynamically in the Page_Load() method. But without at least one declarative instance or an @Register directive, I get the following error:
Type 'ASP.MyHeader' is not defined.
What am I missing here? Creating dummy instances of every control class is even worse than having an army of @Register directives on every page.
The assembly name is "RST.UI.dll ", and the register directive leaves
off the DLL. But this issue applies both to DLL and ASCX controls.
Copy and paste is never a good programming practice. I make heavy use
of custom controls, so centralization is a key requirement, and I don't
want to give up using ASCX files in the process.
Did you try looking into a way of adding something to the AssemblyInfo.dl l
file that accomplishes what you want? I'm not sure exactly what it would be,
but I seem to remember reading something about a way to use AssemblyInfo.dl l
that might accomplish what you want.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
<ri************ *@gmail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. . The assembly name is "RST.UI.dll ", and the register directive leaves off the DLL. But this issue applies both to DLL and ASCX controls.
Copy and paste is never a good programming practice. I make heavy use of custom controls, so centralization is a key requirement, and I don't want to give up using ASCX files in the process.
Nathan, thanks, but I think you are missing the point. ASCX files don't
*have* an AssemblyInfo.dl l file, they are standalone, plain-text files
that are compiled dynamically by ASP.NET.
ASP.NET is supposed to offer this functionality now via the web.config
file, but it appears to not work as advertised, and the SDK
documentation is completely useless.
I apologize, I meant to say the AssemblyInfo.vb file. This is a file
required by all ASP.NET applications written in VB.NET (if you are using C#
it is called AssemblyInfo.cs ). Like I have mentioned before, I have never
modified this file, so I don't know everything that can be put in it or what
it can be used for, I am simply suggesting that you look into it.
--
Nathan Sokalski nj********@hotm ail.com http://www.nathansokalski.com/
<ri************ *@gmail.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. . Nathan, thanks, but I think you are missing the point. ASCX files don't *have* an AssemblyInfo.dl l file, they are standalone, plain-text files that are compiled dynamically by ASP.NET.
ASP.NET is supposed to offer this functionality now via the web.config file, but it appears to not work as advertised, and the SDK documentation is completely useless. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Carel Lotz |
last post by:
H
We have ported our VB 6 application into VB .NET but are still integrating with a few COM + applications written in VB6 running on our application server (Win 2000 Server). We have the proxies to link to the application server installed but we every now and then get a error when we try to make a call to a component running on the app server. The error message is something like
Object reference not set to an instance of an objec
at...
|
by: ernesto |
last post by:
Hi everybody:
I have the following implementations:
class A
{
public:
virtual int GetValue() = 0;
};
|
by: Bobby C. Jones |
last post by:
I'm trying to use some classes defined in a COM component that I did not
create. I have successfully created the RCW via Tlbimp.exe and referenced
it in my project. All is well until I run the project and it chokes with an
"Invalid access to memory location." error when I try to instantiate an
object like so:
AecXSchedule30.AecAnchorTagToEntClass anchor = new
AecXSchedule30.AecAnchorTagToEntClass();
I'm not sure where the best place...
|
by: Simon Bond |
last post by:
In C# we can go:
<foo.cs>
// Create a serializable class
public class Foo : ISerializable
{
public void GetObjectData(SerializationInfo info,
StreamingContext context)
{};
|
by: Andreas Poller |
last post by:
Hello,
I have the following problem:
I have a class deriving from ICustomTypeDescriptor:
public __gc class TPropertyBag : public ICustomTypeDescriptor
{
private: ...
| |
by: Primoz Gustincic |
last post by:
I'm explicitly implementing an interface defined in assembly A.
public __gc __interface IPop
{
Void GetPop();
};
public __abstract __gc class CPOP : public IPop
{
private:
|
by: Lauxa |
last post by:
I am hosted on GoDaddy (Linux) and I am trying to use the ZipArchive php classes. I called GoDaddy technical support and asked if they supported the ZipArchive classes and they said yes. I cannot get it to work; I am down to a single line of code in a test file:
<?php $zip = new ZipArchive; ?>
Which fails with the following error:
Fatal error: Cannot instantiate non-existent class: ziparchive in...
|
by: pedro |
last post by:
application cannot read the app.config file
i have a config file for the executable
i try to read it but it throws an exception
when building the setup for the project vs2005 do not add the
app.config automatically
public Form1()
|
by: jainchar |
last post by:
hello
i m in trouble that my project is in vc++ with mfc.my program giving the error that
error c2259:"CException" cannot instantiate abstract class.
when i remove this error then my project is giving the error in file afxres.rc .according to the error when i remove it and compile or debug the project then this can't save.so what should i do.please help me and can somebody give me the guideline that what is the afxres.rc file.
|
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: 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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
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: 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: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
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: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |