protected bool ViewEdit() { if (gvProcess.SelectedIndex == -1) { ClientScript.RegisterStartupScript(GetType(), "Message", "<SCRIPT LANGUAGE='javascript'>alert(' You must select editing process ')</script>"); return(false); } else { btnEdit.Enabled = false; btnNew.Enabled = false; gvProcess.Visible = false; if (Session["gvr"] != null) { GridViewRow gvr = Session["gvr"] as GridViewRow; txtProcess.Text = gvr.Cells[2].Text; bool flag = true; if (Session["dtColors"] != null) { dtColors = Session["dtColors"] as DataTable; for (int i = 0; flag == true && i < entity.Colors.ToList().Count; i++) { if (((int)entity.Colors.ToList()[i].ColorId) == Convert.ToInt32((gvr.Cells[3].Text))) { flag = false; ddlColor.SelectedIndex = i; } } } txtColor.Text = gvr.Cells[3].Text; var dtProcessDetails = entity.ProcessDetailsSelect(Convert.ToInt32(gvr.Cells[1].Text)).ToList(); pnlStation.Controls.Clear(); for (int i = 0; i < dtProcessDetails.Count; i++) { uc = this.LoadControl("ucStation.ascx") as ucStation; uc.TypeId = (int)(dtProcessDetails[i].StationId); uc.Type = dtProcessDetails[i].Station.ToString(); uc.Time = dtProcessDetails[i].Minutes.ToString(); uc.Details = dtProcessDetails[i].More_details.ToString(); uc.OnCancel += new Cancellation(UcStation_OnCancel); pnlStation.Controls.Add(uc); LUcStation.Add(uc); } btnOk.Visible = true; } } return(true); }
void updateView() { List <ucStation> lEzer = new List <ucStation>(); foreach (ucStation item in LUcStation) { UcStation = this.LoadControl("ucStation.ascx") as ucStation; UcStation.TypeId = item.TypeId; UcStation.Type = item.Type; UcStation.Time = item.Time; UcStation.Details = item.Details; UcStation.OnCancel += new Cancellation(UcStation_OnCancel); pnlStation.Controls.Add(UcStation); lEzer.Add(UcStation); } LUcStation = lEzer; }
protected void btnChoose_Click(object sender, EventArgs e) { if (String.Compare(btnChoose.Text, "Choosed") == 0) { btnOk.Visible = true; ddlReaders.Enabled = false; btnChoose.Text = "Add station"; uc = this.LoadControl("ucStation.ascx") as ucStation; uc.TypeId = Convert.ToInt32(ddlReaders.SelectedValue); uc.Type = ddlReaders.SelectedItem.ToString(); uc.OnCancel += new Cancellation(UcStation_OnCancel); pnlStation.Controls.Add(uc); LUcStation.Add(uc); } else { btnOk.Visible = false; ddlReaders.Enabled = true; btnChoose.Text = "Choosed"; } }
void UcStation_OnCancel(ucStation uc) { LUcStation.Remove(uc); Session["lUcStation"] = LUcStation; pnlStation.Controls.Remove(uc); }