Microsoft Content Management Server - Stop Postback from MCMS Custom SingleImagePlaceHolder

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > December 2007 > Stop Postback from MCMS Custom SingleImagePlaceHolder





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 Stop Postback from MCMS Custom SingleImagePlaceHolder
twright1

2007-12-10, 7:15 pm

I have a custom SingleImagePlaceholder that checks the image size and width.
If the dimensions are incorrect it sets the sizevalidtor and widthvalidator
controls to false and with the OnSavingContent method cancels the placeholder
save.

The problem is even though the validation controls have been set to false
the page still does a postback to the server. However, I noticed if I go
edit an existing posting and click the save dialog the validators work, the
error message is displayed and the submit is stopped. On Save and Exit it
does not work.

Is there a way to stop the submit? If so, what method should I add it to?

I have included code from my custom control.











protected override void OnSavingContent(PlaceholderControlSaving
EventArgs e)
{
if (this.AuthoringChildControlsAreAvailable)
{
EnsureChildControls();
if (!IsImageValid())
{
e.Cancel = true;
}
else
{
base.OnSavingContent(e);
}
}
}
Stefan Goßner [MSFT]

2007-12-12, 7:25 am

Hi,

this issue is covered in chapter 9 of the following book which covers
placeholder validation in detail:
http://tinyurl.com/8ugwj

Cheers,
Stefan


"twright1" <twright1@discussions.microsoft.com> wrote in message
news:04FC379D-6148-4113-A67A-4B2499546FCA@microsoft.com...
>I have a custom SingleImagePlaceholder that checks the image size and
>width.
> If the dimensions are incorrect it sets the sizevalidtor and
> widthvalidator
> controls to false and with the OnSavingContent method cancels the
> placeholder
> save.
>
> The problem is even though the validation controls have been set to false
> the page still does a postback to the server. However, I noticed if I go
> edit an existing posting and click the save dialog the validators work,
> the
> error message is displayed and the submit is stopped. On Save and Exit it
> does not work.
>
> Is there a way to stop the submit? If so, what method should I add it to?
>
> I have included code from my custom control.
>
>
>
>
>
>
>
>
>
>
>
> protected override void OnSavingContent(PlaceholderControlSaving
EventArgs
> e)
> {
> if (this.AuthoringChildControlsAreAvailable)
> {
> EnsureChildControls();
> if (!IsImageValid())
> {
> e.Cancel = true;
> }
> else
> {
> base.OnSavingContent(e);
> }
> }
> }



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com