473,385 Members | 1,647 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,385 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 1340
"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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.