DmitryK
DmitryK

Reputation: 1333

Apply Css Style while creating Dynamic Table

Here is my problem:

Upvotes: 3

Views: 21806

Answers (3)

Jamie Fellrath
Jamie Fellrath

Reputation: 23

I like the answers above, for sure. But you can also use the format of

cel1.Style(HtmlTextWriterStyle.FontSize) = 9

for example. Autocomplete drop-downs will obviously give you a list of possible values to use along with HtmlTextWriterStyle if you're in Visual Studio.

Upvotes: 1

M.Schenkel
M.Schenkel

Reputation: 477

Its actually pretty easy.

cel1.Style["CSSPROPERTY"] = "SomeValue"

or

cel1.Attributes.Add("class", "CSSCLASSNAME");

That oughtta do it

Upvotes: 9

Adil
Adil

Reputation: 148110

Try this

cel1.Attributes.Add("class", "className");

or

cel1.Style.Add("background-color", "red");

Upvotes: 5

Related Questions