SingleImagePlaceholder renders to <span><a ..><img /></a> <
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 > SingleImagePlaceholder renders to <span><a ..><img /></a> <




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

    SingleImagePlaceholder renders to <span><a ..><img /></a> <  
Joe C


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


 
11-15-05 10:57 PM

It seems that the SingleImagePlaceholder always renders to three tags in the
following structure:
<span><a ..><img /></a> </span>
Is there a way that I can force it to not render the <a> tag?  Even when I
set the 'allow hyperlinks' property on the placeholder, I still get this <a>
tag.

Thanks
Joe





[ Post a follow-up to this message ]



    Re: SingleImagePlaceholder renders to <span><a ..><img /></a>  
Stefan [MSFT]


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


 
11-16-05 12:52 PM

Hi Joe,

to achieve this you would need to create a custom placeholder control that
derives from the original SingleImagePlaceholderControl.
In your custom placeholder control you need to override the Render method,
consume the generated html and remove the unwanted tags.
Then return the modified html as a result of the Render method.

This would look like the following:

protected override void Render(System.Web.UI.HtmlTextWriter output)
{
if ((WebAuthorContext.Current.Mode !=
WebAuthorContextMode.AuthoringReedit)
&&(WebAuthorContext.Current.Mode != WebAuthorContextMode.AuthoringNew))
{
// catch the output of the original HtmlPlaceholderControl
TextWriter tempWriter = new StringWriter();
base.Render(new System.Web.UI.HtmlTextWriter(tempWriter));

string orightml= tempWriter.ToString();

// remove the unwanted tags
string newhtml = orightml.Replace(...);

output.Write(newhtml);
}
else
{
base.Render(output);
}
}

Cheers,
Stefan

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

New to MCMS?
Check out this book: Building Websites Using MCMS: http://tinyurl.com/6zj44
Check out the new book as well: Advanced MCMS development:
http://tinyurl.com/8ugwj
----------------------


"Joe C" <JoeC@discussions.microsoft.com> wrote in message
news:CFC0507D-6D44-4970-83F4-93C9EBC3A027@microsoft.com...
> It seems that the SingleImagePlaceholder always renders to three tags in
> the
> following structure:
> <span><a ..><img /></a> </span>
> Is there a way that I can force it to not render the <a> tag?  Even when I
> set the 'allow hyperlinks' property on the placeholder, I still get this
> <a>
> tag.
>
> Thanks
> Joe







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 04:22 PM.      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