473,326 Members | 2,173 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,326 software developers and data experts.

Inheritance / Webform / IDE problem

I am having a problem with inheritance for my web solution.

Here are the steps I took for a project within C#:

-I first created a new class, descended from System.Web.UI.Page. For
this description, let's call this class "MyBasePage". Every webform
page within my solution will descend from this class instead of
System.Web.UI.Page. The reason for this is so that I have a common
base class from which I can put custom validation, formatting, and
messaging functionality for all of my pages. This base class does not
have a corresponding .aspx page since each page will be formatted
differently.

-Within that class, I declare a System.Web.UI.WebControls.Label
variable named "Msg". The purpose of this object is to have a common
place to give messages to the user, either in a header or footer of
the page.

-When I create a new WebForm, I change the inheritance to be from
MyBasePage instead of System.Web.UI.Page. I place a Label on the
..aspx templace on each new form and call it "Msg". The Msg object,
although placed within the .aspx page, is not declared within the .cs
file since it is declared in the base class. Everything works fine
and compiles.

Now this is where things go wrong::

If I switch from the HTML view to the designer for the .aspx page of
any of my descendant web pages, the IDE automatically adds the Msg
object to the list of declared page variables within the .cs file.
This, in turn, throws a warning during compilation and run-time errors
when the Msg object is accessed in code.

As long as I remove the declaration within the .cs file and recompile,
it all works. However, every time I switch to the page designer, it
replaces the declaration. It appears that the IDE does not verify
inheritance and existance of inherited webform objects before filling
them into the .cs file. Bug? Or am I doing things incorrectly?
TIA
Nov 15 '05 #1
0 1097

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

Similar topics

1
by: fravelgue | last post by:
Hi, I read the microsoft article: Templates Web Form (sorry it´s spanish) http://www.microsoft.com/spanish/msdn/comunidad/mtj.net/voices/art171.asp this article explain how to have design...
14
by: Steve Jorgensen | last post by:
Recently, I tried and did a poor job explaining an idea I've had for handling a particular case of implementation inheritance that would be easy and obvious in a fully OOP language, but is not at...
1
by: Benny | last post by:
Hi Since there is no 'WebForm inheritance', what r the ways we could create a base template webform, which the other forms could use Thanks in advance Benn
6
by: VR | last post by:
Hi, I read about Master Pages in ASP.Net 2.0 and after implementing some WinForms Visual Inheritance I tryed it with WebForms (let's say .aspx pages, my MasterPage does not have a form tag itself...
2
by: Dave | last post by:
Hi, this is a follow-up to an earlier question but I really haven't found a definitive answer in my search If I have a Base and Derived webform, I've found that the dervived Page_Load event...
5
by: Bart Schelkens | last post by:
Hi, I'm still using VB.NET 2002. I was wondering if I could do the following : I'm creating a web-application. Now I want to create a base-webform that contains the layout for all my pages....
2
by: daniel.nebel | last post by:
Dear all, when we inherit an ASP.NET webform for from a base class, and have some of the web controls defined there (the part which is usually contained within the 'web form designer generated...
0
by: Pedro Mir | last post by:
Hello! I have read inheritance in ASP.NET is possible in code files, not in web forms files. I need to create many folders but using the same webforms. How can I deploy this so I have only one...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.