Applying CSS to HTML Control Programatically

Discussion in 'ASP .Net' started by Prakash, Nov 8, 2005.

  1. Prakash

    Prakash Guest

    I am using HTML controls in my page i want to Programatically apply CSS for
    that controls as that of contorol.CSS="cssname" for Web Control. How to do
    it?.

    Thanks in Advance
    Prakash.V
    Prakash, Nov 8, 2005
    #1
    1. Advertising

  2. Prakash

    JuanCri Guest

    Hi...

    You could use

    control.CssClass = "mycssclass";

    Juan C. Olivares
    www.juancri.com
    JuanCri, Nov 8, 2005
    #2
    1. Advertising

  3. Prakash

    Prakash Guest

    Hi,
    Only Web Control has Control.CssClass , but HTML Control doesn't have
    that property.
    Is there any method to set Css for HTML control Programatically ?

    Prakash.V



    "JuanCri" <> wrote in message
    news:...
    > Hi...
    >
    > You could use
    >
    > control.CssClass = "mycssclass";
    >
    > Juan C. Olivares
    > www.juancri.com
    >
    Prakash, Nov 8, 2005
    #3
  4. control.Attributes.Add("class", "yCssClass");

    --
    HTH,

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Complex things are made up of
    Lots of simple things.

    "Prakash" <> wrote in message
    news:%...
    > Hi,
    > Only Web Control has Control.CssClass , but HTML Control doesn't have
    > that property.
    > Is there any method to set Css for HTML control Programatically ?
    >
    > Prakash.V
    >
    >
    >
    > "JuanCri" <> wrote in message
    > news:...
    >> Hi...
    >>
    >> You could use
    >>
    >> control.CssClass = "mycssclass";
    >>
    >> Juan C. Olivares
    >> www.juancri.com
    >>

    >
    >
    Kevin Spencer, Nov 8, 2005
    #4
  5. Prakash

    Mr Newbie Guest

    I used to have a friend called Prakash.

    I used to tease him that his name sounded like the Klingon name for a bowl
    of live grubs!

    I'm well known for my tact, dimplomacy, and the ease at which I seem to make
    friends.

    ;-D

    --
    Best Regards

    The Inimitable Mr Newbie º¿º



    "Kevin Spencer" <> wrote in message
    news:upLx7$...
    > control.Attributes.Add("class", "yCssClass");
    >
    > --
    > HTH,
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > Complex things are made up of
    > Lots of simple things.
    >
    > "Prakash" <> wrote in message
    > news:%...
    >> Hi,
    >> Only Web Control has Control.CssClass , but HTML Control doesn't have
    >> that property.
    >> Is there any method to set Css for HTML control Programatically ?
    >>
    >> Prakash.V
    >>
    >>
    >>
    >> "JuanCri" <> wrote in message
    >> news:...
    >>> Hi...
    >>>
    >>> You could use
    >>>
    >>> control.CssClass = "mycssclass";
    >>>
    >>> Juan C. Olivares
    >>> www.juancri.com
    >>>

    >>
    >>

    >
    >
    Mr Newbie, Nov 8, 2005
    #5
  6. > I'm well known for my tact, dimplomacy, and the ease at which I seem to
    > make friends.


    Yeah, me too. On the newsgroups I only show my "friendly" face.

    :-O

    --
    ;-)

    Kevin Spencer
    Microsoft MVP
    ..Net Developer
    Complex things are made up of
    Lots of simple things.

    "Mr Newbie" <> wrote in message
    news:%...
    >I used to have a friend called Prakash.
    >
    > I used to tease him that his name sounded like the Klingon name for a bowl
    > of live grubs!
    >
    > I'm well known for my tact, dimplomacy, and the ease at which I seem to
    > make friends.
    >
    > ;-D
    >
    > --
    > Best Regards
    >
    > The Inimitable Mr Newbie º¿º
    >
    >
    >
    > "Kevin Spencer" <> wrote in message
    > news:upLx7$...
    >> control.Attributes.Add("class", "yCssClass");
    >>
    >> --
    >> HTH,
    >>
    >> Kevin Spencer
    >> Microsoft MVP
    >> .Net Developer
    >> Complex things are made up of
    >> Lots of simple things.
    >>
    >> "Prakash" <> wrote in message
    >> news:%...
    >>> Hi,
    >>> Only Web Control has Control.CssClass , but HTML Control doesn't have
    >>> that property.
    >>> Is there any method to set Css for HTML control Programatically ?
    >>>
    >>> Prakash.V
    >>>
    >>>
    >>>
    >>> "JuanCri" <> wrote in message
    >>> news:...
    >>>> Hi...
    >>>>
    >>>> You could use
    >>>>
    >>>> control.CssClass = "mycssclass";
    >>>>
    >>>> Juan C. Olivares
    >>>> www.juancri.com
    >>>>
    >>>
    >>>

    >>
    >>

    >
    >
    Kevin Spencer, Nov 8, 2005
    #6
  7. Prakash

    Prakash Guest

    Thanks Kevin Spencer,
    control.Attributes.Add("class", "CssClassName");
    Is working fine.

    and also thanks Newbie for your comments,
    and your name also sounds strange for me.I think u r a "Jolly Man".

    mee too
    ;-))

    Prakash.V

    "Kevin Spencer" <> wrote in message
    news:...
    > > I'm well known for my tact, dimplomacy, and the ease at which I seem to
    > > make friends.

    >
    > Yeah, me too. On the newsgroups I only show my "friendly" face.
    >
    > :-O
    >
    > --
    > ;-)
    >
    > Kevin Spencer
    > Microsoft MVP
    > .Net Developer
    > Complex things are made up of
    > Lots of simple things.
    >
    > "Mr Newbie" <> wrote in message
    > news:%...
    > >I used to have a friend called Prakash.
    > >
    > > I used to tease him that his name sounded like the Klingon name for a

    bowl
    > > of live grubs!
    > >
    > > I'm well known for my tact, dimplomacy, and the ease at which I seem to
    > > make friends.
    > >
    > > ;-D
    > >
    > > --
    > > Best Regards
    > >
    > > The Inimitable Mr Newbie º¿º
    > >
    > >
    > >
    > > "Kevin Spencer" <> wrote in message
    > > news:upLx7$...
    > >> control.Attributes.Add("class", "yCssClass");
    > >>
    > >> --
    > >> HTH,
    > >>
    > >> Kevin Spencer
    > >> Microsoft MVP
    > >> .Net Developer
    > >> Complex things are made up of
    > >> Lots of simple things.
    > >>
    > >> "Prakash" <> wrote in message
    > >> news:%...
    > >>> Hi,
    > >>> Only Web Control has Control.CssClass , but HTML Control doesn't

    have
    > >>> that property.
    > >>> Is there any method to set Css for HTML control Programatically ?
    > >>>
    > >>> Prakash.V
    > >>>
    > >>>
    > >>>
    > >>> "JuanCri" <> wrote in message
    > >>> news:...
    > >>>> Hi...
    > >>>>
    > >>>> You could use
    > >>>>
    > >>>> control.CssClass = "mycssclass";
    > >>>>
    > >>>> Juan C. Olivares
    > >>>> www.juancri.com
    > >>>>
    > >>>
    > >>>
    > >>
    > >>

    > >
    > >

    >
    >
    Prakash, Nov 9, 2005
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Von Shean

    Applying Css on input button

    Von Shean, May 28, 2004, in forum: HTML
    Replies:
    4
    Views:
    101,379
    shlover143
    Jun 22, 2010
  2. Noozer
    Replies:
    2
    Views:
    6,380
    Noozer
    Sep 26, 2004
  3. =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?=

    Applying CSS Styles to Dropdownlist

    =?Utf-8?B?TmVpbCBTdGV2ZW50b24=?=, May 15, 2006, in forum: ASP .Net
    Replies:
    4
    Views:
    60,900
    Juan T. Llibre
    May 15, 2006
  4. Replies:
    1
    Views:
    427
    Andrew Thompson
    Aug 13, 2006
  5. Replies:
    0
    Views:
    3,993
Loading...

Share This Page