So, you want to only display this label (on all pages) after a certain event
happens on a page - correct? Then store this calculated value (in Session,
for example) and read it on your Master PreRender event (this will ensure
that all button clicks and similar events from other controls have already
been fired and processed).
Something similar to the following:
button click:
Me.Session("MyMasterLabelText") = ModuleName.GetLabelText(...)
Master prerender:
MyLabel.Text = Me.Session("MyMasterLabelText")
"Kirk" wrote:
> On May 24, 6:26 pm, Sergey Poberezovskiy
> <SergeyPoberezovs...@discussions.microsoft.com> wrote:
> > Kirk,
> >
> > Not sure what are you trying to achieve - why would you need to access
> > master page (which is generally page specific - as different pages may have
> > different master pages) from a module? You will only want to access a
> > particular page's master page instance - in this case you will need a
> > reference to the page instance (or any control on the page) or to the master
> > itself.
> >
> > If you need to change your master for all page - do it inside your Master,
> > and you will have the reference to it.
> >
> > If you provide a bit more on what you are trying to achieve, it will be
> > easier to suggest a better way to accomplish the task.
> >
> >
> >
> > "Kirk" wrote:
> > > I have been reading Scott Allen's article on Master Pages (http://
> > > odetocode.com/Articles/450.aspx) but I am having problems
> > > understanding a concept. Specifically, I have created a property
> > > (called "CurFlag") on my master page that can be accessed from content
> > > pages, but not from separate code modules.
> >
> > > I tried doing something like this in my VB code module:
> >
> > > Dim myMaster As MasterPage = CType(ProjectMgmt.Master,
> > > MasterPage)
> > > myMaster.CurFlag = "value"
> >
> > > ....but this just gets me an "Reference to a non-shared member requires
> > > an object reference" error on the first line. Forgive my ignorance,
> > > but is my syntax correct, or do I need to add something additional to
> > > the master page so that my module "sees" this master page?
> >
> > > I would appreciate any suggestions.
> > > Thank you.- Hide quoted text -
> >
> > - Show quoted text -
>
> Thanks for all of the replies. My situation is fairly simple: I have
> one master page (called "ProjectMgmt.Master,
> MasterPage") that has about 10 content pages.
>
> I have a function in a VB module that does some math/validation for
> me. This function is called by a button on a content page. When I
> arrive at the result, I want to change a label on the master page (so
> it is visible on all pages of the site).
>
> Is there a better way to do what I am trying to accomplish? If so, I
> would appreciate any code syntax examples you could give me. I don't
> know the "proper" names for some objects, so I am unable to follow the
> first reply's suggestion (just a newbie, I guess).
>
> Thank you again.
>
> If there is a better way to do this than
>
>
|