private void SetInitialRow() { DataTable dt = new DataTable(); DataRow dr; dt.Columns.Add("#", typeof(Int32)); dt.Columns.Add("Title", typeof(string)); dt.Columns.Add("TDescptn", typeof(string)); dt.Columns.Add("select", typeof(bool)); dr = dt.NewRow(); dr["#"] = 0; dr["Title"] = ""; dr["select"] = false; dr["TDescptn"] = ""; dt.Rows.Add(dr); ViewState["TermsTable"] = dt; GridTermCond.DataSource = dt; GridTermCond.DataBind(); }
protected void img_btn_Add_Click(object sender, ImageClickEventArgs e) { try { int rowIndex = 0; if (ViewState["TermsTable"] != null) { DataTable dtCurrentTableTACForVIEW = (DataTable)ViewState["TermsTable"]; DataRow drCurrentRow = null; //DataRow drCurrentRow; if (dtCurrentTableTACForVIEW.Rows.Count > 0) { for (int i = 0; i <= dtCurrentTableTACForVIEW.Rows.Count - 1; i++) { //extract the values dtCurrentTableTACForVIEW.Rows[rowIndex]["#"] = ((Label)GridTermCond.Rows[rowIndex].Cells[0].FindControl("LblEntryId")).Text; //Convert.ToInt32(GridLookUp.Rows[rowIndex].Cells[0].Text); dtCurrentTableTACForVIEW.Rows[rowIndex]["select"] = ((CheckBox)GridTermCond.Rows[rowIndex].Cells[1].FindControl("GrdSelectAll")).Checked; dtCurrentTableTACForVIEW.Rows[rowIndex]["Title"] = ((TextBox)GridTermCond.Rows[rowIndex].Cells[3].FindControl("GrtxtTermCondition_Head")).Text; dtCurrentTableTACForVIEW.Rows[rowIndex]["TDescptn"] = ((TextBox)GridTermCond.Rows[rowIndex].Cells[4].FindControl("GrtxtDesc")).Text; rowIndex++; } drCurrentRow = dtCurrentTableTACForVIEW.NewRow(); drCurrentRow["#"] = 0; drCurrentRow["select"] = false; drCurrentRow["Title"] = ""; drCurrentRow["TDescptn"] = ""; dtCurrentTableTACForVIEW.Rows.Add(drCurrentRow); ViewState["TermsTable"] = dtCurrentTableTACForVIEW; GridTermCond.DataSource = dtCurrentTableTACForVIEW; GridTermCond.DataBind(); } } else { obj_Comman.ShowPopUpMsg("Page Not Proper Load From Server...", this.Page); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public void BINDREPORTGRID() { try { DataSet Ds = new DataSet(); Ds = Obj_SupplierMaster.GetTerms(out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { GridTermCond.DataSource = Ds.Tables[0]; GridTermCond.DataBind(); ViewState["TermsTable"] = Ds.Tables[1]; } else { GridTermCond.DataSource = null; GridTermCond.DataBind(); SetInitialRow(); } Ds = null; } catch (Exception ex) { throw new Exception(ex.Message); } }
protected void GrdReport_ItemCommand(object source, RepeaterCommandEventArgs e) { try { switch (e.CommandName) { case ("Select"): { if (Convert.ToInt32(e.CommandArgument) != 0) { ViewState["EditID"] = Convert.ToInt32(e.CommandArgument); Ds = Obj_SupplierMaster.GetSupplierForEdit(Convert.ToInt32(e.CommandArgument), out StrError); if (Ds.Tables.Count > 0 && Ds.Tables[0].Rows.Count > 0) { TxtSuppCode.Text = Ds.Tables[0].Rows[0]["CustomerCode"].ToString(); TxtSuppName.Text = Ds.Tables[0].Rows[0]["CustomerName"].ToString(); TxtSuppAddress.Text = Ds.Tables[0].Rows[0]["Address"].ToString(); TxtTelNo.Text = Ds.Tables[0].Rows[0]["TelNo"].ToString(); TxtMobile.Text = Ds.Tables[0].Rows[0]["MobileNo"].ToString(); TxtEmail.Text = Ds.Tables[0].Rows[0]["Email"].ToString(); TxtNotes.Text = Ds.Tables[0].Rows[0]["Note"].ToString(); //-------Newly Added Fields------- TxtWebsite.Text = Ds.Tables[0].Rows[0]["WebSite"].ToString(); TxtPerName.Text = Ds.Tables[0].Rows[0]["PersonName"].ToString(); TxtDesignation.Text = Ds.Tables[0].Rows[0]["PDesignation"].ToString(); TxtContPerMobileNo.Text = Ds.Tables[0].Rows[0]["PMobileNo"].ToString(); TxtContPerEmail.Text = Ds.Tables[0].Rows[0]["PEmailId"].ToString(); TxtContPerWebsite.Text = Ds.Tables[0].Rows[0]["PWebsite"].ToString(); TxtSTRN.Text = Ds.Tables[0].Rows[0]["STaxRegNo"].ToString(); lblSerTaxNopath.Text = Ds.Tables[0].Rows[0]["ImgTaxRegNoPath"].ToString(); ImgTaxRegNoPath.ImageUrl = lblSerTaxNopath.Text; if (!string.IsNullOrEmpty(Ds.Tables[0].Rows[0]["StateID"].ToString())) { ddlState.SelectedValue = Ds.Tables[0].Rows[0]["StateID"].ToString(); } else { ddlState.SelectedValue = "0"; } //TxtSTJ.Text = Ds.Tables[0].Rows[0]["STaxJurisdiction"].ToString(); //TxtVatNo.Text = Ds.Tables[0].Rows[0]["VATNo"].ToString(); //TxtTINNO.Text = Ds.Tables[0].Rows[0]["TINNo"].ToString(); //TxtCSTRN.Text = Ds.Tables[0].Rows[0]["CentralSaleTaxRagNo"].ToString(); //TxtExciseRange.Text = Ds.Tables[0].Rows[0]["ExciseRange"].ToString(); //TxtExciseDivision.Text = Ds.Tables[0].Rows[0]["ExciseDivision"].ToString(); //TxtExciseCircle.Text = Ds.Tables[0].Rows[0]["ExciseCircle"].ToString(); //TxtExciseZone.Text = Ds.Tables[0].Rows[0]["ExciseZone"].ToString(); //TxtExciseCollectorate.Text = Ds.Tables[0].Rows[0]["ExciseCollectorate"].ToString(); //TxtExciseECCNO.Text = Ds.Tables[0].Rows[0]["ExciseECCNO"].ToString(); //TxtTINBINNO.Text = Ds.Tables[0].Rows[0]["TIN_BINNo"].ToString(); TxtPanNo.Text = Ds.Tables[0].Rows[0]["PANNo"].ToString(); lblPanNo.Text = Ds.Tables[0].Rows[0]["ImgPanNoPath"].ToString(); ImgPanNoPath.ImageUrl = lblPanNo.Text; TxtTDSCertificate.Text = Ds.Tables[0].Rows[0]["TDSCertificate"].ToString(); if (Ds.Tables[1].Rows.Count > 0) { GridTermCond.DataSource = Ds.Tables[1]; GridTermCond.DataBind(); ViewState["TermsTable"] = Ds.Tables[1]; } else { GridTermCond.DataSource = null; GridTermCond.DataBind(); SetInitialRow(); } } else { MakeEmptyForm(); } Ds = null; Obj_SupplierMaster = null; if (!FlagEdit) { BtnUpdate.Visible = true; } BtnSave.Visible = false; if (!FladDel) { BtnDelete.Visible = true; } TxtSuppCode.Focus(); } break; } } } catch (Exception ex) { throw new Exception(ex.Message); } }