"Chris" <> wrote in message
news:42fbe2b9-5259-42a0-9418-...
> hello.
>
> How can I dynamically change a contentpage of the masterpage?
>
> I have a listbox in the masterpage. Depending on the selected item i
> want to show a different contentpage.
>
> I try something like this (masterpage-code)
>
> protected void DropDownList1_SelectedIndexChanged(object sender,
> EventArgs e)
> {
> switch (somethingtoTest)
> {
> case "1": ContentPlaceHolder1.Page = "Page1.aspx";
> break;
>
> case "2": ContentPlaceHolder1.Page = "Page2.aspx";
> break;
> break;
> }
> }
>
> But the code is not accepted since "ContentPlaceHolder1.Page" is not
> of type string.
>
> But how then?
What a master page is, really, is a user control on a page. It does not
appear so due to the way it works, but that is what it is. As such, you
cannot get there from here. You can kludge up the page change, but you would
be better to add a postback to the dropdownlist and then have it redirect to
the correct page.
--
Peace and Grace,
Greg
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
************************************************
| Think outside the box! |
************************************************