473,387 Members | 1,834 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.Page 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 1341
"Chris" <fr*******@surf.to> wrote in message
news:11********************@c13g2000cwb.googlegrou ps.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
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
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...
3
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...
0
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...
3
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...
2
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...
9
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...
8
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...
5
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...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
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...

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.