protected void GvContactDetail_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "AddNew") { TextBox Name = (TextBox)GvContactDetail.FooterRow.FindControl("txtFcontactName"); TextBox Designation = (TextBox)GvContactDetail.FooterRow.FindControl("txtFdesignation"); TextBox Phone = (TextBox)GvContactDetail.FooterRow.FindControl("txtFphone"); TextBox Mobile = (TextBox)GvContactDetail.FooterRow.FindControl("txtFMobile"); TextBox Email = (TextBox)GvContactDetail.FooterRow.FindControl("txtFEmail"); TextBox DateOfBirth = (TextBox)GvContactDetail.FooterRow.FindControl("txtFDob"); TextBox DateOfAniversary = (TextBox)GvContactDetail.FooterRow.FindControl("txtFDoA"); if (dtContact.Columns.Count == 0) { dtContact.Columns.Add("ContactName"); dtContact.Columns.Add("Designation"); dtContact.Columns.Add("Phone1"); dtContact.Columns.Add("Mobile"); dtContact.Columns.Add("Email"); dtContact.Columns.Add("DoB"); dtContact.Columns.Add("DoA"); } DataRow drow; drow = dtContact.NewRow(); drow["ContactName"] = Name.Text; drow["Designation"] = Designation.Text; drow["Phone1"] = Phone.Text; drow["Mobile"] = Mobile.Text; drow["Email"] = Email.Text; drow["DoB"] = DateOfBirth.Text; drow["DoA"] = DateOfAniversary.Text; dtContact.Rows.Add(drow); Session["ContactDetail"] = dtContact; GvContactDetail.DataSource = dtContact; dtContact = (DataTable)Session["ContactDetail"]; GvContactDetail.DataBind(); } }
public void bindContactGrid() { DataTable dtlocation = new DataTable(); DataColumn dtId = new DataColumn("ContactName", typeof(System.String)); dtlocation.Columns.Add(dtId); DataColumn dtdesignation = new DataColumn("Designation", typeof(System.String)); dtlocation.Columns.Add(dtdesignation); DataColumn dtphone = new DataColumn("Phone1", typeof(System.String)); dtlocation.Columns.Add(dtphone); DataColumn dtName = new DataColumn("Mobile", typeof(System.String)); dtlocation.Columns.Add(dtName); DataColumn dtFromDate = new DataColumn("Email", typeof(System.String)); dtlocation.Columns.Add(dtFromDate); DataColumn dtSGST = new DataColumn("DoB", typeof(System.String)); dtlocation.Columns.Add(dtSGST); DataColumn dtCGST = new DataColumn("DoA", typeof(System.String)); dtlocation.Columns.Add(dtCGST); dtrow = dtlocation.NewRow(); dtlocation.Rows.Add(dtrow); GvContactDetail.DataSource = dtlocation; GvContactDetail.DataBind(); }
protected void GvContactDetail_RowDeleting(object sender, GridViewDeleteEventArgs e) { dtContact.Rows.RemoveAt(e.RowIndex); GvContactDetail.DataSource = dtContact; GvContactDetail.DataBind(); }
public void LoadDataForEdit() { DataSet ds = new DataSet(); List <ParaList> para = new List <ParaList>() { new ParaList { Key = "@i_RecID", Value = leadId }, }; ds = crmclient.Select(para, "Lead"); if (ds.Tables[0].Rows.Count > 0) { txtCode.Text = ds.Tables[0].Rows[0]["LeadNo"].ToString(); txtDate.Text = ds.Tables[0].Rows[0]["LeadDate"].ToString(); // txtcurrentStock.Text = ds.Tables[0].Rows[0]["QOH"].ToString(); drpApptaken.SelectedValue = ds.Tables[0].Rows[0]["Apptaken"].ToString(); drpAllocated.SelectedValue = ds.Tables[0].Rows[0]["AllocatedToEmpID"].ToString(); txtcustomerName.Text = ds.Tables[0].Rows[0]["CustomerName"].ToString(); txtContactPerson.Text = ds.Tables[0].Rows[0]["ContactPerson"].ToString(); txtAddressline1.Text = ds.Tables[0].Rows[0]["Address1"].ToString(); txtAddressline2.Text = ds.Tables[0].Rows[0]["Address2"].ToString(); drpCity.Text = ds.Tables[0].Rows[0]["CityID"].ToString(); drpState.Text = ds.Tables[0].Rows[0]["stateid"].ToString(); drpCountry.Text = ds.Tables[0].Rows[0]["countryid"].ToString(); drpArea.Text = ds.Tables[0].Rows[0]["AreaID"].ToString(); txtPincode.Text = ds.Tables[0].Rows[0]["Pincode"].ToString(); txtMobile.Text = ds.Tables[0].Rows[0]["MobileNo"].ToString(); txtPhone1.Text = ds.Tables[0].Rows[0]["Phone1"].ToString(); txtEmail.Text = ds.Tables[0].Rows[0]["Email"].ToString(); drpCategory.SelectedValue = ds.Tables[0].Rows[0]["Category"].ToString(); txtWebsite.Text = ds.Tables[0].Rows[0]["Website"].ToString(); drpSourceOfInq.SelectedItem.Text = ds.Tables[0].Rows[0]["SourceOfLead"].ToString(); drpInqStatus.SelectedItem.Text = ds.Tables[0].Rows[0]["InterestLevel"].ToString(); txtbudget.Text = ds.Tables[0].Rows[0]["CustomerBudget"].ToString(); txtNextFolowUp.Text = ds.Tables[0].Rows[0]["NextFollowUpDate"].ToString(); //txtProSerReq.Text = ds.Tables[0].Rows[0][""].ToString(); txtRemarks.Text = ds.Tables[0].Rows[0]["Remarks"].ToString(); txtgstinno.Text = ds.Tables[0].Rows[0]["Gstin"].ToString(); txtPanNo.Text = ds.Tables[0].Rows[0]["PanCard"].ToString(); } DataSet dscontact = new DataSet(); List <ParaList> para1 = new List <ParaList>() { new ParaList { Key = "@i_RefID", Value = leadId.ToString() }, new ParaList { Key = "@i_CompId", Value = CurrentUser.CompId }, }; dscontact = crmclient.list(para1, "ContactDetail"); if (dscontact.Tables[0].Rows.Count > 0) { GvContactDetail.DataSource = dscontact; GvContactDetail.DataBind(); } Session["ContactDetail"] = dscontact.Tables[0]; btnSubmitInq.Text = "Update"; btnCancel.Visible = false; }