protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { ddlCustomers.DataBind(); } selectedCustomer = this.GetselectedCustomer(); this.DisplayCustomer(); }
private Customer GetselectedCustomer() { DataView customerTable = (DataView) SqlDataSource1.Select(DataSourceSelectArguments.Empty); customerTable.RowFilter = "CustomerID = " + ddlCustomers.SelectedValue; DataRowView row = customerTable[0]; Customer customer = new Customer(); customer.CustomerID = Convert.ToInt32(row["CustomerID"]); customer.Name = row["Name"].ToString(); customer.Address = row["Address"].ToString(); customer.City = row["City"].ToString(); customer.State = row["State"].ToString(); customer.ZipCode = row["ZipCode"].ToString(); customer.Phone = row["Phone"].ToString(); customer.Email = row["Email"].ToString(); return customer; }
public void AddItem(Customer customer) { customers.Add(customer); }