473,320 Members | 1,862 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,320 software developers and data experts.

Question about DataGrid ItemStyle

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.
Leonardo D'Ippolito

Nov 19 '05 #1
1 1094
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,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On 29 Apr 2005 04:49:15 -0700, le**********@gmail.com wrote:
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.
Leonardo D'Ippolito


Nov 19 '05 #2

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

Similar topics

2
by: David Stephen | last post by:
I'd like to use a datagrid to display a result from a datatable but based on the data I'd like to display rows with merged cells is a new type of heading across a couple of standard cells or a...
0
by: shamila | last post by:
</asp:label><asp:datagrid id="DataGrid3" runat="server" cssclass="DataGrid" showfooter="True" onupdatecommand="DataGrid3_Update"ondeletecommand="DataGrid3_Delete" oneditcommand="DataGrid3_Edit"...
3
by: D. Shane Fowlkes | last post by:
I have a Datagrid which in theory, should allow you to edit and update the records. I've stripped my test page down so that it's only attempting to update one field - "description". Yet when I...
1
by: VB Programmer | last post by:
I have a datagrid which is bound to a datatable that I create on the fly. How do I set the width of each column via code? Ex: Column 1 is always 100, Column 2 is always 250, etc... Thanks!
5
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go...
2
by: Luis Esteban Valencia Muñoz | last post by:
I have a datagrid that displays editable text fields (2 different price fields) and a checkbox in every row. It has a "SaveChanges" button at the bottom, which, when pressed, looks at every...
2
by: Ray Booysen | last post by:
Hi all I have a collection of Invoices that I bind to a datagrid. Some of these invoices have been processed and you can tell this via a property in the invoice class called DateProcessed. If...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
0
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the...
5
by: tshad | last post by:
I have a datagrid that I cannot get to right justify a money amount (which is just a label). No matter what I do - it still right justifies it. <asp:TemplateColumn Visible="true"...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.