protected void btnAtAdd_Click(object sender, EventArgs e)
    {
        DataTable dt = new DataTable();

        lblAtErrorMsg.Text = "";
        if (ViewState["AtTable"] == null)
        {
            dt.Columns.Add("PlaceOfSupplyCode");
            dt.Columns.Add("Place Of Supply");
            dt.Columns.Add("Rate");
            dt.Columns.Add("Gross Advance Received");
            dt.Columns.Add("Cess Amount");
        }
        else
        {
            dt = (DataTable)ViewState["AtTable"];
        }

        DataRow dr = dt.NewRow();



        dr["PlaceOfSupplyCode"] = ddlAtPlaceOfSupply.Text;
        dr["Place Of Supply"]   = ddlAtPlaceOfSupply.SelectedItem.Text;
        dr["Rate"] = ddltxtAtRate.SelectedItem.Text.ToString();
        dr["Gross Advance Received"] = txtAtGrossAdvReceived.Text.Trim();
        dr["Cess Amount"]            = txtAtCessAmount.Text.Trim() == "" ? "0" : txtAtCessAmount.Text.Trim();


        dt.Rows.Add(dr);
        ViewState["AtTable"] = dt;
        GridAt.DataSource    = dt;
        GridAt.DataBind();
        ClearAt();
    }
Beispiel #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=db_asistencia;User ID=sa;Password=admin08");

                con.Open();
                string         com  = "Select dept_name,dept_id from tbl_department";
                SqlDataAdapter adpt = new SqlDataAdapter(com, con);
                DataTable      dt   = new DataTable();
                adpt.Fill(dt);
                ddlDept.DataSource     = dt;
                ddlDept.DataTextField  = "dept_name";
                ddlDept.DataValueField = "dept_id";
                ddlDept.DataBind();

                string         com1  = "Select sem_id,sem_name from tbl_semester ";
                SqlDataAdapter adpt1 = new SqlDataAdapter(com1, con);
                DataTable      dt1   = new DataTable();
                adpt1.Fill(dt1);
                GridAt.DataSource = dt1;
                GridAt.DataBind();
                con.Close();
            }
        }
 protected void GridAt_RowCommand(object sender, GridViewCommandEventArgs e)
 {
     if (e.CommandName == "DeleteRecords")
     {
         DataTable AtTable = (DataTable)ViewState["AtTable"];
         AtTable.Rows.RemoveAt(int.Parse(e.CommandArgument.ToString()));
         ViewState["AtTable"] = AtTable;
         GridAt.DataSource    = AtTable;
         GridAt.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();
    }