473,387 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Applying CSS to HTML Control Programatically

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
Nov 19 '05 #1
6 1729
Hi...

You could use

control.CssClass = "mycssclass";

Juan C. Olivares
www.juancri.com

Nov 19 '05 #2
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" <ju*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi...

You could use

control.CssClass = "mycssclass";

Juan C. Olivares
www.juancri.com

Nov 19 '05 #3
control.Attributes.Add("class", "yCssClass");

--
HTH,

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

"Prakash" <vv********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <ju*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi...

You could use

control.CssClass = "mycssclass";

Juan C. Olivares
www.juancri.com


Nov 19 '05 #4
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" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:up**************@tk2msftngp13.phx.gbl...
control.Attributes.Add("class", "yCssClass");

--
HTH,

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

"Prakash" <vv********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <ju*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi...

You could use

control.CssClass = "mycssclass";

Juan C. Olivares
www.juancri.com



Nov 19 '05 #5
> 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" <he**@now.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...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" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:up**************@tk2msftngp13.phx.gbl...
control.Attributes.Add("class", "yCssClass");

--
HTH,

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

"Prakash" <vv********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <ju*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Hi...

You could use

control.CssClass = "mycssclass";

Juan C. Olivares
www.juancri.com



Nov 19 '05 #6
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" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:Oz**************@TK2MSFTNGP15.phx.gbl...
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" <he**@now.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <ke***@DIESPAMMERSDIEtakempis.com> wrote in message
news:up**************@tk2msftngp13.phx.gbl...
control.Attributes.Add("class", "yCssClass");

--
HTH,

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

"Prakash" <vv********@gmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
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" <ju*****@gmail.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
> Hi...
>
> You could use
>
> control.CssClass = "mycssclass";
>
> Juan C. Olivares
> www.juancri.com
>



Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Hawk | last post by:
I have a custom menu control that I am creating using C#. I am rendering HTML from a StringBuilder in my control to add the needed JavaScript to the HTML output. I need to have the JavaScript...
4
by: Deep S. | last post by:
Hi, I'm working on ASP.NET and want to stop VS.NET IDE applying it's intelligence when working in the HTML view of the aspx files. Every time i arrange the HTML code properly, coming back to it,...
6
by: Andre Ranieri | last post by:
I'm trying to create a login page for customers to log into our corporate website, our presidents naturally wants the user and password fields to populate from a cookie so the customer doesn't have...
2
by: Edgardo Rossetto | last post by:
Is it possible? Or I must add the control programatically in order to make changes programatically? Edgardo
7
by: sasquatch | last post by:
Hi, I've a a site with nested master pages and content pages. I tried using a theme with a stylesheet in the app_themes directory referencing it in the web.config file from a pages tag theme...
1
by: Ashok | last post by:
Hi I have some issues in applying Themes to controls programatically, when controls are inside WebpartZone. I have put some Webparts inside WebpartZone, i want to apply themes and skin to those...
6
by: PenguinPig | last post by:
Dear All Experts I would like to know how to convert a HTML into Image using C#. Or allow me contains HTML code (parsed) in Image? I also tried this way but it just display the character "<" &...
2
by: milecimm | last post by:
Hello, I need some help to solve the following problem (if it is possible, that's it): I'm using a xpath expression to programatically get data from my xml file. I want to transform ONLY the...
6
by: =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post by:
Hi - I have 4 webservers in my webfarm. All Win2k3 web edition. Before yesterday, none of them were service packed. I have now applied SP2 to two of them, and I'm getting a very weird MSDTC...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.