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

Inheriting code behind class

Hi,
I have two (almost similar) web pages Page1 & Page2.
Both of them have a datagrid and databinding is done during runtime by
executing different stored procedures for each page. Datagrid has
customized paging.

Also, Page1's datagrid has 10 columns while Page2's datagrid has only 7
columns.

So, in Page1, I check for the current page name & accordingly execute
the stored procedure (SP! or SP2) to bind data.

In Page2.cs, in the code behind I wrote

public class Page2 : Page1
{

}

In Page2.aspx I copied all the code from Page1.aspx and removed the 3
columns in the datagrid.(these 3 columns are not referred in Page1.cs
code behind, they are hyperlinks).

(Is there any way to inherit Page2.aspx from Page1.aspx?)

This is working fine except that when I open Pag2.aspx it says "File
could not be loaded into web form designer.An exception occurred while
creating the instance - Object reference not set to an instance of an
object" but then it opens the file.

I want to if this is a good way of doing it or is there's any other
better way?

Thanks,
Ashish.

Dec 7 '06 #1
0 898

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

Similar topics

1
by: richardlane | last post by:
Hi, basic question here - I'm struggling with the transfer from asp to asp.net a bit, especially in seeing the 'bigger picture' of how things are best structured. I have a website made up...
2
by: Wayne J | last post by:
I have 3 pages, each with 2 tables (tblNew and tblConfirm), because these 2 tables are affected by the same code, I thought if I used an inherited class defining these variables along with the...
9
by: Ryan Ternier | last post by:
I just got moved to a project that has an inheritance structure sort of like this: MyWebPage.aspx inherits ---> MyWebPage.ASPX.VB inherits ----> Utility.VB inherits -----> DHTMLMenu.vb...
2
by: Simon | last post by:
Hi, Just to get started.... I've created a very simple web form, "Simple", using VS and I dropped a HTML img control on the design view. I referenced a picture and it is displayed in browser...
4
by: elziko | last post by:
I would like to do the following: Create a class that inherits from a usercontrol. Then add a control to the designer Call this new class ClassA. Many controls I need will start off like this...
2
by: Paul Whygle | last post by:
Is it possible to inherit a class that is a part of a Consumed Webservice? I have been trying to get this to work and i cant seem to figure it out. When i look at the "code-behind" (for lack of a...
0
by: dinesh | last post by:
I am using ASP.Net 2.0 ,i've inherited a page in another page. During compilaton I get the error saying " the "base class" could not be found" But when I rebuild the application the error goes....
1
by: BillE | last post by:
Can I inherit from a web form? I would like to reuse procedures in a web form base class code behind by inheriting from it. For example, I would like to have a HandleError function defined in...
5
by: Andrew Robinson | last post by:
I am attempting to better automate a Pager Template within a GridView. I am succesfully skinning a Drop Down List withing my control (the DDL is added to my control). I correctly populate the item...
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
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
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...

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.