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

Inherits=" " problem in page directive -- can't find correct classes!

Hi,

I have two pages.

Default.aspx
....Codefile="default.aspx.cs" Inherits="Web" %>

and

Sculpture.aspx
....Codefile="default.aspx.cs" Inherits="Sculpture" %>

--------------------------------------------------------------
and the default.aspx.cs file has two classes:

public partial class Web : System.Web.UI.Page
{
Page_Load(.....................)
{
// loads some navigation controls to be used for the entire site
// these controls are dropdownlists
// ddlCategory, ddlSculpture
Method1() //processes navigation selections
Method2( )//processes navigation selections
[this all works fine on the default.aspx page when Web is the only
class in the .cs file]
and I have the inherited class

public partial class Sculpture: Web
{
Page_Load(..............)
{
//loads some repeater controls to display data in the editable
part of the web page
base.Page_Load(sender, e)
}
Method1()//processes user selection from the repeater
}

--------------------------------------------------------------
There is a page_load method in the Web Class that load some navigation
items for use in the entire site.

The Products class adds its own methods to its own Page_Load and then
has a base.Page_Load(sender, e);
--------------------------------------------------------------

THE PROBLEM:
=============

When I try to run the default.aspx page, I get the error:
----> The name 'repeaterOdd' does not exist in the current context

The repeaterOdd is a method I have but it is only "mentioned" in the
Products class so I don't get how the Web class even knows about it
(other than that the two classes are in the same .cs file).

Similarly,
When I run the page Products.aspx I get the same type of error:
----> The name 'ddlCategory' does not exist in the current context.

Technically, the Products.aspx page should know about the ddlCategory
object because this involves code that I *thought* I referenced by
using the base.Page_Load,,,, directive.

It's as if the .aspx pages are just "reading" straight through the .cs
page and ignoring any directives as to what class to use and where to
stop.

Any advice as to what is happening here?
Thanks.

May 3 '06 #1
2 2120
Please disregard. I figured it out. All I needed to do was explicitly
declare the repeater
eg. repeater repeaterOdd = new Repeater();

May 3 '06 #2
Scratch that! I didn't figure it out. So I still have the same problem
above.

It seems that everything is fine until I add the second class -- if
default and sculpture both have inherits="Web" then everything tests
out ok.

It's that when sculpture.aspx inherits="Sculpture" then things break
down.

* all references for products should say sculpture. Sorry *

Thanks!

May 3 '06 #3

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

Similar topics

1
by: Kevin Parkinson | last post by:
Hello Eveyone: I was wondering if someone can set me straight on this little problem I am having which I believe must be a configuration issue. Everytime VS.NET creates a new web form and puts...
4
by: Don Wash | last post by:
Hi All! I'm getting the following Error: No DLLs has been compiled yet and nothing in the \bin directory. So it is not the versioning problem or anything like that. And here are the...
7
by: tshad | last post by:
I have a control that I am using from Metabuilders that requires you to use: <%@ Page Inherits="MetaBuilders.WebControls.DialogPage" %> How do I inherit my code-behind page or another object...
2
by: Randall Parker | last post by:
I've noticed that C# can only inherit from a single class. At the same time, the CodeBehind in an aspx.cs file inherits from Page. So what do you all do to reuse code in .aspx.cs classes? ...
3
by: Jim in Arizona | last post by:
Most of the asp.net learning I've done has been from books that were written during the 1.0 framework. I didn't have a copy of visual studio when I started reading them then I got a hold of VS 2005...
1
by: Jethro | last post by:
Hi all I have got my .NET vb project compiling nicely into an EXE. I wish to use one of the components (declared as Public) stored in the EXE as a base class for subsequent DLLs to INHERIT...
0
by: Rod | last post by:
I have made a copy of my (ASP.NET) project and renamed it everywhere I could find. I am stuck with one bit I can't figure out. The line at the top of the HTML which looks like this %@ Page...
4
by: =?Utf-8?B?QWxleCBNdW5r?= | last post by:
My Web application is developed in C# Visual Studio 2005 Professional. After deploying the application to the production server I am getting the following error: <%@ Application...
4
by: Tom P. | last post by:
What would the difference be between the following two: public class Foo : IList<string> { .... } public class Foo : List<string>
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: 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
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
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...
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...

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.