protected void GetDropDownList() { Customers = NCRClass.NCRController.LookupAllCustomers(); //if no customers add button is enabled else edit button is enabled CustomerDDL.DataSource = Customers.Tables["Customers"]; this.CustomerDDL.DataTextField = "CompanyName"; this.CustomerDDL.DataValueField = "CustomerID"; CustomerDDL.DataBind(); //CustomerDDL.Items.Insert(0, " "); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { CustomerDDL.DataBind(); } Customer selectedCustomer = this.GetSelectedCustomer(); TextBoxAddress.Text = selectedCustomer.Address; LabelPhone.Text = selectedCustomer.Phone; LabelEmail.Text = selectedCustomer.Email; }