|
Home > Archive > Microsoft Content Management Server > January 2007 > Assigning a style to an Anchor in a HTMLPlaceHolder
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 |
Assigning a style to an Anchor in a HTMLPlaceHolder
|
|
| mullkv@googlemail.com 2007-01-26, 1:16 pm |
| Hi All,
I am trying to assign a CSS Style to an anchor in a HTMLPlaceHolder
Control.
Currently, when I assign the tag I get this:
<span id=" ctl00_ContentPlaceHolder1_AutoCssHtmlPhC
ontrol1"
class="next"><A href="#">Send an Email</A></span>
(note this is using the AutoCSSHtmlPHControl - the same is true of the
standard HTML Control).
What I really want to see is:
<span id=" ctl00_ContentPlaceHolder1_AutoCssHtmlPhC
ontrol1" ><A href="#"
class="next">Send an Email</A></span>
Note that the class is assigned to the anchor tag, not the CMS injected
span.
I'm assuming I need to override the Render method and do somthing there
but was just wondering if anybody else had done this recently.
Many Thanks & Have a good weekend all,
Kevin Mullins
KDM Technologies Ltd.
| |
| Stefan Goßner [MSFT] 2007-01-26, 1:16 pm |
| Hi Kevin,
you can also live with the current settings by setting your CSS
appropriatelly.
Something like this:
..next A {...}
Cheers,
Stefan
<mullkv@googlemail.com> wrote in message
news:1169823982.842776.78710@m58g2000cwm.googlegroups.com...
> Hi All,
>
> I am trying to assign a CSS Style to an anchor in a HTMLPlaceHolder
> Control.
>
> Currently, when I assign the tag I get this:
>
> <span id=" ctl00_ContentPlaceHolder1_AutoCssHtmlPhC
ontrol1"
> class="next"><A href="#">Send an Email</A></span>
>
> (note this is using the AutoCSSHtmlPHControl - the same is true of the
> standard HTML Control).
>
> What I really want to see is:
>
> <span id=" ctl00_ContentPlaceHolder1_AutoCssHtmlPhC
ontrol1" ><A href="#"
> class="next">Send an Email</A></span>
>
> Note that the class is assigned to the anchor tag, not the CMS injected
> span.
>
> I'm assuming I need to override the Render method and do somthing there
> but was just wondering if anybody else had done this recently.
>
> Many Thanks & Have a good weekend all,
>
> Kevin Mullins
> KDM Technologies Ltd.
>
| |
| mullkv@googlemail.com 2007-01-26, 1:16 pm |
| Hi Stefan,
Thanks for the quick reply.
Yes, I know this would be a good way of doing it, however, we use an
external design agency and they insist that the CSS is correct and we
need to assign the style to anchor tag as a class (rather than do it as
you mention).
I agree your route would be the best, but unfotunately I can't do that
this time....
Many Thanks
Kevin
On 26 Jan, 15:11, "Stefan Go=DFner [MSFT]"
<stef...@online.microsoft.com> wrote:
> Hi Kevin,
>
> you can also live with the current settings by setting your CSS
> appropriatelly.
> Something like this:
>
> .next A {...}
>
> Cheers,
> Stefan
>
> <mul...@googlemail.com> wrote in messagenews:1169823982.842776.78710@m58g=
2000cwm.googlegroups.com...[vbcol=seagreen]
>
>
>
>
>
>
>
>
>
=3D"#"[vbcol=seagreen]
>
>
>
>
| |
| Stefan Goßner [MSFT] 2007-01-26, 1:16 pm |
| Hi Kevin,
then you would need to write a custom placeholder control.
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();
// move the class attribute around
string newhtml = moveTheClassAttribute(orightml;
output.Write(newhtml);
}
else
{
base.Render(output);
}
}
You could use this fragment to get started:
Cheers,
Stefan
<mullkv@googlemail.com> wrote in message
news:1169824571.146310.239370@s48g2000cws.googlegroups.com...
Hi Stefan,
Thanks for the quick reply.
Yes, I know this would be a good way of doing it, however, we use an
external design agency and they insist that the CSS is correct and we
need to assign the style to anchor tag as a class (rather than do it as
you mention).
I agree your route would be the best, but unfotunately I can't do that
this time....
Many Thanks
Kevin
On 26 Jan, 15:11, "Stefan Goßner [MSFT]"
<stef...@online.microsoft.com> wrote:[vbcol=seagreen]
> Hi Kevin,
>
> you can also live with the current settings by setting your CSS
> appropriatelly.
> Something like this:
>
> .next A {...}
>
> Cheers,
> Stefan
>
> <mul...@googlemail.com> wrote in
> messagenews:1169823982.842776.78710@m58g2000cwm.googlegroups.com...
>
>
>
>
>
>
>
>
>
>
>
>
>
| |
| mullkv@googlemail.com 2007-01-26, 1:16 pm |
| Thanks Stefan - Just what I thought. Pesky designers ;-)
Kevin
On 26 Jan, 15:22, "Stefan Go=DFner [MSFT]"
<stef...@online.microsoft.com> wrote:
> Hi Kevin,
>
> then you would need to write a custom placeholder control.
>
> protected override void Render(System.Web.UI.HtmlTextWriter output)
> {
> if ((WebAuthorContext.Current.Mode !=3D
> WebAuthorContextMode.AuthoringReedit)
> &&(WebAuthorContext.Current.Mode !=3D WebAuthorContextMode.AuthoringN=
ew))
> {
> // catch the output of the original HtmlPlaceholderControl
> TextWriter tempWriter =3D new StringWriter();
> base.Render(new System.Web.UI.HtmlTextWriter(tempWriter));
>
> string orightml=3D tempWriter.ToString();
>
> // move the class attribute around
> string newhtml =3D moveTheClassAttribute(orightml;
>
> output.Write(newhtml);
> }
> else
> {
> base.Render(output);
> }
> }
>
> You could use this fragment to get started:
>
> Cheers,
> Stefan
>
> <mul...@googlemail.com> wrote in messagenews:1169824571.146310.239370@s48=
g2000cws.googlegroups.com...[vbcol=seagreen]
> Hi Stefan,
>
> Thanks for the quick reply.
>
> Yes, I know this would be a good way of doing it, however, we use an
> external design agency and they insist that the CSS is correct and we
> need to assign the style to anchor tag as a class (rather than do it as
> you mention).
>
> I agree your route would be the best, but unfotunately I can't do that
> this time....
>
> Many Thanks
>
> Kevin
>
> On 26 Jan, 15:11, "Stefan Go=DFner [MSFT]"
>
>
>
> <stef...@online.microsoft.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
=3D"#"[vbcol=seagreen]
>
ed[vbcol=seagreen]
>
re[vbcol=seagreen]
>
>
uoted text -- Show quoted text -
| |
| Shady Khorshed 2007-01-27, 1:15 pm |
| Hi Kevin,
you may use a simple way with just css, add the place holder in a div in
your template , assign id for this div then in your css assign the a css
like that
in your template add this
<div id="links">
place holder content
</div>
and then in yur css add this
#links a:link, #links a:visited
{
font-family: Tahoma;
font-size: 11px;
color:#006AA2;
text-decoration: underline;
}
#links a:hover
{
font-family: Tahoma;
font-size: 11px;
color:#006AA2;
text-decoration: none;
}
Regards,
Shady Khorshed
<mullkv@googlemail.com> wrote in message
news:1169825253.512428.94160@v45g2000cwv.googlegroups.com...
Thanks Stefan - Just what I thought. Pesky designers ;-)
Kevin
On 26 Jan, 15:22, "Stefan Goßner [MSFT]"
<stef...@online.microsoft.com> wrote:[vbcol=seagreen]
> Hi Kevin,
>
> then you would need to write a custom placeholder control.
>
> 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();
>
> // move the class attribute around
> string newhtml = moveTheClassAttribute(orightml;
>
> output.Write(newhtml);
> }
> else
> {
> base.Render(output);
> }
> }
>
> You could use this fragment to get started:
>
> Cheers,
> Stefan
>
> <mul...@googlemail.com> wrote in
> messagenews:1169824571.146310.239370@s48g2000cws.googlegroups.com...
> Hi Stefan,
>
> Thanks for the quick reply.
>
> Yes, I know this would be a good way of doing it, however, we use an
> external design agency and they insist that the CSS is correct and we
> need to assign the style to anchor tag as a class (rather than do it as
> you mention).
>
> I agree your route would be the best, but unfotunately I can't do that
> this time....
>
> Many Thanks
>
> Kevin
>
> On 26 Jan, 15:11, "Stefan Goßner [MSFT]"
>
>
>
> <stef...@online.microsoft.com> wrote:
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
|
|