Damien wrote:
> Hi guys,
>
> I'm developing a custom control which essentially acts as a button
> control, so I'm calling AddStyleAttribute repeatedly on the output
> stream, then adding a few normal attributes, and then outputting the
> input:
>
> If Not Me.Visible Then Return
> output.AddStyleAttribute("vertical-align", "baseline")
> output.AddStyleAttribute("width", Me.Width.ToString())
> output.AddStyleAttribute("cursor", "hand")
> output.AddStyleAttribute("color", Me.ForeColor.ToString())
> output.AddStyleAttribute("border-top-style", "none")
> output.AddStyleAttribute("border-right-style", "none")
> output.AddStyleAttribute("border-left-style", "none")
> output.AddStyleAttribute("border-bottom-style", "none")
> output.AddStyleAttribute("height", Me.Height.ToString())
> output.AddStyleAttribute("background-color",
> Me.BackColor.ToString())
> output.AddStyleAttribute("text-align", "center")
> output.AddStyleAttribute("background-image", Me.URLRoot &
> "RoundedButton.gifx?Width=" & Me.Width.ToString() & "&Height=" &
> Me.Height.ToString() & "&StraightHeight=" & Me.HeightStraightPercent &
> "&Color=" & Me.BackColor.ToString() & "&BorderWidth=" &
> Me.BorderWidth.ToString() & "&BorderColor=" &
> Me.BorderColor.ToString())
> output.AddAttribute("name", Me.ID)
> output.AddAttribute("value", Me.Text)
> output.AddAttribute("type", "submit")
> 'Add support for validation
> output.RenderBeginTag("input")
> output.RenderEndTag()
>
> When It reaches the browser, only the normal attributes have appeared.
> There's no sign of a style attribute at all. So, obvious question time:
> Am I doing something stupid? Is this not the way I'm meant to apply my
> styling?
>
> Damien
Just an update on this - I've not managed to make this work, so I've
switched to outputting the right pieces of markup using the
output.write() method. It looks a lot messier, and it's a lot more
frustrating, but hey-ho.
|