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

Abstract ASPXs

Hi,

I've got an .aspx page with a number of controls on it for setting the
values for an object. When the values have been put in, the user
clicks on the "Store" button.

When I want to edit an instance of this object, I've got a second page
which is a direct copy of the first, but some of the code has been
changed so that, for example, the Store button now says "Update".

The Java programmer in me says that I should have an abstract version
of this page, and then put the Store/Update specific functionality in
subclasses. I've done this in the following way:

1) Created the page "AbstractRecordPage.aspx" with an associated
"AbstactRecordPage.aspx.cs". This page contains the controls etc. I've
declared the page abstract.
2) Declared abstract methods like "getActionButtonText" and
"actionButton_Click" in AbstractRecordPage.aspx.cs
3) Made two classes, both of which are subclasses of
AbstractRecordPage, named StoreRecordPage.cs and UpdateRecordPage.cs.
They implement the abstract methods declared in the parent class.

All of this works at compile time. However, how do I specify which
subclass of AbstractRecordPage should be used in, for example, a
hyperlink?

Do I just link to "UpdateRecordPage.aspx" even though that particular
page doesn't really exist, or is it more complicated than that?

Thanks in advance for your help

Richard
Nov 16 '05 #1
1 1156
Hi Richard

I have never do it , but what you can do is insert a new class in the
project, it would be your parent class, make this class inherit from Page as
usual, code here all your functionality as usual.
Now add a web form, in the code behind change the parent of the class
created from Page to your base class, doing so you will have the
functionality of the parent form.
Do the same with the other page.

I don;t think that you need to change somethign else, if so you may need to
change from private to protected some methods, but again, I'm not sure of
it.

Cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Richard Thomas" <ri************@bigfoot.com> wrote in message
news:84**************************@posting.google.c om...
Hi,

I've got an .aspx page with a number of controls on it for setting the
values for an object. When the values have been put in, the user
clicks on the "Store" button.

When I want to edit an instance of this object, I've got a second page
which is a direct copy of the first, but some of the code has been
changed so that, for example, the Store button now says "Update".

The Java programmer in me says that I should have an abstract version
of this page, and then put the Store/Update specific functionality in
subclasses. I've done this in the following way:

1) Created the page "AbstractRecordPage.aspx" with an associated
"AbstactRecordPage.aspx.cs". This page contains the controls etc. I've
declared the page abstract.
2) Declared abstract methods like "getActionButtonText" and
"actionButton_Click" in AbstractRecordPage.aspx.cs
3) Made two classes, both of which are subclasses of
AbstractRecordPage, named StoreRecordPage.cs and UpdateRecordPage.cs.
They implement the abstract methods declared in the parent class.

All of this works at compile time. However, how do I specify which
subclass of AbstractRecordPage should be used in, for example, a
hyperlink?

Do I just link to "UpdateRecordPage.aspx" even though that particular
page doesn't really exist, or is it more complicated than that?

Thanks in advance for your help

Richard

Nov 16 '05 #2

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

Similar topics

2
by: Dave Veeneman | last post by:
Is is legal to declare abstract members in non-abstract classes? How about non-abstract members in abstract classes? I am writing a base class with three derived classes. The base class will...
6
by: Dan Sikorsky | last post by:
If we were to define all abstract methods in an abstract class, thereby making that class non-abstract, and then override the heretofore 'abstract' methods in a derived class, wouldn't that remove...
5
by: Tony Johansson | last post by:
Hello!! Assume you have an Interface called ITest with these three method declarations. interface ITest { void foo1(); void foo2(); void foo3(); }
7
by: jason | last post by:
In the microsoft starter kit Time Tracker application, the data access layer code consist of three cs files. DataAccessHelper.cs DataAcess.cs SQLDataAccessLayer.cs DataAcccessHelper appears...
0
by: mailforpr | last post by:
Hi. Let me introduce an iterator to you, the so-called "Abstract Iterator" I developed the other day. I actually have no idea if there's another "Abstract Iterator" out there, as I have never...
0
by: emin.shopper | last post by:
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass...
4
by: David Zha0 | last post by:
Hi, "when we call a virtual method, the runtime will check the instance who called the method and then choose the suitable override method, this may causes the performance drop down", is this...
6
by: Miguel Guedes | last post by:
Hello, I recently read an interview with Bjarne Stroustrup in which he says that pure abstract classes should *not* contain any data. However, I have found that at times situations are when it...
5
by: Tony Johansson | last post by:
Hello! Here I have an Interface called ITest and a class called MyClass which derive this intrface. As you can see I don't implement this method myTest in class MyClass because i use the...
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:
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
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: 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
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...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.