protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session["Username"] != null && Session["Token"] != null) { ReadAllTeacherCommand cmd = new ReadAllTeacherCommand(); cmd.Execute(); list_profe = cmd.Teachers; foreach (Teacher teacher in list_profe) { prof_data.DataSource = list_profe; prof_data.DataBind(); } } else { Response.Redirect("/site/admin/login.aspx"); } } catch (Exception ex) { } } }
protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { try { if (Session["Username"] != null && Session["Token"] != null) { ReadAllTeacherCommand cmd_ = new ReadAllTeacherCommand(); cmd_.Execute(); teacher_list = cmd_.Teachers; foreach (Teacher teacher in teacher_list) { teacher.Name = teacher.Name + " " + teacher.LastName; list_prof.DataTextField = "Name"; list_prof.DataValueField = "Email"; list_prof.DataSource = teacher_list; list_prof.DataBind(); } list_prof.Items.Insert(0, new ListItem("Seleccione", "")); list_prof.Items[0].Selected = true; list_prof.Items[0].Attributes["disabled"] = "disabled"; } else { Response.Redirect("/site/admin/login.aspx"); } } catch (Exception ex) { } } }