Question about DataGrid ItemStyle

L

leodippolito

Hello sirs,


In my aspx file I have a datagrid with some BoundColumn's. When a
format has been defined for a column (for colors, horizontal alignment,
etc), it adds an ItemStyle element inside the bound column element, as
in this example:


<asp:BoundColumn DataField="DEEMAIL" SortExpression="DEEMAIL"
HeaderText="DEEMAIL">
<ItemStyle ForeColor="Green"></ItemStyle>
</asp:BoundColumn>


When a format has not been defined, the bound column element doesn't
have this ItemStyle element (well, that's kind of obvious):


<asp:BoundColumn DataField="NUCPF" SortExpression="NUCPF"
HeaderText="NUCPF"></asp:Bound*Column>


My question is: programmatically (in the .cs file), how can I check if
an ItemStyle has been defined for a given column?


I searched high and low but couldn't find an answer.


I appreciate any help on this issue.


LD
 
Last edited by a moderator:
S

Scott Allen

Hi Leonardo:

Just navigate in code like you would in the ASPX markup, I think it
might seem intuitive once you think of the object model that way.

TableItemStyle style = DataGrid1.Columns[0].ItemStyle;

style.BackColor = System.Drawing.Color.Green;

HTH,
 
Last edited by a moderator:

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

Similar Threads


Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top