Class for rows:
public enum TypeEnum {
[Display(Name = "Type is expression.")]
EXPRESSION = 0,
[Display(Name = "Type is operator.")]
OPERATOR = 1
}
public class TmpParent
{
[Display(
ShortName = "Company",
Name = "Company Name",
Description = "The amount of currently available product",
AutoGenerateFilter = false)
]
public string str1 { get; set; }
[DataType(DataType.Text), StringLength(20, MinimumLength = 3)]
public string str2 { get; set; }
public bool bool1 { get; set; }
public TypeEnum enum1 { get; set; }
[DisplayFormat(DataFormatString = "MMMM/yyyy")]
public DateTime date1 { get; set; }
[DisplayFormat(DataFormatString = "p", ApplyFormatInEditMode = true)]
public float value1 { get; set; }
[DataType(DataType.Currency), Range(200, 5000), Required]
public float value2 { get; set; }
public TmpParent( string _s1, string _s2, bool _b, TypeEnum _enum = TypeEnum.EXPRESSION )
{
str1 = _s1;
str2 = _s2;
bool1 = _b;
enum1 = _enum;
date1 = DateTime.Now;
value1 = 100.1f;
value2 = 300.5f;
}
}
Grid fillings:
var p = new TmpParent( "A", "A", true ); list.Add( p ); list.Add( new TmpParent( "B", "B", false, TypeEnum.OPERATOR ) ); list.Add( new TmpParent( "C", "C", true ) ); list.Add( new TmpParent( "D", "D", false ) ); gridParent.DataSource = list;Output:

No comments:
Post a Comment