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

R

Ranginald

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.
 
R

Ranginald

Please disregard. I figured it out. All I needed to do was explicitly
declare the repeater
eg. repeater repeaterOdd = new Repeater();
 
R

Ranginald

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!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,070
Latest member
BiogenixGummies

Latest Threads

Top