Custom PlaceHolderControl : how to ingore link 'Saved' in console
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Web Servers reviews > Microsoft Content Management Server > Custom PlaceHolderControl : how to ingore link 'Saved' in console




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Custom PlaceHolderControl : how to ingore link 'Saved' in console  
Need Info


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11: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







[ Post a follow-up to this message ]



    Re: Custom PlaceHolderControl : how to ingore link 'Saved' in console  
Stefan [MSFT]


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-28-04 11: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...>
MCMS+2002+-+(complete)+FAQ.htm
MCMS Blog: http://blogs.msdn.com/stefan_gossner/category/4983.aspx
MCMS Sample Code:
http://www.gotdotnet.com/community/...nagement+Server
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
>
>







[ Post a follow-up to this message ]



    Re: Custom PlaceHolderControl : how to ingore link 'Saved' in console  
Need Info


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
07-29-04 10: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 d
e
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:
>

> MCMS Blog: [url]http://blogs.msdn.com/stefan_gossner/category/4983.aspx" target="_blank">http://download.microsoft.com/downl...egory/4983.aspx
> MCMS Sample Code:
>
http://www.gotdotnet.com/community/...
+Server
> 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] 
>
>







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 11:26 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register