//protected void ddlSetReminder_OnSelectedIndexChanged(object sender, EventArgs e) //{ // DropDownList ddlSetReminder = fviewWTE.FindControl("ddlSetReminder") as DropDownList; // if (ddlSetReminder.SelectedValue == "true") // { // //enable the other reminder params // (fviewWTE.FindControl("pnlReminders") as Panel).Visible = true; // //txtNextReminderDate // //TextBox t = (fviewWTE.FindControl("txtNextReminderDate") as TextBox); // //RequiredFieldValidator r = (fviewWTE.FindControl("rfv") as RequiredFieldValidator); // //r.ControlToValidate = (t.ID.ToString()); // //r.Display = ValidatorDisplay.Dynamic; // //r.ValidationGroup = "valAddWTE"; // //r.ErrorMessage = "add"; // //fviewWTE.Controls.Add(r); // } // else // { // (fviewWTE.FindControl("pnlReminders") as Panel).Visible = false; // } //} protected void gviewWTE_OnRowDeleting(object sender, GridViewDeleteEventArgs e) { int index = e.RowIndex; //delete the wte int wteID = Convert.ToInt32((gviewWTE.Rows[index].FindControl("hdnWTEID") as HiddenField).Value); WTEManager.DeleteWTE(wteID); //display the gridview DisplayWTE(); }
protected void gviewWTE_RowEditing(object sender, GridViewEditEventArgs e) { //show the modal popup //load the formview //get the id int wteID = Convert.ToInt32((gviewWTE.Rows[e.NewEditIndex].FindControl("hdnWTEID") as HiddenField).Value.ToString()); WaterTreatmentEquipment wte = WTEManager.GetByWTEID(wteID); WaterTreatmentEquipmentList wteList = new WaterTreatmentEquipmentList(); wteList.Add(wte); fviewUpdateWTE.DataSource = wteList; fviewUpdateWTE.DataBind(); this.modPopUpShowUpdateWTE.Show(); }
protected void lnkUpdateWTE_OnCommand(object sender, CommandEventArgs e) { //get details from formview hdnWteID WaterTreatmentEquipment w = new WaterTreatmentEquipment(); w.WTE_ID = Convert.ToInt32((fviewUpdateWTE.FindControl("hdnWteID") as HiddenField).Value.ToString()); w.Description = (fviewUpdateWTE.FindControl("txtDescription") as TextBox).Text; w.Manufacturer = (fviewUpdateWTE.FindControl("txtManufacturer") as TextBox).Text; w.ProductCode = (fviewUpdateWTE.FindControl("txtProductCode") as TextBox).Text; w.DateObtained = Convert.ToDateTime((fviewUpdateWTE.FindControl("txtDateObtained") as TextBox).Text); w.ModifiedBy = User.Identity.Name.ToString(); //update the record WTEManager.Save(w); //re-display the gridview DisplayWTE(); }
protected void lnkAddWTE_OnCommand(object sender, CommandEventArgs e) { //add record to db //get date from form WaterTreatmentEquipment w = new WaterTreatmentEquipment(); w.AccountID = _accountID; w.ProductCode = (fviewWTE.FindControl("txtProductCode") as TextBox).Text; w.Description = (fviewWTE.FindControl("txtDescription") as TextBox).Text; w.Manufacturer = (fviewWTE.FindControl("txtManufacturer") as TextBox).Text; w.DateObtained = Convert.ToDateTime((fviewWTE.FindControl("txtDateObtained") as TextBox).Text); w.CreatedBy = User.Identity.Name.ToString(); w.WTE_ID = WTEManager.Save(w); ClearWTEFields(); //populate the gridview DisplayWTE(); }
private void DisplayWTE() { gviewWTE.DataSource = WTEManager.GetListByAccountID(_accountID); gviewWTE.DataBind(); }