Microsoft Content Management Server - Populate placeholder on AuthorNew

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > September 2004 > Populate placeholder on AuthorNew





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 Populate placeholder on AuthorNew
Mei Ying \(MVP\)

2004-09-03, 7:48 am

Hi

If you are using the HTMLPlaceholderControl that ships out
of the box, you could also enter the default text in the
Description property of the placeholder definition.

Mei Ying
>-----Original Message-----
>Hi all,
>
>I want to be able to popolate a placeholder, when an

author creates a new
>posting. I have tried using the following (in c#), but

it causes an
>"Overlapped Save" error when the user selects to Save and

Exit! All
>pointers and code is MUCH appreciated!
>
>HtmlPlaceholder hphAuthorNTAccount =
>((HtmlPlaceholder)(oPosting.Placeholders

["AuthorNTAccount"]));
>
>CmsHttpContext _thisCtx = CmsHttpContext.Current;
>
>if(_thisCtx.Mode == PublishingMode.Update)
>
>{
>
>hphAuthorNTAccount.Html = sGuid.ToString();
>
>}
>
>George Leithead
>RAD Manager
>
>
>.
>

Stefan [MSFT]

2004-09-04, 2:47 am

Hi George,

this is not possible this way.
The overlapped save is exactly what I expected to see.
The valid place for such code would be a workflow event (e.g.
CmsPosting_Created).
You would have to ensure that e.Context.CommitAll() is being called before
the placeholder content is updated.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:41371be2$0$20248$ed9e5944@reading.news.pipex.net...
> Hi all,
>
> I want to be able to popolate a placeholder, when an author creates a new
> posting. I have tried using the following (in c#), but it causes an
> "Overlapped Save" error when the user selects to Save and Exit! All
> pointers and code is MUCH appreciated!
>
> HtmlPlaceholder hphAuthorNTAccount =
> ((HtmlPlaceholder)(oPosting.Placeholders["AuthorNTAccount"]));
>
> CmsHttpContext _thisCtx = CmsHttpContext.Current;
>
> if(_thisCtx.Mode == PublishingMode.Update)
>
> {
>
> hphAuthorNTAccount.Html = sGuid.ToString();
>
> }
>
> George Leithead
> RAD Manager
>
>



George Leithead

2004-09-06, 5:48 pm

Stefan,

Yes I know, you are correct. However, is there a way that I can achieve it?
That is, when the user selects Create New, to populate the contents of the
HTMLPlaceHolderControl?

George Leithead
Davis Langdon

"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:evqMashkEHA.272@tk2msftngp13.phx.gbl...
> Hi George,
>
> this is not possible this way.
> The overlapped save is exactly what I expected to see.
> The valid place for such code would be a workflow event (e.g.
> CmsPosting_Created).
> You would have to ensure that e.Context.CommitAll() is being called before
> the placeholder content is updated.
>
> Cheers,
> Stefan.
>
> --
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
> MCMS FAQ:
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
>

http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
> message news:41371be2$0$20248$ed9e5944@reading.news.pipex.net...
new[vbcol=seagreen]
>
>



Stefan [MSFT]

2004-09-06, 5:48 pm

Hi George,

there are two ways to achieve this

1) implement a custom placeholder as shown here:
http://www.gotdotnet.com/Community/...9e-78cddaafb3a0

2) implement the following solution. It will work also for placeholders, not
only for properties.
http://blogs.msdn.com/stefan_gossne.../25/119613.aspx

Cheers,
Stefan.


--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:413c7fa6$0$20251$ed9e5944@reading.news.pipex.net...
> Stefan,
>
> Yes I know, you are correct. However, is there a way that I can achieve

it?
> That is, when the user selects Create New, to populate the contents of the
> HTMLPlaceHolderControl?
>
> George Leithead
> Davis Langdon
>
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:evqMashkEHA.272@tk2msftngp13.phx.gbl...
before[vbcol=seagreen]
> rights.
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

in[vbcol=seagreen]
> new
>
>



George Leithead

2004-09-06, 5:48 pm

Stefan,

I believe that the below should work. If you think about it (and I FINNALY
did think about it), I only want to populate the contents of the placeholder
when the posting is Author new. That is, when the page is truly
initialised.

Thus, only Author New mode and NOT postback! Do you agree? (in the page
load event)

if (webContext.Mode == WebAuthorContextMode.AuthoringNew &&
!Page.IsPostBack)

{

hphAuthorNTAccount.Html = sGuid;

}

George Leithead
RAD manager
"Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
news:OnLxQVClEHA.3564@TK2MSFTNGP14.phx.gbl...
> Hi George,
>
> there are two ways to achieve this
>
> 1) implement a custom placeholder as shown here:
>

http://www.gotdotnet.com/Community/...9e-78cddaafb3a0
>
> 2) implement the following solution. It will work also for placeholders,

not
> only for properties.
> http://blogs.msdn.com/stefan_gossne.../25/119613.aspx
>
> Cheers,
> Stefan.
>
>
> --
> This posting is provided "AS IS" with no warranties, and confers no

rights.
>
> MCMS FAQ:
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
> MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
> MCMS Sample Code:
>

http://www.gotdotnet.com/community/...t+S
erver

> MCMS Whitepapers and other docs:
> http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
> --------------------------------
>
>
> "George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
> message news:413c7fa6$0$20251$ed9e5944@reading.news.pipex.net...
> it?
the[vbcol=seagreen]
> before
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

> in
a[vbcol=seagreen]
>
>



Stefan [MSFT]

2004-09-06, 5:48 pm

Hi George,

try it. It might be necessary to move the code to the OnPreRender event as
I'm not sure if the prepopulation is done before or after executing the
Page_Load event.

Cheers,
Stefan.

--
This posting is provided "AS IS" with no warranties, and confers no rights.

MCMS FAQ:
http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...t+S
erver

MCMS Whitepapers and other docs:
http://blogs.msdn.com/stefan_gossne...2/07/41859.aspx
--------------------------------


"George Leithead" <george.leithead@davislangdonDINAHSPAMMEH.com> wrote in
message news:413c8941$0$20254$ed9e5944@reading.news.pipex.net...
> Stefan,
>
> I believe that the below should work. If you think about it (and I

FINNALY
> did think about it), I only want to populate the contents of the

placeholder
> when the posting is Author new. That is, when the page is truly
> initialised.
>
> Thus, only Author New mode and NOT postback! Do you agree? (in the page
> load event)
>
> if (webContext.Mode == WebAuthorContextMode.AuthoringNew &&
> !Page.IsPostBack)
>
> {
>
> hphAuthorNTAccount.Html = sGuid;
>
> }
>
> George Leithead
> RAD manager
> "Stefan [MSFT]" <stefang@online.microsoft.com> wrote in message
> news:OnLxQVClEHA.3564@TK2MSFTNGP14.phx.gbl...
>

http://www.gotdotnet.com/Community/...9e-78cddaafb3a0
> not
> rights.
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

in[vbcol=seagreen]
achieve[vbcol=seagreen]
> the
>

http://download.microsoft.com/downl...6a/MCMS+2002+-+(complete)+FAQ.htm
>

http://www.gotdotnet.com/community/...t+S
erver

wrote[vbcol=seagreen]
creates[vbcol=seagreen]
> a
an[vbcol=seagreen]
All[vbcol=seagreen]
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com