472,354 Members | 1,397 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

How to change color of cell in column if...


Im new in c# :)

I wonder how to change color of some cell if there is some criteria.

ie. if value in cell = John then color of that cell is Red

This very easy in PHP but c#.. :(

I need that on column:

Expand|Select|Wrap|Line Numbers
  1. <asp:BoundColumn DataField="ListName" HeaderText="List name" ></asp:BoundColumn>
here is my code:

Expand|Select|Wrap|Line Numbers
  2. <html xmlns="http://www.w3.org/1999/xhtml" >
  3. <head runat="server">
  4.     <title>List</title>
  5.     <link href="../b2a.css" rel="stylesheet" type="text/css" />
  6. </head>
  7. <body>
  8.         <form id="Form1" method="post" runat="server">
  9.             <table id="Table1" cellspacing="1" cellpadding="1" width="100%" border="0">
  10.                 <tr>
  11.                     <td></td>
  12.                 </tr>
  13.                 <tr>
  14.                     <td><asp:DataGrid id="dGrupe" runat="server" CssClass="nk" width="440px" autogeneratecolumns="False" OnCancelCommand="CancelItem" OnDeleteCommand="DeleteItem" OnEditCommand="EditItem" OnItemCommand="Select" OnItemDataBound="dgGrupe_ItemDataBound" OnUpdateCommand="UpdateItem">
  15.                             <SelectedItemStyle CssClass="kFooter"></SelectedItemStyle>
  16.                             <EditItemStyle CssClass="kFooter"></EditItemStyle>
  17.                             <alternatingitemstyle cssclass="nk2"></alternatingitemstyle>
  18.                             <itemstyle cssclass="n1"></itemstyle>
  19.                             <headerstyle cssclass="n" backcolor="#EBEBEB"></headerstyle>
  20.                             <columns>
  21.                                 <asp:BoundColumn Visible="False" DataField="IDListe" ReadOnly="True"></asp:BoundColumn>
  22.                                 <asp:BoundColumn DataField="ListName" HeaderText="List name" ></asp:BoundColumn>
  23.                                 <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
  24.                                 <asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
  25.                                 <asp:ButtonColumn Text="Select" CommandName="Select"></asp:ButtonColumn>
  26.                             </columns>
  27.                         </asp:DataGrid></td>
  28.                 </tr>
Jul 11 '07 #1
0 1362

Sign in to post your reply or Sign up for a free account.

Similar topics

by: SarahMarsden | last post by:
I'm new to Dreamweaver (using MX 2004). I have a 2 row 3 column table. I have set each column to 200 pixels. The second row I have merged into one cell. When I enter text (or anything else) into...
by: Barney Nicholls | last post by:
I have a datagrid and want to change the background color of the end column to denote that it is the only column that is not read only. I still want this column to be editable. I've found...
by: Richard | last post by:
I'm trying to change a value of a cell based on another before the grid is displayed. I'm using the ItemDataBound event like this for a simple test: Select Case e.Item.ItemType Case...
by: Roger | last post by:
I have a datagrid and would like to know what even fires when a cell is changed? I want to know when the user changes a cell and moves to the next. I have some code that needs to be done to...
by: Tommy | last post by:
Hi all, I use DataGridView in my form and add image column and 2 textbox column, and I want to change image column's image on runtime. But there is no any example on this function. What can I do ?...
by: rob | last post by:
I have a class that among others exposes a string property "Date". The date in this property is stored in the form yyyymmdd. Now I do the following 1) Generate a DataGridViewTextBoxColumn column...
by: free4trample | last post by:
First of all let me say that I know very little about javascript. what i need to do is to write a javascript functin which will change the background color of the table rows based on entrees in...
by: satish | last post by:
I have a table with two columns field1 int,Field2 and added a column to datagrid on runtime sum (field1+field2) ,upon changing the data in either of the fileds the sum field or column too changes ....
by: joinzulfi | last post by:
Dear fellows! I have designed a form having SaleMasterTable and SaleDetailTable. SaleDetailTable is Bounded with DataGrid. Now I want that if in2nd Column's cell (it is combobox) value is...
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. header("Location:".$urlback); Is this the right layout the...
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
by: Ricardo de Mila | last post by:
Dear people, good afternoon... I have a form in msAccess with lots of controls and a specific routine must be triggered if the mouse_down event happens in any control. Than I need to discover what...

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.