Retrieving HTML from Placeholder
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 > Retrieving HTML from Placeholder




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

    Retrieving HTML from Placeholder  
John


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


 
03-08-07 12:18 AM

I have read the posts on this topic, but I'm missing something. I have
a non-cms page on my site that I want to pull html out of a posting
but I can't get the caste change to work.

Please tell me what I'm doing wrong.

*With this code, I get the error:" Value of type
'Microsoft.ContentManagement.Publishing.Placeholder' cannot be
converted to
'Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl'."

*Also, this posting was created with a Telerik Rad Edito
HTMLPlaceholder

Private Sub GetCMSContent(ByVal pstrPostingName As String)
Dim phCMS As New
Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl
Dim channel As Channel
Dim posting As Posting


channel = CmsHttpContext.Current.Searches.GetByPath("/channels/
yew")
For Each posting In channel.Postings
If posting.Name.ToLower.Equals(pstrPostingName.ToLower)
Then
phCMS = posting.Placeholders("phRadContent") <-----
ERROR HERE
Me.litCartCMSHTML.Text = phCMS.Html
Exit For
End If
Next
End Sub

Thanks,

John






[ Post a follow-up to this message ]



    Re: Retrieving HTML from Placeholder  
John


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


 
03-08-07 12:18 AM

Just another note, I have tried
phCMS = CType(posting.Placeholders("phRadContent"),
Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl)

and I get the same error.

* The error is a "hover error" in Visual Studio, not a compile or run-
time error.


On Mar 7, 4:44 pm, "John" <john....@milliken.com> wrote:
> I have read the posts on this topic, but I'm missing something. I have
> a non-cms page on my site that I want to pull html out of a posting
> but I can't get the caste change to work.
>
> Please tell me what I'm doing wrong.
>
> *With this code, I get the error:" Value of type
> 'Microsoft.ContentManagement.Publishing.Placeholder' cannot be
> converted to
> 'Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl'."
>
> *Also, this posting was created with a Telerik Rad Edito
> HTMLPlaceholder
>
>  Private Sub GetCMSContent(ByVal pstrPostingName As String)
>         Dim phCMS As New
> Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl
>         Dim channel As Channel
>         Dim posting As Posting
>
>         channel = CmsHttpContext.Current.Searches.GetByPath("/channels/
> yew")
>         For Each posting In channel.Postings
>             If posting.Name.ToLower.Equals(pstrPostingName.ToLower)
> Then
>                 phCMS = posting.Placeholders("phRadContent") <-----
> ERROR HERE
>                 Me.litCartCMSHTML.Text = phCMS.Html
>                 Exit For
>             End If
>         Next
>     End Sub
>
> Thanks,
>
> John







[ Post a follow-up to this message ]



    Re: Retrieving HTML from Placeholder  
Stefan Goßner [MSFT]


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


 
03-08-07 12:23 PM

Hi John,

you need to cast for HtmlPlaceholder and define phCMS as HtmlPlaceholder.
Not as HtmlPlaceholderControl.

Cheers,
Stefan


"John" <john.way@milliken.com> wrote in message
news:1173304741.880588.165960@p10g2000cwp.googlegroups.com...
> Just another note, I have tried
> phCMS = CType(posting.Placeholders("phRadContent"),
> Microsoft.ContentManagement.WebControls.HtmlPlaceholderControl)
>
> and I get the same error.
>
> * The error is a "hover error" in Visual Studio, not a compile or run-
> time error.
>
>
> On Mar 7, 4:44 pm, "John" <john....@milliken.com> wrote: 
>
>







[ Post a follow-up to this message ]



    Re: Retrieving HTML from Placeholder  
John


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


 
03-08-07 06:18 PM

OK, I was using the wrong namespace. I should have been looking in
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehol=
der.

However, the HTML I got back was not what I expected. I was hoping
that this method would bring back clean HTML versus using the
rawcontent method. This content was created by a telerik control so I
have "~" everywhere.

To solve this problem, I tried the follwoing code, but I'm not getting
anything back from the phRad.HTML call. Can you help?

Private Function GetCMSContent(ByVal pstrPostingName As String, ByVal
pstrPlaceholderName As String, ByVal pstrChannelPath As String) As
String
Dim phCMS As
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehol=
der
Dim phRad As New
Telerik.WebControls.RadEditorPlaceHolderControl
Dim channel As Channel
Dim posting As Posting
Dim strContent As String =3D ""


channel =3D
CmsHttpContext.Current.Searches.GetByPath(pstrChannelPath)
If Not IsNothing(channel) Then
For Each posting In channel.Postings
If
posting.Name.ToLower.Equals(pstrPostingName.ToLower) Then
phCMS =3D
posting.Placeholders.Item(pstrPlaceholderName)
phRad.BoundPlaceholder =3D phCMS
phRad.DataBind()
strContent =3D phRad.Html
Exit For
End If
Next
End If
Return strContent
End Function

Thanks,
John

On Mar 8, 2:35 am, "Stefan Go=DFner [MSFT]"
<stef...@online.microsoft.com> wrote:[vbcol=seagreen]
> Hi John,
>
> you need to cast for HtmlPlaceholder and define phCMS as HtmlPlaceholder.
> Not as HtmlPlaceholderControl.
>
> Cheers,
> Stefan
>
> "John" <john....@milliken.com> wrote in message
>
> news:1173304741.880588.165960@p10g2000cwp.googlegroups.com...
> 
> 
> 
> 
> 
> 
> 
> 
> 
ls/[vbcol=seagreen] 
> 
> 







[ Post a follow-up to this message ]



    Re: Retrieving HTML from Placeholder  
Stefan Goßner [MSFT]


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


 
03-08-07 06:18 PM

Hi John,

do just this:

string content = phCMS.Html.Replace("~LT~","<").Replace("~GT~",">")

(this is C# code. You need to translate it into VB.NET)

Cheers,
Stefan



"John" <john.way@milliken.com> wrote in message
news:1173371797.500393.313240@n33g2000cwc.googlegroups.com...
OK, I was using the wrong namespace. I should have been looking in
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehold
er.

However, the HTML I got back was not what I expected. I was hoping
that this method would bring back clean HTML versus using the
rawcontent method. This content was created by a telerik control so I
have "~" everywhere.

To solve this problem, I tried the follwoing code, but I'm not getting
anything back from the phRad.HTML call. Can you help?

Private Function GetCMSContent(ByVal pstrPostingName As String, ByVal
pstrPlaceholderName As String, ByVal pstrChannelPath As String) As
String
Dim phCMS As
Microsoft.ContentManagement.Publishing.Extensions.Placeholders.HtmlPlacehold
er
Dim phRad As New
Telerik.WebControls.RadEditorPlaceHolderControl
Dim channel As Channel
Dim posting As Posting
Dim strContent As String = ""


channel =
CmsHttpContext.Current.Searches.GetByPath(pstrChannelPath)
If Not IsNothing(channel) Then
For Each posting In channel.Postings
If
posting.Name.ToLower.Equals(pstrPostingName.ToLower) Then
phCMS =
posting.Placeholders.Item(pstrPlaceholderName)
phRad.BoundPlaceholder = phCMS
phRad.DataBind()
strContent = phRad.Html
Exit For
End If
Next
End If
Return strContent
End Function

Thanks,
John

On Mar 8, 2:35 am, "Stefan Goßner [MSFT]"
<stef...@online.microsoft.com> wrote:[vbcol=seagreen]
> Hi John,
>
> you need to cast for HtmlPlaceholder and define phCMS as HtmlPlaceholder.
> Not as HtmlPlaceholderControl.
>
> Cheers,
> Stefan
>
> "John" <john....@milliken.com> wrote in message
>
> news:1173304741.880588.165960@p10g2000cwp.googlegroups.com...
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 








[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 05:13 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