Click here to Skip to main content
15,905,563 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<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>





C#
<pre lang="c#">
Posted
Updated 23-Mar-13 1:18am
v2
Comments
CHill60 23-Mar-13 8:37am    
And your question is??

1 solution

If i understand you well... use GridView.OnRowDataBound[^] event.

ASP.NET
<asp:gridview id="grdEmployeePeripheral" runat="server" onrowdatabound="RowDataBound" xmlns:asp="#unknown">
<!---...  -->
</asp:gridview>


C#
protected void RowDataBound(Object sender, GridViewRowEventArgs e)
{
    if(e.Row.RowType == DataControlRowType.DataRow)
    {
        if(e.Row.Cells[0].Text == "Emp" && e.Row.Cells[1].Text == "No")
                e.Row.Cells[0].ForeColor = Color.Red;
    }
}
 
Share this answer
 
Comments
Sandeep Mewara 24-Mar-13 12:25pm    
My 5! :)
Maciej Los 24-Mar-13 12:31pm    
Thank you, Sandeep ;)

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900