protected void LinkButton_Click(object sender, EventArgs e)
        {
            LinkButton lb = (LinkButton)sender;

            GridViewRow gvRow = (GridViewRow)lb.NamingContainer;

            int rowID = gvRow.RowIndex;

            if (ViewState["CurrentData"] != null)
            {
                DataTable dt = (DataTable)ViewState["CurrentData"];

                if (dt.Rows.Count > 0)
                {
                    dt.Rows.RemoveAt(rowID);
                }
                ViewState["CurrentData"] = dt;
                int count = dt.Rows.Count;

                for (int i = 0; i < count; i++)
                {
                }

                GvJrEntry.DataSource = dt;
                GvJrEntry.DataBind();
                ActionPanleVisibolity();
            }
        }
Example #2
0
 protected void GvJrEntry_PageIndexChanging(object sender, GridViewPageEventArgs e)
 {
     GvJrEntry.PageIndex = e.NewPageIndex;
     if (ViewState["CurrentData"] != null)
     {
         GvJrEntry.DataSource = (DataTable)ViewState["CurrentData"];
         GvJrEntry.DataBind();
     }
     GvJrEntry.DataBind();
 }
        public void CLearContorl()
        {
            this.ViewState["CurrentData"] = null;
            DataTable dt = new DataTable();

            GvJrEntry.DataSource = dt;
            GvJrEntry.DataBind();
            PnlAction.Visible            = false;
            RbtJournalType.SelectedIndex = 0;
            lblCheckDRC_R.Visible        = false;
            pagingLoal();
            txtTransectionDate.Text = "Today";
        }
Example #4
0
        private void BindGrid(int rowcount)
        {
            DataTable dt = new DataTable();
            DataRow   dr;

            dt.Columns.Add(new System.Data.DataColumn("JournalId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("JournalType", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("COAId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("COAName_Num", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("SubCode2Id", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("SubCode2Name_Num", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("Amount", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("VONO", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("MRNO", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("SubVoucherId", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("SubVoucherCodeName", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("Remarks", typeof(String)));
            dt.Columns.Add(new System.Data.DataColumn("TransectionNO", typeof(String)));

            if (ViewState["CurrentData"] != null)
            {
                for (int i = 0; i < rowcount + 1; i++)
                {
                    dt = (DataTable)ViewState["CurrentData"];
                    if (dt.Rows.Count > 0)
                    {
                        dr    = dt.NewRow();
                        dr[0] = dt.Rows[0][0].ToString();
                    }
                }

                dr     = dt.NewRow();
                dr[0]  = HFJournalID.Value;
                dr[1]  = RbtJournalType.SelectedItem.ToString();
                dr[2]  = ddlCOA_DR.SelectedValue.ToString();
                dr[3]  = ddlCOA_DR.SelectedItem.ToString();
                dr[4]  = ddlSubcode2_DR.SelectedValue.ToString();
                dr[5]  = ddlSubcode2_DR.SelectedItem.ToString();
                dr[6]  = txtDRAmount.Text;
                dr[7]  = txtVoucherNo.Text.ToString();
                dr[8]  = txtMRNO.Text;
                dr[9]  = ddlSubVoucher.SelectedValue.ToString();
                dr[10] = ddlSubVoucher.SelectedItem.ToString();
                dr[11] = txtRemarksDR.Text.ToString();
                dr[12] = HFTransectionNo.Value;

                dt.Rows.Add(dr);
            }
            else
            {
                dr     = dt.NewRow();
                dr[0]  = HFJournalID.Value;
                dr[1]  = RbtJournalType.SelectedItem.ToString();
                dr[2]  = ddlCOA_DR.SelectedValue.ToString();
                dr[3]  = ddlCOA_DR.SelectedItem.ToString();
                dr[4]  = ddlSubcode2_DR.SelectedValue.ToString();
                dr[5]  = ddlSubcode2_DR.SelectedItem.ToString();
                dr[6]  = txtDRAmount.Text;
                dr[7]  = txtVoucherNo.Text.ToString();
                dr[8]  = txtMRNO.Text;
                dr[9]  = ddlSubVoucher.SelectedValue.ToString();
                dr[10] = ddlSubVoucher.SelectedItem.ToString();
                dr[11] = txtRemarksDR.Text.ToString();
                dr[12] = HFTransectionNo.Value;
                dt.Rows.Add(dr);
            }
            if (ViewState["CurrentData"] != null)
            {
                GvJrEntry.DataSource = (DataTable)ViewState["CurrentData"];
                GvJrEntry.DataBind();
            }
            else
            {
                GvJrEntry.DataSource = dt;
                GvJrEntry.DataBind();
            }
            ViewState["CurrentData"] = dt;
        }