// //////////////////////////////////////////////////////////////////////// // PUBLIC METHODS // public PhoneTDS.PhoneDataTable GetPhonesNew() { phone = (PhoneTDS.PhoneDataTable)Session["phonesDummy"]; if (phone == null) { phone = ((PhoneTDS.PhoneDataTable)Session["phone"]); } return phone; }
protected void AddPhonesNewEmptyFix(GridView grdTelephones) { if (grdTelephones.Rows.Count == 0) { PhoneTDS.PhoneDataTable dt = new PhoneTDS.PhoneDataTable(); dt.AddPhoneRow(-1, -1, -1, "", "", "", false, false); Session["phonesDummy"] = dt; grdTelephones.DataBind(); } // Normally executes at all postbacks if (grdTelephones.Rows.Count == 1) { PhoneTDS.PhoneDataTable dt = (PhoneTDS.PhoneDataTable)Session["phonesDummy"]; if (dt != null) { grdTelephones.Rows[0].Visible = false; grdTelephones.Rows[0].Controls.Clear(); } } }
// //////////////////////////////////////////////////////////////////////// // EVENTS // protected void Page_Load(object sender, EventArgs e) { // Register client scripts this.RegisterClientScripts(); if (!IsPostBack) { // Security check // Tag Page hdfCompanyId.Value = Session["companyID"].ToString(); hdfContactId.Value = Request.QueryString["contact_id"].ToString(); // Initialize viewstate variables Session.Remove("phonesDummy"); phoneTDS = new PhoneTDS(); // Load data LoadFullName(); LoadAddress(); LoadPhones(); // Store dataset Session["phoneTDS"] = phoneTDS; Session["phone"] = phoneTDS.Phone; } else { // Restore dataset phoneTDS = (PhoneTDS)Session["phoneTDS"]; phone = phoneTDS.Phone; } }