PC Review


Reply
Thread Tools Rate Thread

Custom Control, OutputRender, AddStyleAttribute problem

 
 
Damien
Guest
Posts: n/a
 
      4th Aug 2005
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

 
Reply With Quote
 
 
 
 
Damien
Guest
Posts: n/a
 
      11th Aug 2005
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.

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HtmlTextWriter.AddStyleAttribute Jan Kucera Microsoft ASP .NET 1 13th Jul 2006 09:24 AM
Problem with custom control zoneal@yahoo.com Microsoft ASP .NET 1 19th Oct 2005 05:24 AM
creating a custom control that extends the DataGrid control and can be placed on the toolbox problem Wiredless Microsoft Dot NET Compact Framework 3 3rd Jun 2005 06:44 AM
Custom control problem Tomer Microsoft Dot NET Compact Framework 0 22nd Mar 2005 05:59 PM
Re: custom control problem Natty Gur Microsoft ASP .NET 0 20th Jul 2003 07:17 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:55 AM.