Connecting Tech Pros Worldwide Forums | Help | Site Map

Access Variables Across Classes

Jim
Guest
 
Posts: n/a
#1: Nov 17 '05
I'm hoping someone may be able to help me. I have a page the displays
information "content.aspx". At the top of this page I show a
"breadcrumb". The breadcrumb is a templated custom control. The
breadcrumb has it's code behind page, which accesses a class (.cs) file

for information.

here's a quick illustration (imagine a screen shot below)
==============================*=================== ==
=
= Home > Groups > CSharp
=
=
= This is the title of my content
=
=
= Here is some text for my content..etc. etc.
=
==============================*=================== ==


The page would be "content.aspx" with it's respective code behind


The "Home > Groups > CSharp" is the breadcrumb.ascx generated by the
use of the template:


<MyApp:Breadcrumb id="BreadcrumbControl" runat="server">
<MainTemplate>
<b> Container.MainSection</b>
</MainTemplate>
<GroupTemplate>
<b> Container.MainGroup</b>
</GroupTemplate>


In the code behind for the control we get the underlying class file
protected MyControls.Navigation.Breadcru*mb BreadcrumbControl;


In Breadcrumb.cs we have some properties available:


public string MainSectionName
{
get { return _MainSectionName;}
}


We set the variable in the page
this._MainSectionName = "Home";


In breadcrumb.ascx I want to be able to get the value of
BreadCrumbControl.MainSectionN*ame, but the Breadcrumb.cs is the last
piece of code in the execusion order, so when I reference the
MainSectionName on the Breadcrumb.ascx.cs file I get back an empty
string.


I know this is a long message sorry, I hope someone can help.


Peter Bromberg [C# MVP]
Guest
 
Posts: n/a
#2: Nov 17 '05

re: Access Variables Across Classes


Rather than launch into a lengthy discussion, there are several excellent
implementations of "breadcrumb" type controls for ASP.NET framework 1.1 on
gotdotnet.com and other places. MSDN Magazine (as I recall) has also had
some excellent articles by noted authors like Dino Esposito on this, as well
as info on the new ASP.NET 2.0 Breadcrumb control.

Have you taken the time to look these over for pointers?
--Peter

"Jim" <Jim.Cardamone@gmail.com> wrote in message
news:1112980189.849322.288060@o13g2000cwo.googlegr oups.com...
I'm hoping someone may be able to help me. I have a page the displays
information "content.aspx". At the top of this page I show a
"breadcrumb". The breadcrumb is a templated custom control. The
breadcrumb has it's code behind page, which accesses a class (.cs) file

for information.

here's a quick illustration (imagine a screen shot below)
==============================*=================== ==
=
= Home > Groups > CSharp
=
=
= This is the title of my content
=
=
= Here is some text for my content..etc. etc.
=
==============================*=================== ==


The page would be "content.aspx" with it's respective code behind


The "Home > Groups > CSharp" is the breadcrumb.ascx generated by the
use of the template:


<MyApp:Breadcrumb id="BreadcrumbControl" runat="server">
<MainTemplate>
<b> Container.MainSection</b>
</MainTemplate>
<GroupTemplate>
<b> Container.MainGroup</b>
</GroupTemplate>


In the code behind for the control we get the underlying class file
protected MyControls.Navigation.Breadcru*mb BreadcrumbControl;


In Breadcrumb.cs we have some properties available:


public string MainSectionName
{
get { return _MainSectionName;}
}


We set the variable in the page
this._MainSectionName = "Home";


In breadcrumb.ascx I want to be able to get the value of
BreadCrumbControl.MainSectionN*ame, but the Breadcrumb.cs is the last
piece of code in the execusion order, so when I reference the
MainSectionName on the Breadcrumb.ascx.cs file I get back an empty
string.


I know this is a long message sorry, I hope someone can help.


Closed Thread