Wednesday, 22 February 2012

Chaging color of one of the column in Gridview in asp.net using c#

protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
Label payment = e.Row.FindControl("Label16") as Label;
if(payment.Text=="incomplete")
payment.ForeColor = System.Drawing.Color.Red;
else
payment.ForeColor = System.Drawing.Color.Lime;
LinkButton l = (LinkButton)e.Row.FindControl("linkdelete");

l.Attributes.Add("onclick", "javascript:return " +
"confirm('Are you sure you want to delete this record " +
DataBinder.Eval(e.Row.DataItem, "ImgFrontID") + "')");

}

}

No comments:

Post a Comment