Hi all
try this example
Protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
// This line will get the reference to the underlying row
DataRowView _row = (DataRowView)e.Row.DataItem;
if (_row != null)
{
// get the field value which you want to compare and
// convert to the corresponding data type
// i assume the fieldName is of int type
int _field = Convert.ToInt32(_row.Row["fieldName"]);
if (_field == 7)
e.Row.BackColor = System.Drawing.Color.Green;
else
e.Row.BackColor = System.Drawing.Color.Red;
}
}
}
Good Luck
Friday, November 28, 2008
Friday, October 31, 2008
Validate Image Size using CustomValidator Control
Try this code in server side of CustomValidator
protected void CustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
if (IsValid)
{
int maxSize = 5 * 1024 * 1024;
if (FileUpload1.PostedFile.ContentLength > maxSize)
{
args.IsValid = false;
}
}
}
Good Luck
protected void CustomValidator_ServerValidate(object source, ServerValidateEventArgs args)
{
if (IsValid)
{
int maxSize = 5 * 1024 * 1024;
if (FileUpload1.PostedFile.ContentLength > maxSize)
{
args.IsValid = false;
}
}
}
Good Luck
Subscribe to:
Posts (Atom)

