protected void btnExeMpAdd_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); lblAtAdjErrorMsg.Text = ""; if (ViewState["ExeMpTable"] == null) { dt.Columns.Add("Description"); dt.Columns.Add("Nil Rated Supplies"); dt.Columns.Add("Exempted (other than nil rated/non GST supply )"); dt.Columns.Add("Non-GST supplies"); } else { dt = (DataTable)ViewState["ExeMpTable"]; } DataRow dr = dt.NewRow(); dr["Description"] = ddlExeMpDescription.SelectedItem.Text.Trim(); dr["Nil Rated Supplies"] = txtExeMpNillRatedSupply.Text.Trim(); dr["Exempted (other than nil rated/non GST supply )"] = txtExeMpExempted.Text.ToString(); dr["Non-GST supplies"] = txtExeMpNonGstSupply.Text.Trim(); dt.Rows.Add(dr); ViewState["ExeMpTable"] = dt; GridExeMp.DataSource = dt; GridExeMp.DataBind(); ClearExeMp(); }
protected void GridExeMp_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "DeleteRecords") { DataTable ExeMpTable = (DataTable)ViewState["ExeMpTable"]; ExeMpTable.Rows.RemoveAt(int.Parse(e.CommandArgument.ToString())); ViewState["ExeMpTable"] = ExeMpTable; GridExeMp.DataSource = ExeMpTable; GridExeMp.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(); }