views:

35

answers:

3

I want to show some panel with a label, both located on a MasterPage, from inside it's child pages.. I already did the coding on the MasterPage:

public class MyMaster : MasterPage
{
     public void ShowPanel(string pMessage)
     {
          labelInside.Text = pMessage;
          myPanel.visible = true;
     }
}

Then I make the calls from child pages:

public void ShowPanel(string pMessage)
{
     MyMaster masterPage = this.Master as MyMaster;
     masterPage.ShowPanel(pMessage);
}

This "works" ok, but it won't show nothing, since I need the page to be "refreshed" in an "ajax-way" like an UpdatePanel, which I can't use because the Trigger is in another page, right?

I really need this to work.. even if you have another completely different way to do this, I would appreciate.

A: 

Have you considered having the masterpage just have a placeholder for the label, but having each child page put its own content label inside that placeholder, which it would then have full control over?

bwarner
+1  A: 

You must place your panel inside an UpdatePanel(UpdateMode conditional) and in ShowPanel call its Update method.

Tim Schmelter
A: 

you can subClass your page, and expose a property say.. MyPage.FooVisible

than in your masterPage, you can:

myPage = this.Page as MyPage
if (myPage != null) myPage.FooVisble = false;

in your page you can handle that any way you like,

FooVisible {
set { SomeElement.Visible = value; }
}

pseudo code of course :)

Sonic Soul