Hi Frndz,
Functionality: bold Gridview Column based on Condition
To achieve this task,
Added one hidden filed to Item Template for store read/Unread value
<asp:TemplateField HeaderText="Message">
<ItemTemplate>
<asp:HiddenField ID="hdfMessageStatus" runat="server" Value='<%# Eval("Status") %>' />
<asp:Label ID="lblMessage" runat="server" Text='<%# Eval("Message") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
Now get this hidden filed value in rowdataound event and check this hidded field value
Added RowDatabound event and set row font bold as following way
Full Logic :
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
HiddenField hdfMessageStatus = (HiddenField)e.Row.FindControl("hdfMessageStatus");
Label lblMessage = (Label)e.Row.FindControl("lblMessage");
if (hdfMessageStatus.Value == "read")
{
// Take Item Template then Find Control value and assign to Bold
lblMessage.Font.Bold = true;
// Take Bound Column then find Position of Bound filed value and set to Bold
e.Row.Cells[5].Font.Bold = true;
}
}
}
Hope this helpful!
Thanks