Help on Cell.Attributes ?

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
The example looks fine. Check if you have a .HighlightedClass rule somewhere
in your style sheets.

Eliyahu
 
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
 
Use "view source" to see the generated HTML code. The cell (that is a "td"
tag) should have a class attribute now...
 
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
 
Back
Top