//private String strcon = ConfigurationManager.ConnectionStrings["hr"].ConnectionString; //private dropdownlist ddlTest; protected void bindDropDownLists() { string myConnection = "dsn=myOracle;uid=system;pwd=oracle1"; OdbcConnection myConn = new OdbcConnection(myConnection); myConn.Open(); string mySelectQuery = "select utl_raw.cast_to_varchar2(UTL_RAW.cast_to_raw(id)) as id, name from servicetype;"; OdbcCommand command = new OdbcCommand(mySelectQuery, myConn); DataTable table = new DataTable(); OdbcDataAdapter adapter = new OdbcDataAdapter(command); adapter.Fill(table); ServiceDropDownList.DataSource = table; ServiceDropDownList.DataTextField = "name"; ServiceDropDownList.DataValueField = "id"; ServiceDropDownList.DataBind(); mySelectQuery = "select utl_raw.cast_to_varchar2(UTL_RAW.cast_to_raw(id)) as id, name from customer;"; command = new OdbcCommand(mySelectQuery, myConn); table = new DataTable(); adapter = new OdbcDataAdapter(command); adapter.Fill(table); CustomerDropDownList.DataSource = table; CustomerDropDownList.DataTextField = "name"; CustomerDropDownList.DataValueField = "id"; CustomerDropDownList.DataBind(); myConn.Close(); }
public void GetAllCustomers() { CustomerDropDownList.DataSource = _SalesRepository.GetAllCustomer(); CustomerDropDownList.DataTextField = "Name"; CustomerDropDownList.DataValueField = "Id"; CustomerDropDownList.DataBind(); CustomerDropDownList.Items.Insert(0, new System.Web.UI.WebControls.ListItem("Select Customer", "0")); }
protected void Page_Load(object sender, EventArgs e) { customers = client.GetCustomers().ToList(); parts = client.GetItems().ToList(); if (!IsPostBack) { CustomerDropDownList.DataSource = customers; CustomerDropDownList.DataTextField = "Name"; CustomerDropDownList.DataValueField = "ID"; CustomerDropDownList.DataBind(); PartDropDownList1.DataSource = parts; PartDropDownList1.DataTextField = "Description"; PartDropDownList1.DataValueField = "ID"; PartDropDownList1.DataBind(); PartDropDownList1.Items.Add("-"); PartDropDownList1.SelectedValue = "-"; } }
protected void Page_Load(object sender, EventArgs e) { quote = client.GetQuote(Convert.ToInt32(Request.QueryString["quote"])); QuoteNumberLabel.Text = quote.ID.ToString(); customers = client.GetCustomers().ToList(); parts = client.GetItems().ToList(); if (!IsPostBack) { CustomerDropDownList.DataSource = customers; CustomerDropDownList.DataTextField = "Name"; CustomerDropDownList.DataValueField = "ID"; CustomerDropDownList.DataBind(); CustomerDropDownList.SelectedValue = quote.CustomerID.ToString(); PartDropDownList1.DataSource = parts; PartDropDownList1.DataTextField = "Description"; PartDropDownList1.DataValueField = "ID"; PartDropDownList1.DataBind(); PartDropDownList1.SelectedValue = quote.Items[0].ID.ToString(); QuantityTextBox1.Text = quote.Items[0].Quantity.ToString(); LabourPriceTextBox.Text = quote.LabourPrice.ToString(); LabourTextArea.InnerText = quote.ServiceDescription; ETALabel.Text = quote.PartsETA.ToShortDateString(); for (int i = 0; i < statusNames.Length; i++) { ListItem item = new ListItem(Convert.ToString(statusNames.GetValue(i)), Convert.ToString(i)); StatusDropDownList.Items.Add(item); } StatusDropDownList.SelectedValue = Convert.ToInt32(quote.Status).ToString(); } #region Display appropriate LinkButtons switch (quote.Status) { case SalesSvc.StatusCode.New: ApproveLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedCheckStock: CheckStockLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedBookService: BookLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedNotInStock: GetETALinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ETAPendingApproval: ApproveLinkButton.Visible = true; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.ApprovedETA: BookLinkButton.Visible = true; BookLinkButton.Text = "Book & send purchase order"; RejectLinkButton.Visible = true; break; case SalesSvc.StatusCode.Booked: RejectLinkButton.Visible = true; break; default: break; } #endregion }