Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > Programatically adding a style

Reply
Thread Tools

Programatically adding a style

 
 
Ken Cox [Microsoft MVP]
Guest
Posts: n/a
 
      06-03-2004
Hi JSH,

This code might be what you're after:

Private Sub Page_Load _
(ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim tb As New TextBox
tb.TextMode = TextBoxMode.MultiLine
tb.Rows = 1
tb.Style.Add("OVERFLOW", "hidden")
PlaceHolder1.Controls.Add(tb)
End Sub

It produces this as the Style for the texbox:

style="OVERFLOW:hidden;"

Does this help?

Ken
Microsoft MVP [ASP.NET]


"jsh02_nova" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Does anybody know if it is possible to add a particular CSS style
> attribute
> dynamically at runtime to a webcontrol other than setting the property
> values provided in the Style type? I would like to add "OVERFLOW:
> hidden",
> but Style doesn't have this property.
>
> e.i.,
> Dim tb As New TextBox
>
> tb.TextMode = TextBoxMode.MultiLine
> tb.Rows = 1
> 'nice try
> Dim newStyle = New Style("OVERFLOW: hidden")
> tb.ApplyStyle(newStyle)
>
> thx
> -jsh
>
>


 
Reply With Quote
 
 
 
 
jsh02_nova
Guest
Posts: n/a
 
      06-04-2004
Does anybody know if it is possible to add a particular CSS style attribute
dynamically at runtime to a webcontrol other than setting the property
values provided in the Style type? I would like to add "OVERFLOW: hidden",
but Style doesn't have this property.

e.i.,
Dim tb As New TextBox

tb.TextMode = TextBoxMode.MultiLine
tb.Rows = 1
'nice try
Dim newStyle = New Style("OVERFLOW: hidden")
tb.ApplyStyle(newStyle)

thx
-jsh


 
Reply With Quote
 
 
 
 
jsh02_nova
Guest
Posts: n/a
 
      06-04-2004
That was it, got that cat skinned!
Thanks Ken

v/r
-jsh

"Ken Cox [Microsoft MVP]" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi JSH,
>
> This code might be what you're after:
>
> Private Sub Page_Load _
> (ByVal sender As System.Object, _
> ByVal e As System.EventArgs) _
> Handles MyBase.Load
> Dim tb As New TextBox
> tb.TextMode = TextBoxMode.MultiLine
> tb.Rows = 1
> tb.Style.Add("OVERFLOW", "hidden")
> PlaceHolder1.Controls.Add(tb)
> End Sub
>
> It produces this as the Style for the texbox:
>
> style="OVERFLOW:hidden;"
>
> Does this help?
>
> Ken
> Microsoft MVP [ASP.NET]
>
>
> "jsh02_nova" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Does anybody know if it is possible to add a particular CSS style
> > attribute
> > dynamically at runtime to a webcontrol other than setting the property
> > values provided in the Style type? I would like to add "OVERFLOW:
> > hidden",
> > but Style doesn't have this property.
> >
> > e.i.,
> > Dim tb As New TextBox
> >
> > tb.TextMode = TextBoxMode.MultiLine
> > tb.Rows = 1
> > 'nice try
> > Dim newStyle = New Style("OVERFLOW: hidden")
> > tb.ApplyStyle(newStyle)
> >
> > thx
> > -jsh
> >
> >

>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
How to change the font style and size on the entire Aspx page programatically technoGirl ASP .Net Web Controls 8 01-03-2007 08:33 AM
How to change the font style and size on the entire aspx page programatically the.tinapatel@gmail.com ASP .Net 0 12-24-2006 05:27 AM
best way to programatically set a page's style? PJ6 ASP .Net 4 10-07-2005 03:25 AM
Need help with Style conversion from Style object to Style key/value collection. Ken Varn ASP .Net Building Controls 0 04-26-2004 07:06 PM
Datagrid, adding a row programatically Michelle Stone ASP .Net 2 10-18-2003 12:36 PM



Advertisments