473,503 Members | 8,784 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Base class and controls

Hello,

I made a base class for all the pages in my project, so that instead
of "public class CSomePage : System.Web.UI.Page" i got "public class
CSomePage : CPage

Since some parameters are common to all pages, i did put some server
hidden fields controls in the base class.

Ex: (in the base class)

protected Gam.CHiddenField mIdEntreprise;
protected Gam.CHiddenField mIdCoord;

Like that, i put some <asp:CHiddenField ... /> in each aspx and i can
reference my controls (mIdEntreprise and mIdCoord) in the derived
classes. Works great.

However when i modify the html code in an aspx the vs editor is adding
the following code in the derived class :

protected Gam.CHiddenField mIdEntreprise;
protected Gam.CHiddenField mIdCoord;

Thus overriding the declarations in the base class, resulting in
errors at runtime. I have to remove the declarations in the derived
class manually everytime, very annoying. How can i stop the vs editor
to add the declarations in the derived class, if the control is
already declared in the base class?

Thanks for any help. Matt

Nov 18 '05 #1
0 857

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

Similar topics

4
9762
by: james | last post by:
I have a custom UserControl, which can have many sub class levels derived from it. I want to be able to discover all the components at Load time, but the only components I can see from the base...
0
793
by: Rans | last post by:
Hello, I made a base class for all the pages in my project, so that instead of "public class CSomePage : System.Web.UI.Page" i got "public class CSomePage : CPage Since some parameters are...
2
1365
by: clintonG | last post by:
I've created a base class that inherits from System.Web.UI.Page. I've been using Page_PreInit in the base class to change Themes. I'm using MasterPages and need a bunch of code in each content...
0
938
by: Edward Diener | last post by:
I have a base class derived from System.Web.UI.Page, and derived classes derived from the base class. The base class has protected HTML hidden fields in it, and the derived class's aspx page has...
1
1467
by: matt | last post by:
Hi, I have two very similar pages, whose codebehind I'd like to derive from the same base class so I can reuse the controller logic. For (hopeful) clarity I'll try and draw this in ASCII-UML!...
0
998
by: droyad | last post by:
I have recently upgraded a web project from ASP.NET 1.1 to ASP.NET 2.0, and now the event handlers no longer work, due to the event handlers being defined in base classes. To start a bit of...
26
5333
by: nyathancha | last post by:
Hi, How Do I create an instance of a derived class from an instance of a base class, essentially wrapping up an existing base class with some additional functionality. The reason I need this is...
0
993
by: rjl444 | last post by:
web developer express asp.net 2.0: I need to have 3 user controls. these controls include a textbox and several asp controls (checkbox, button, etc). I would like to have a base class that...
0
1004
by: Steve Richter | last post by:
my composite control does not render correctly the 2nd time it is made visible. When I change the base class from CompositeControl to WebControl, the control works as it should. public class...
0
7194
marktang
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,...
0
7070
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
6976
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...
0
7449
tracyyun
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...
0
4666
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...
0
3160
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...
0
1495
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 ...
1
729
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
372
bsmnconsultancy
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...

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.