Help on Cell.Attributes ?

G

Guest

Dear all,

I ma preparing for my AS.NEt exam and I am trying to understand how to use
the

e.Cell.Attributes.Add within a datagrid.ItemDatabound event

I have an example where code is as follow:
e.Cell.Attributes.Add("class","HighlightedCell")

Could not see any effect....

Thnaks for your help
regards
serge
 
E

Eliyahu Goldin

The example looks fine. Check if you have a .HighlightedClass rule somewhere
in your style sheets.

Eliyahu
 
G

Guest

Thats maybe what ^have not understand
What do you mean by class rule ?
I did not check any style sheet ..:-(

It is linked to style sheet ?

Do you have a good link or document which explain all of that ?
How the Attributes and style sheet get links togeteher

serge
 
P

Patrice

Use "view source" to see the generated HTML code. The cell (that is a "td"
tag) should have a class attribute now...
 
E

Eliyahu Goldin

In your example HighlightedCell refers to a rule with matching name defined
somewhere in the style sheets available for the page. If you don't have, you
won't see any effect. That is what you are observing.

There are plenty online resources on stylesheets, search for them and read
what is appropriate for your desired level of understanding.

Attributes collection allows you to set any attributes for the control.
Attribute "class" is reserved for linking the control to a stylesheet rule
with matching name.

Eliyahu
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,431
Messages
2,571,677
Members
48,796
Latest member
Greg L.

Latest Threads

Top