protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { test = new konrad.CourierService(); string[] st = { "1", "2", "3", "4", "5" }; DropDownListStatus.DataSource = st; DropDownListStatus.DataBind(); } }
private void BindStatus() { DropDownListStatus.DataSource = SPARInsightManagement.Web.Code.Status.GetStatusList(); DropDownListStatus.DataTextField = "Description"; DropDownListStatus.DataValueField = "StatusId"; DropDownListStatus.DataBind(); if (DropDownListStatus.Items.Count > 1) { DropDownListStatus.Items.Insert(0, new ListItem("Please select", "0")); } }
private void BindStatus() { using (SqlConnection con = new SqlConnection(CS)) { SqlCommand cmd = new SqlCommand("select * from Status", con); con.Open(); SqlDataAdapter sda = new SqlDataAdapter(cmd); DataTable dt = new DataTable(); sda.Fill(dt); if (dt.Rows.Count != 0) { DropDownListStatus.DataSource = dt; DropDownListStatus.DataTextField = "StatusName"; DropDownListStatus.DataValueField = "StatusId"; DropDownListStatus.DataBind(); DropDownListStatus.Items.Insert(0, new ListItem("-Select-", "0")); } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { using (DataClassesDatabaseDataContext db = new DataClassesDatabaseDataContext()) { PenggunaLogin _pengguna = (PenggunaLogin)Session["PenggunaLogin"]; DropDownListStatus.DataSource = db.TBStatusTransaksis.ToArray(); DropDownListStatus.DataValueField = "IDStatusTransaksi"; DropDownListStatus.DataTextField = "Nama"; DropDownListStatus.DataBind(); DropDownListStatus.Items.Insert(0, new ListItem { Text = "-Semua Status-", Value = "0" }); DropDownListStatus.SelectedValue = "5"; ViewState["TanggalAwal"] = Pengaturan.HariIni()[0]; ViewState["TanggalAkhir"] = Pengaturan.HariIni()[1]; LoadData(); } } }