protected override void Render (System.Web.UI.HtmlTextWriter output)
what I want to do is I want to change output stream html by htmlplaceholder
as follows
from
<a href="test.htm">test</a>
to
<a href="test.htm" target="_new">test</a>
basically I want to have any link tag to be opened in a new windows when
users click this url placeholder.
Please help me if you know any ideas to override a certain methods to make
this happen.
I assume this should only happen during presentation mode, right? Not in
authoring mode?
Then you should override the LoadPlaceholderContentForAuthoring method of
the HtmlPlaceholderControl.
Do the following:
protected override void
LoadPlaceholderContentForPresentation(PlaceholderControlEventArgs e)
{
EnsureChildControls();
base.Html =
(((HtmlPlaceholder)(base.BoundPlaceholder)).Html.Replace("<a","<a
target=\"_new\");
}
That should do the job.
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
----------------------
"andrew007" <gah...@yahoo.com> wrote in message
news:C7BDEDA7-48D4-4DE1...@microsoft.com...
Thanks
then do 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();
string newhtml = orightml.Replace("<a","<a target=\"_new\");
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
----------------------
"andrew007" <gah...@yahoo.com> wrote in message
news:E9C4C8C8-EF99-4A97...@microsoft.com...