protected void btnAtAdjAdd_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); lblAtAdjErrorMsg.Text = ""; if (ViewState["AtAdjTable"] == null) { dt.Columns.Add("PlaceOfSupplyCode"); dt.Columns.Add("Place Of Supply"); dt.Columns.Add("Rate"); dt.Columns.Add("Gross Advance Adjusted"); dt.Columns.Add("Cess Amount"); } else { dt = (DataTable)ViewState["AtAdjTable"]; } DataRow dr = dt.NewRow(); dr["PlaceOfSupplyCode"] = ddlATADJPlaceOfSupply.Text; dr["Place Of Supply"] = ddlATADJPlaceOfSupply.SelectedItem.Text; dr["Rate"] = ddltxtAtAdjRate.SelectedItem.Text.ToString(); dr["Gross Advance Adjusted"] = txtAtAdjGrossAdvAdjusted.Text.Trim(); dr["Cess Amount"] = txtAtAdjCessAmount.Text.Trim() == "" ? "0" : txtAtAdjCessAmount.Text.Trim(); dt.Rows.Add(dr); ViewState["AtAdjTable"] = dt; GridAtAdj.DataSource = dt; GridAtAdj.DataBind(); ClearAtAdj(); }
protected void GridAtAdj_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRecords") { DataTable AtAdjTable = (DataTable)ViewState["AtAdjTable"]; AtAdjTable.Rows.RemoveAt(int.Parse(e.CommandArgument.ToString())); ViewState["AtAdjTable"] = AtAdjTable; GridAtAdj.DataSource = AtAdjTable; GridAtAdj.DataBind(); } }
protected void clearGrid() // clear all grid or view state all tab data { grdB2B.DataSource = null; grdB2B.DataBind(); GridB2cl.DataSource = null; GridB2cl.DataBind(); GridB2cs.DataSource = null; GridB2cs.DataBind(); GridCdnr.DataSource = null; GridCdnr.DataBind(); GridCdnur.DataSource = null; GridCdnur.DataBind(); GridExp.DataSource = null; GridExp.DataBind(); GridAt.DataSource = null; GridAt.DataBind(); GridAtAdj.DataSource = null; GridAtAdj.DataBind(); GridHsn.DataSource = null; GridHsn.DataBind(); GridExeMp.DataSource = null; GridExeMp.DataBind(); GridDocs.DataSource = null; GridDocs.DataBind(); ViewState["B2BTable"] = null; ViewState["B2ClTable"] = null; ViewState["B2CSTable"] = null; ViewState["CDNRTable"] = null; ViewState["CDNURTable"] = null; ViewState["ExpTable"] = null; ViewState["AtTable"] = null; ViewState["AtAdjTable"] = null; ViewState["HsnTable"] = null; ViewState["ExeMpTable"] = null; ViewState["DocsTable"] = null; ClearB2B(); ClearB2cl(); ClearB2cs(); ClearCdnur(); ClearExp(); ClearAt(); ClearDocs(); ClearAtAdj(); ClearExeMp(); ClearHsn(); ClearCdnr(); }