protected void Page_Load(object sender, EventArgs e) { BatchChargesGridView.Columns.Clear(); BatchChargesGridView.InsertDataColumn("Type", "Type", CffGridViewColumnType.Text, "5%", "cffGGV_leftAlignedCell", HorizontalAlign.Left, HorizontalAlign.Left, true); BatchChargesGridView.InsertCurrencyColumn("Amount", "Amount", "5%", "cffGGV_currencyCell", false, HorizontalAlign.Right, HorizontalAlign.Right); BatchChargesGridView.InsertDataColumn("Description", "Description", CffGridViewColumnType.Text, "30%", "cffGGV_leftAlignedCell", HorizontalAlign.Left, HorizontalAlign.Left, true); //reused if (IsPostBack) { DisplayBatchCharges(ViewState["BatchCharges"] as IList <Charge>); } }
public void DisplayBatchCharges(IList <Charge> charges) { ViewState.Add("BatchCharges", charges); BatchChargesGridView.DataSource = charges; BatchChargesGridView.DataBind(); }