Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: 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 1:18am
Comments
jinnatara at 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
0 OriginalGriff 406
1 Marcin Kozub 225
2 Sergey Alexandrovich Kryukov 205
3 Raul Iloc 170
4 Maciej Los 164
0 OriginalGriff 8,289
1 Sergey Alexandrovich Kryukov 7,407
2 DamithSL 5,624
3 Maciej Los 4,989
4 Manas Bhardwaj 4,986


Advertise | Privacy | Mobile
Web02 | 2.8.1411023.1 | Last Updated 27 Mar 2013
Copyright © CodeProject, 1999-2014
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