Microsoft Content Management Server - Placeholder content lost in first save

This is Interesting: Free IT Magazines  
Home > Archive > Microsoft Content Management Server > August 2006 > Placeholder content lost in first save





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 Placeholder content lost in first save
ETX

2006-08-22, 1:19 pm

Hi all,

I have a template with a HTMLPlaceholder definition and a dropdownlist web
control. When an item of the list is selected, the selected value is stored
in the placeholder
(placeholder.datasource.rawcontent=list.selecteditem.value).
Then when I save the posting for the first time and then I close the browser
and open the posting again, the content of the placeholder is not there
(placeholder.datasource.rawcontent="").
The most extange is that if then I select another item from the list and
save, the value is stored in the placeholder fine.

Any idea of what is wrong here?

Thanks for your help
Mike

2006-08-22, 7:29 pm

Hi ETX,

I have found it is much easier to stored these types of values in custom
propreties. I had similar problems when I tried to use html placeholders. I
think it may be becuase the control is trying to update the content is has
and this is over writing the data you set in raw date. It is also important
to use the Microsoft.ContentManagement.WebControls.WebAuthorPostingEventArgs
e passed to the SavePostingEvent instead of the CmsHttpContext.Current. Your
code will look something like this
protected void SavePostingEvent(object sender,
Microsoft.ContentManagement.WebControls.WebAuthorPostingEventArgs e)
{
e.Posting.CustomProperties[PROPERTY_NAME].Value =
DropDownlist.SelectedValue;
}

I hope this helps.
Mike

"ETX" wrote:

> Hi all,
>
> I have a template with a HTMLPlaceholder definition and a dropdownlist web
> control. When an item of the list is selected, the selected value is stored
> in the placeholder
> (placeholder.datasource.rawcontent=list.selecteditem.value).
> Then when I save the posting for the first time and then I close the browser
> and open the posting again, the content of the placeholder is not there
> (placeholder.datasource.rawcontent="").
> The most extange is that if then I select another item from the list and
> save, the value is stored in the placeholder fine.
>
> Any idea of what is wrong here?
>
> Thanks for your help

Stefan [MSFT]

2006-08-23, 1:22 pm

Hi ETX,

you need to do this using a custom placeholder control and not with code
behind.
That will not work and lead to the effect you have seen.
In addition you should never use Datasource.Rawcontent.
See here:
http://blogs.technet.com/stefan_gos.../24/119546.aspx

Cheers,
Stefan

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


"ETX" <ETX@discussions.microsoft.com> wrote in message
news:C22244D5-EFC1-4B95-BF25-A2DBCAB56168@microsoft.com...
> Hi all,
>
> I have a template with a HTMLPlaceholder definition and a dropdownlist web
> control. When an item of the list is selected, the selected value is
> stored
> in the placeholder
> (placeholder.datasource.rawcontent=list.selecteditem.value).
> Then when I save the posting for the first time and then I close the
> browser
> and open the posting again, the content of the placeholder is not there
> (placeholder.datasource.rawcontent="").
> The most extange is that if then I select another item from the list and
> save, the value is stored in the placeholder fine.
>
> Any idea of what is wrong here?
>
> Thanks for your help



ETX

2006-08-25, 7:26 am

Thank you Stefan and Mike,

Finally I added an HTMLPlaceholdercontrol and used the contentsaved event of
the control to store the custom property. That solved the issue.
I am going to make a revision of the code of the whole application to remove
the "datasource.rawcontent" cases. I am affraid that we have used that more
than once...

Thank you both a lot.



"Stefan [MSFT]" wrote:

> Hi ETX,
>
> you need to do this using a custom placeholder control and not with code
> behind.
> That will not work and lead to the effect you have seen.
> In addition you should never use Datasource.Rawcontent.
> See here:
> http://blogs.technet.com/stefan_gos.../24/119546.aspx
>
> Cheers,
> Stefan
>
> --
> This posting is provided "AS IS" with no warranties, and confers no rights
>
>
> "ETX" <ETX@discussions.microsoft.com> wrote in message
> news:C22244D5-EFC1-4B95-BF25-A2DBCAB56168@microsoft.com...
>
>
>

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com