| Trevor Grant 2004-03-02, 4:35 am |
| Hi Mike
Before we delve into the code, just to double check: Did
you add a reference to the DLL in the project (under the
References section in Solution Explorer) ?
Trevor
>-----Original Message-----
>We have created a custom placeholder that holds any kind
of HTML tags
>using the instructions provided in MCMS.chm. This was
successfully
>implemented in a machine running W2K3 with SP1 and the
1.1 NET
>Framework. Now we are trying to use it on a W2K machine
with MCMS SP1
>and .NET 1.0. VS.NET will not let us drag and drop the
placeholder
>into the .aspx template. Because it is a VB CMS project
we converted
>the C# code to VB and it still did not work. We know
that the VB
>version works because we tried it in a VB CMS project.
It built fine
>on the 1.0 box but the placeholder will create errors
whenever added
>to an aspx page. What could be causing the error? I
have pasted the
>C# code below.
>
>
>using System;
>using System.IO;
>using System.Web.UI;
>using System.Web.UI.WebControls;
>using System.ComponentModel;
>using Microsoft.ContentManagement.Publishing;
>using
Microsoft.ContentManagement.Publishing.Extensions.Placehold
ers;
>using Microsoft.ContentManagement.WebControls.Design;
>using Microsoft.ContentManagement.WebControls;
>
>namespace AllTagsHtmlPlaceholderControl
>{
> /// <summary>
> /// Summary description for
AllTagsHtmlPlaceholderControl.
> /// </summary>
> [
> ToolboxData("<{0}:AllTagsHtmlPlaceholderControl
>runat=server></{0}:AllTagsHtmlPlaceholderControl>"),
> SupportedPlaceholderDefinitionType(type
of
(HtmlPlaceholderDefinition))
> ]
> public class AllTagsHtmlPlaceholderControl :
HtmlPlaceholderControl
> {
> public AllTagsHtmlPlaceholderControl()
> {
> //
> // TODO: Add constructor logic here
> //
> }
>
> private string UnEscape(string input)
> {
> return input.Replace
("~LT~","<").Replace("~GT~",">");
> }
>
> private string Escape(string input)
> {
> return input.Replace
("<","~LT~").Replace(">","~GT~");
> }
>
> protected override void
>LoadPlaceholderContentForAuthoring
(PlaceholderControlEventArgs e)
> {
> EnsureChildControls();
> if (WebAuthorContext.Current.Mode
==
>WebAuthorContextMode.AuthoringReedit)
> base.Html = UnEscape
(((HtmlPlaceholder)(base.BoundPlaceholder)).Html);
> else
>
base. LoadPlaceholderContentForAuthoring(e);[c
olor=darkred]
> }
>
> protected override void
>LoadPlaceholderContentForPresentation[/color]
(PlaceholderControlEventArgs e)
> {
> EnsureChildControls();
> base.Html = UnEscape
(((HtmlPlaceholder)(base.BoundPlaceholder)).Html);
> }
>
> protected override void
> SavePlaceholderContent(PlaceholderContro
lSaveEventArgs e)
> {
> EnsureChildControls();
> ((HtmlPlaceholder)
(base.BoundPlaceholder)).Html =
>Escape(base.Html);
> }
>
> }
>}
>.
>
|