473,666 Members | 2,302 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Web controls declarations in base class

This may be more of a Visual Studio question but those groups seem to
be full of unrelated stuff so hopefully this might be the right place.

I have a class (no associated aspx file) which handles all the common
startup code for the pages on our website. It is derived from
System.Web.UI.P age and every page in 2 separate projects (web
applications) derives from it. It contains several declarations of
server controls such a navigation bar that are common to all pages.

My problem is that when I open a webform that derives from the shared
base class, Visual Studio inserts declarations for the nav bar and
other controls into the code behind file for that webform even though
it derives from the base class which declares the controls itself,
hiding the underlying declaration. So at runtime when I try to acces
the controls in the start up code they are set to null because the
control in the .aspx page is not linked with the correct declaration.

It's annoying having to delete the declarations every time I open the
webform. How can I stop this or get visual studio to recognise the
underlying declarations? The declarations are all protected and I'm
using C# in Visual Studio 7.1.3038

Nov 19 '05 #1
1 1359
"Chris" <fr*******@surf .to> wrote in message
news:11******** ************@c1 3g2000cwb.googl egroups.com...
My problem is that when I open a webform that derives from the shared
base class, Visual Studio inserts declarations for the nav bar and
other controls into the code behind file for that webform even though
it derives from the base class which declares the controls itself,
hiding the underlying declaration. So at runtime when I try to acces
the controls in the start up code they are set to null because the
control in the .aspx page is not linked with the correct declaration.


Sorry, that's known behavior. VS.NET 2002/2003 weren't meant to deal with
"visual inheritance" in Web Forms like you have in Windows Forms.

John Saunders
Nov 19 '05 #2

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

Similar topics

3
5462
by: mjm | last post by:
Folks, Please help me with the following problems: ******************************************** 1. I have a class template template<class Base> class Matrix : public Base { /* .... */ }
2
2604
by: Rachel Suddeth | last post by:
Here is my scenario: I have a few custom controls that I set up on a form and tested setting properties and appearances. Then I added a couple references to the project which add classes I need to get data from the server to actually do something useful. (These are generated by 3rd party database software.) After adding those references, and no other changes to my form.... all the controls disappear from the visual interface on the...
3
2639
by: Steve Drake | last post by:
All, I have a CONTROL that contains 1 control (Control ONE), the 1 control that it can contain 1 or 2 control (Control A and B). Control A, raises and event and Control ONE receives this event and this causes control B to be created, when this is done the VIEWSTATE is lost for CONTROL B. In the EVENT that causes CONTROL B to be created I have to set
0
864
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 common to all pages, i did put some server hidden fields controls in the base class. Ex: (in the base class)
3
1928
by: Mr Newbie | last post by:
I am messing around with Web User Controls at present and (think) I have discovered the following. 1.) The identifier for the control in the code behind must match the ID for the control on the page. 2.) The identifier must be delcared with a minimum access of 'Protected' in order to work. If the above is indeed correct, then I have made the following assumptions
2
1308
by: Dennis | last post by:
I have a control that inheirts from "Panel". I want to prevent the user from having access to the MoueUp event. I tried making a sub in my control that handles MyBase.MouseUp but still this event shows up as an event the user can use. Is there anyway to prevent users of this control from getting access to events such as MouseUp. Thanks. -- Dennis in Houston
9
4091
by: Alan Silver | last post by:
Hello, I have a user control which I am trying to load dynamically, but am running into problems. I think the problem is because I have two .ascx files that refer to the same .ascx.cs file. A simple example is like this... Ferret1.ascx =========
8
3176
by: mark.norgate | last post by:
I've run into a few problems trying to use generics for user controls (classes derived from UserControl). I'm using the Web Application model rather than the Web Site model. The first problem I'm having is that the partial class signature in my projectDetails.ascx.cs file looks like this: public partial class ProjectDetailsControl<TEntryServiceProvider: UserControl, INamingContainer where TEntryServiceProvider : IEntryServiceProvider...
5
1556
by: =?Utf-8?B?UmJydA==?= | last post by:
There is a lot of good material related to using Master Pages for formatting controls and putting common design elements on multiple pages. I have VB.NET code that is common to all of my pages for doing things like rendering controls, making database connections, instantiating custom classes, etc... I am trying to figure out how to put code in the Master Page that will address controls on the content pages which use that master - say...
0
8443
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, 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...
0
8356
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
Oralloy
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...
1
8550
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,...
0
8639
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 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...
1
6192
isladogs
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...
0
4198
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...
1
2769
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
2
2011
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.