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