Microsoft Content Management Server - Custom PlaceHolderControl : how to ingore link 'Saved' in console

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > July 2004 > Custom PlaceHolderControl : how to ingore link 'Saved' in console





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 Custom PlaceHolderControl : how to ingore link 'Saved' in console
Need Info

2004-07-28, 6:10 pm

Hi

I'am trying to write a custom placeholdercontrol based on
HtmlPlaceholderControl
public class xxxxxPlaceHolderControl : HtmlPlaceholderControl
Actually , i wrote some code in méthods:

CreateAuthoringChildControls

CreatePresentationChildControls

LoadPlaceholderContentForAuthoring

LoadPlaceholderContentForPresentation

SavePlaceholderContent

All was working well



but my need is that one of the textbox that I add in
LoadPlaceholderContentForAuthoring must be filled by the operator

so I want that the user cannot complete save ( or save and exit ) in
authoring mode.

In order to achieve this , i implement the method

OnSavingContent(PlaceholderControlSaving
EventArgs e)

where i wrote :

if ( mytest ... ) {

e.cancel = true;

}

My problem is that when e.cancel is set to true, the page displays a blank
screen with only the console and my custom control disapear.

in fact, the method LoadPlaceholderContentForAuthoring is not called when
e.cancel is set to true

I thinked that OnSavingContent is an equivalent to beforeUpdate, but finally
it don't work like this



so i have tried a call to LoadPlaceholderContentForAuthoring in
OnSavingContent :

where i wrote :

if ( mytest ... ) {

e.cancel = true;

LoadPlaceholderContentForAuthoring( new
PlaceholderControlEventArgs(e.Posting) )

}

this code works, but i'am not sure that is something to do because the mode
switch between unplublised and saved

and the problem with 'Save and exit' is still there because the page close
with the old value of my textbox, so the operator doesn't no

that his operation do not complete . How can I stop the event closed of a
page if conditions aren't fullfiled



thanks


Stefan [MSFT]

2004-07-28, 6:10 pm

Hi,

this approach will not work correct as parts of the page will be saved and
parts not as the events for the different placeholder controls fire
independendly.
So if you cancel the save for one placeholder control all others might
already be written to the database.

You should implement a custom save action which checks if the relevant
placeholder controls are filled and only do the save action if this is true.

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
--------------------------------


"Need Info" <a@aol.com> wrote in message
news:unctIYCdEHA.3420@TK2MSFTNGP12.phx.gbl...
> Hi
>
> I'am trying to write a custom placeholdercontrol based on
> HtmlPlaceholderControl
> public class xxxxxPlaceHolderControl : HtmlPlaceholderControl
> Actually , i wrote some code in méthods:
>
> CreateAuthoringChildControls
>
> CreatePresentationChildControls
>
> LoadPlaceholderContentForAuthoring
>
> LoadPlaceholderContentForPresentation
>
> SavePlaceholderContent
>
> All was working well
>
>
>
> but my need is that one of the textbox that I add in
> LoadPlaceholderContentForAuthoring must be filled by the operator
>
> so I want that the user cannot complete save ( or save and exit ) in
> authoring mode.
>
> In order to achieve this , i implement the method
>
> OnSavingContent(PlaceholderControlSaving
EventArgs e)
>
> where i wrote :
>
> if ( mytest ... ) {
>
> e.cancel = true;
>
> }
>
> My problem is that when e.cancel is set to true, the page displays a blank
> screen with only the console and my custom control disapear.
>
> in fact, the method LoadPlaceholderContentForAuthoring is not called when
> e.cancel is set to true
>
> I thinked that OnSavingContent is an equivalent to beforeUpdate, but

finally
> it don't work like this
>
>
>
> so i have tried a call to LoadPlaceholderContentForAuthoring in
> OnSavingContent :
>
> where i wrote :
>
> if ( mytest ... ) {
>
> e.cancel = true;
>
> LoadPlaceholderContentForAuthoring( new
> PlaceholderControlEventArgs(e.Posting) )
>
> }
>
> this code works, but i'am not sure that is something to do because the

mode
> switch between unplublised and saved
>
> and the problem with 'Save and exit' is still there because the page close
> with the old value of my textbox, so the operator doesn't no
>
> that his operation do not complete . How can I stop the event closed of a
> page if conditions aren't fullfiled
>
>
>
> thanks
>
>



Need Info

2004-07-29, 5:51 pm

Hi

thanks for you help

I wrote a customSave Class that inherit from the standard
one(AuthoringReeditSaveAction ) and I use it in the console

from now I can check if one of my input is missing and cancel save action by
calling GenerateStartupScriptRepost with original url
in method PerformActionBehavior

My problem now, is to show the operator an error message.
As i do a postback with GenerateStartupScriptRepost i can add values to url
in order to read this values in method LoadPlaceHolderForAuthoring.
In this method I can create a new Exception ( type of error saving Content
placeholder ) that will be shown in the error console.

This works well but now the link Save , Save and Exit disappear, => i have
got a new problem to solve

Bye


"Stefan [MSFT]" <stefang@online.microsoft.com> a écrit dans le message de
news:OvFhjeHdEHA.3300@TK2MSFTNGP09.phx.gbl...
> Hi,
>
> this approach will not work correct as parts of the page will be saved and
> parts not as the events for the different placeholder controls fire
> independendly.
> So if you cancel the save for one placeholder control all others might
> already be written to the database.
>
> You should implement a custom save action which checks if the relevant
> placeholder controls are filled and only do the save action if this is

true.
>
> 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
> --------------------------------
>
>
> "Need Info" <a@aol.com> wrote in message
> news:unctIYCdEHA.3420@TK2MSFTNGP12.phx.gbl...
blank[vbcol=seagreen]
when[vbcol=seagreen]
> finally
> mode
close[vbcol=seagreen]
a[vbcol=seagreen]
>
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com