Click here to Skip to main content
12,395,871 members (62,203 online)
Rate this:
 
Please Sign up or sign in to vote.
See more: C# C#4.0
<asp:GridView ID="grdEmployeePeripheral" runat="server"
                                    AutoGenerateColumns="False" BackColor="White" BorderColor="#999999"
                                    BorderStyle="None" BorderWidth="1px" CellPadding="3" GridLines="Vertical"
                                    HorizontalAlign="Center"
                                    onrowdatabound="grdEmployeePeripheral_RowDataBound">
                                    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                                    <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                                    <Columns>
 
                                        <asp:BoundField DataField="PeripheralType" HeaderText="PeripheralType"
                                            SortExpression="PeripheralType" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                        <asp:BoundField DataField="Specification" HeaderText="Specification"
                                            SortExpression="Specification" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                          <asp:BoundField DataField="Remarks" HeaderText="Remarks"
                                            SortExpression="Remarks" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                          <asp:BoundField DataField="Warrenty" HeaderText="Warrenty"
                                            SortExpression="Warrenty" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                         <asp:BoundField DataField="PurchaseDate" HeaderText="Purchase Date"
                                            SortExpression="PurchaseDate" DataFormatString="{0:dd-MMM-yyyy}" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
                                         <asp:BoundField DataField="PeripheralAssignDate" HeaderText="Peripheral AssignDate"
                                            SortExpression="PeripheralAssignDate" DataFormatString="{0:dd-MMM-yyyy}" >
                                            <HeaderStyle HorizontalAlign="Center" />
                                            <ItemStyle HorizontalAlign="Center" />
                                        </asp:BoundField>
 
                                    </Columns>
                                    <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                                    <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                                    <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
                                    <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                                    <AlternatingRowStyle BackColor="#DCDCDC" />
                                </asp:GridView>
Posted 27-Mar-13 0:18am
Comments
jinnatara 27-Mar-13 6:22am
   
I want to highlight warranty field when its warranty is expired. And it will be related with purchase date Column.Suppose one product buy about 6 months ago. its warrenty 6 months. it will bw red color when warrenty expired.
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

forecolour:"xxxxx" place this where ever u need to change colours..

SIMPLE
  Permalink  
Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 2

You've got solution here: How to give cell forecolour in a griedview using two columns value in condition[^]

Please, do not repost! If you have any question, use "Have a Question or Comment" widget.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Mobile
Web02 | 2.8.160721.1 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100