|
Home > Archive > Microsoft Content Management Server > April 2005 > rendering default content in placeholder
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
rendering default content in placeholder
|
|
| Hati Mizu 2005-04-25, 8:47 pm |
| Greetings,
In my template, I have the following code in the page load method. I am
trying to load content into these placeholders, if a new page is being
created. Unfortunately this doesn't work. Is the only way to do this is by
creating a custom control?
Please advise.
code:
private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
if (WebAuthorContext.Current.Mode == WebAuthorContextMode.AuthoringNew)
{
HtmlPlaceholder1.Html = "blah blah blah";
HtmlPlaceholder2.Html = "hey hey hey";
}
}
Thanks in advance.
-Hati
| |
| Hati Mizu 2005-04-25, 8:47 pm |
| I would like to clarify:
When I save the page, the content I specified for the placeholder in page
load method gets saved, but I would like it to display when I first load the
page for authoring. Please advise. Thanks.
"Hati Mizu" wrote:
> Greetings,
>
> In my template, I have the following code in the page load method. I am
> trying to load content into these placeholders, if a new page is being
> created. Unfortunately this doesn't work. Is the only way to do this is by
> creating a custom control?
>
> Please advise.
>
> code:
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
> if (WebAuthorContext.Current.Mode == WebAuthorContextMode.AuthoringNew)
> {
> HtmlPlaceholder1.Html = "blah blah blah";
> HtmlPlaceholder2.Html = "hey hey hey";
> }
> }
>
>
> Thanks in advance.
> -Hati
>
| |
| Stefan [MSFT] 2005-04-25, 8:47 pm |
| Hi Hati,
this code does work - but when the OnPopulateDefaultContent event of the
placeholder fires later then the content is overwritten again.
Either add this code ot the OnPreRender event or better do this in a custom
placeholder control.
Cheers,
Stefan
--
This posting is provided "AS IS" with no warranties, and confers no rights
New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
----------------------
"Hati Mizu" <HatiMizu@discussions.microsoft.com> wrote in message
news:93270A2E-BA38-4A99-AD70-F1286DCBC40C@microsoft.com...
> Greetings,
>
> In my template, I have the following code in the page load method. I am
> trying to load content into these placeholders, if a new page is being
> created. Unfortunately this doesn't work. Is the only way to do this is
by
> creating a custom control?
>
> Please advise.
>
> code:
> private void Page_Load(object sender, System.EventArgs e)
> {
> // Put user code to initialize the page here
> if (WebAuthorContext.Current.Mode == WebAuthorContextMode.AuthoringNew)
> {
> HtmlPlaceholder1.Html = "blah blah blah";
> HtmlPlaceholder2.Html = "hey hey hey";
> }
> }
>
>
> Thanks in advance.
> -Hati
>
| |
|
| Hello,
In Visual Studio when you create (or edit) a placeholder's definition you
will see a Description property. Set the Description with your default text
and it will appear in the placeholder the first time it is used.
"Hati Mizu" wrote:
[vbcol=seagreen]
> I would like to clarify:
>
> When I save the page, the content I specified for the placeholder in page
> load method gets saved, but I would like it to display when I first load the
> page for authoring. Please advise. Thanks.
>
> "Hati Mizu" wrote:
>
|
|
|
|
|