You are on page 1of 1

1.

To DISPLAY THE ROW WHICH IS NULL/DOC MISSING /VALUES WITH COLOR


ROW.
- CODE BEHIND IN .CS FILE
protected void gv_Doc_RowDataBound(object sender,
GridViewRowEventArgs e)
{
DataRowView drv=(DataRowView)e.Row.DataItem;
System.Web.UI.WebControls.Label lblStatus =
e.Row.FindControl("lbtn1") as System.Web.UI.WebControls.Label;
if (e.Row.RowType == DataControlRowType.DataRow)
{
if (e.Row.FindControl("lbtn1") != null)
{
if (Convert.ToString(drv["Doc_Title"])=="missing
title")
{
e.Row.ForeColor = System.Drawing.Color.Green;
lblStatus.ForeColor = System.Drawing.Color.Red;
e.Row.BackColor = System.Drawing.Color.Gold;
}
}
}

}
2. CODE BEHIND IN .HTML FILE
<Columns>
<asp:BoundField DataField="Doc_Id" HeaderText=" ID "/>
<asp:BoundField DataField="Doc_DocumentNo" HeaderText=" Doc No "/>
<asp:BoundField DataField="Doc_Title" HeaderText=" Title " />
<asp:TemplateField>
<HeaderTemplate> Title </HeaderTemplate>
<ItemTemplate>
<%--<%#HighlightText(TextBox1.Text,(string)Eval("Doc_Title"))
%>--%>
<%-- <%#HighlightRow(TextBox1.Text,(string)Eval("Doc_Title"))
%>--%>
<asp:Label ID="lbtn1" runat="server"><%#Eval("Doc_Title")
%></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:BoundField DataField="Doc_Id" HeaderText=" Available
"/> --%>
</Columns>
3.

You might also like