|
Home > Archive > Microsoft Content Management Server > May 2007 > Problem with CMSPosting_changed
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 |
Problem with CMSPosting_changed
|
|
| Candace 2007-05-29, 7:18 pm |
| I have added the code below to my application. It works fine up until the
time I approve the posting. Then I get the error the the "Object cannot be
modified pending a commit." Based on the posts I've read, this is an issue
with a commit. I do commit my changes, but perhaps not in the right place?
If I add a commitall before I change the contents of the placeholder, I don't
get the error, but neither do my changes take effect. Any help is
appreciated. Here's the code:
Sub CmsPosting_Changed(ByVal source As Object, ByVal e As ChangedEventArgs)
If TypeOf (e.Target) Is Posting Then
Dim changedposting As Posting = CType(e.Target, Posting)
If Not changedposting.Placeholders("topimage") Is Nothing Then
Dim genericplace As Placeholder
genericplace = changedposting.Placeholders("topimage")
Dim content As String
If TypeOf (genericplace) Is HtmlPlaceholder Then
content = CType(genericplace, HtmlPlaceholder).Html
End If
content = content.Replace("> </A>", "></A>")
content = content.Replace("> </a>", "></a>")
CType(genericplace, HtmlPlaceholder).Html = content
e.Context.CommitAll()
End If
End If
End Sub
| |
| Stefan Goßner [MSFT] 2007-05-30, 7:16 am |
| Hi Candace,
you need to change the content in the CmsPosting_Changing event handler.
Not in the Changed event handler.
Cheers,
Stefan
"Candace" <Candace@discussions.microsoft.com> wrote in message
news:3BEB12FB-5BB8-4C22-967D-EE63EB4AD249@microsoft.com...
>I have added the code below to my application. It works fine up until the
> time I approve the posting. Then I get the error the the "Object cannot
> be
> modified pending a commit." Based on the posts I've read, this is an
> issue
> with a commit. I do commit my changes, but perhaps not in the right
> place?
> If I add a commitall before I change the contents of the placeholder, I
> don't
> get the error, but neither do my changes take effect. Any help is
> appreciated. Here's the code:
>
> Sub CmsPosting_Changed(ByVal source As Object, ByVal e As
> ChangedEventArgs)
>
> If TypeOf (e.Target) Is Posting Then
>
> Dim changedposting As Posting = CType(e.Target, Posting)
> If Not changedposting.Placeholders("topimage") Is Nothing Then
>
>
> Dim genericplace As Placeholder
> genericplace = changedposting.Placeholders("topimage")
> Dim content As String
> If TypeOf (genericplace) Is HtmlPlaceholder Then
> content = CType(genericplace, HtmlPlaceholder).Html
> End If
> content = content.Replace("> </A>", "></A>")
> content = content.Replace("> </a>", "></a>")
> CType(genericplace, HtmlPlaceholder).Html = content
> e.Context.CommitAll()
> End If
> End If
>
>
> End Sub
|
|
|
|
|