protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { NameList.DataBind(); } selectedCustomer = this.GetSelectedCustomer(); AddressLine1.Text = selectedCustomer.Address; AddressLine2.Text = selectedCustomer.City + ", " + selectedCustomer.State + ", " + selectedCustomer.ZipCode; Phone.Text = selectedCustomer.Phone; Email.Text = selectedCustomer.Email; }
private void BindNames() { OracleConnection conn = new OracleConnection(connectionString); try { conn.Open(); OracleCommand cmd = new OracleCommand(); cmd.Connection = conn; cmd.CommandText = "SELECT IDPRODUCT,PRODUCTNAME FROM bb_product"; cmd.CommandType = CommandType.Text; OracleDataReader dr = cmd.ExecuteReader(); NameList.DataSource = dr; NameList.DataTextField = "PRODUCTNAME"; NameList.DataValueField = "IDPRODUCT"; NameList.DataBind(); } finally { conn.Dispose(); } }