473,326 Members | 2,133 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,326 software developers and data experts.

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

Hi,

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
  1.  
  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>
  29.  
Jul 11 '07 #1
0 1416

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

Similar topics

11
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...
6
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...
3
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...
4
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...
2
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 ?...
10
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...
11
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...
0
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 ....
0
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...
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...
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...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
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....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.