protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { DropDownList_doctor.DataSource = db.GetTable("SELECT ID AS Expr1, Name AS Expr2 FROM Doctor"); DropDownList_doctor.DataTextField = "Expr2"; DropDownList_doctor.DataValueField = "Expr1"; DropDownList_doctor.DataBind(); DropDownList_doctor.Enabled = false; Button_token.Enabled = false; } }
protected void update_doctors_list() { dbcon.DoctorsTables.Load(); var items = from x in dbcon.DoctorsTables.Local select new { Name = "Dr. " + x.FirstName.ToString() + " " + x.LastName.ToString(), x.DoctorID }; DropDownList_doctor.DataTextField = "Name"; DropDownList_doctor.DataValueField = "DoctorID"; DropDownList_doctor.DataSource = items; DropDownList_doctor.DataBind(); }