473,414 Members | 1,677 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,414 software developers and data experts.

Question About Inherited WebForm Classes Containing Components

I'm confused about the behavior of inherited WebForms under VS/NET 2003.

In the Windows.Forms world, if I create a UserControl with a protected component on it, that
protected component is visible (albeit locked) and accessible in any class derived from the custom
control.

But in ASP.NET, if I create a WebForm1 class and add, say, a DataSet component to it, it's not
visible in any derived classes, even though it, too, is protected.

The reason I'm curious about this is that I have a bunch of common database functionality that I
would like to encapsulate in a base WebForm class. Right now I don't see how that can be done,
because things like the base DataSet object would not be visible in the derived classes.

Is it possible that this just can't be done in VS/NET 2003?

- Mark
Nov 19 '05 #1
2 1265
Are you saying this code doesn't work on your machine?

public class WebForm1 : System.Web.UI.Page
{
protected DataSet myData = new DataSet();
....
}

public WebForm2 : WebForm1
{
...
private void Method()
{
//this will work.
this.myData.Tables[0]......
}
}

bill

<Mark Olbert> wrote in message
news:j1********************************@4ax.com...
I'm confused about the behavior of inherited WebForms under VS/NET 2003.

In the Windows.Forms world, if I create a UserControl with a protected component on it, that protected component is visible (albeit locked) and accessible in any class derived from the custom control.

But in ASP.NET, if I create a WebForm1 class and add, say, a DataSet component to it, it's not visible in any derived classes, even though it, too, is protected.

The reason I'm curious about this is that I have a bunch of common database functionality that I would like to encapsulate in a base WebForm class. Right now I don't see how that can be done, because things like the base DataSet object would not be visible in the derived classes.
Is it possible that this just can't be done in VS/NET 2003?

- Mark

Nov 19 '05 #2
Not quite. What I meant is that if you drag and drop a DataSet component onto WebForm1 using the
visual designer, it doesn't show up in WebForm2.

Also, if you drag and drop a DataSet component (or an SqlDataAdapter, etc.) onto WebForm2 (derived
from WebForm1) and recompile, the DataSet disappears from the WebForm2 visual designer.

- Mark

On Wed, 26 Jan 2005 08:15:09 -0600, "William F. Robertson, Jr." <th****@nameht.org> wrote:
Are you saying this code doesn't work on your machine?

public class WebForm1 : System.Web.UI.Page
{
protected DataSet myData = new DataSet();
....
}

public WebForm2 : WebForm1
{
...
private void Method()
{
//this will work.
this.myData.Tables[0]......
}
}

bill

<Mark Olbert> wrote in message
news:j1********************************@4ax.com.. .
I'm confused about the behavior of inherited WebForms under VS/NET 2003.

In the Windows.Forms world, if I create a UserControl with a protected

component on it, that
protected component is visible (albeit locked) and accessible in any class

derived from the custom
control.

But in ASP.NET, if I create a WebForm1 class and add, say, a DataSet

component to it, it's not
visible in any derived classes, even though it, too, is protected.

The reason I'm curious about this is that I have a bunch of common

database functionality that I
would like to encapsulate in a base WebForm class. Right now I don't see

how that can be done,
because things like the base DataSet object would not be visible in the

derived classes.

Is it possible that this just can't be done in VS/NET 2003?

- Mark


Nov 19 '05 #3

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

Similar topics

8
by: Shaun C Farrugia | last post by:
I have a multi team solution being built where teams are segmented off into seperate projects. One project is an over all framework containing a Broker class responsible for instantiating...
6
by: steve bull | last post by:
I created a usercontrol class, RGBColorSpace, which is derived from an abstract class, ColorSpace, but when I try to click on the design panel for the control I get an error message "Unable to...
0
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer...
11
by: Random | last post by:
I'm confused about the proper use and usefulness of namespaces. I beleive I understand the purpose is so the developer can put classes within namespaces to essentially organize your code. And I...
10
by: jojobar | last post by:
Hello, I am trying to use vs.net 2005 to migrate a project originally in vs.net 2003. I started with creation of a "web site", and then created folders for each component of the site. I read...
6
by: Peter Oliphant | last post by:
I just discovered that the ImageList class can't be inherited. Why? What could go wrong? I can invision a case where someone would like to add, say, an ID field to an ImageList, possible so that...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
6
by: tshad | last post by:
I am playing with Inheritance and want to make sure I understand it. I have the following Classes: ******************************************* Public Class AuthHeader:Inherits SoapHeader Public...
12
by: Mike - EMAIL IGNORED | last post by:
Within class MyClass, I can think of two ways to tell if MyClass is inherited in a particular use: 1. pass an appropriate bool in the ctor args; 2. use a virtual method that returns, for...
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
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
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...
0
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...

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.