protected void Page_Load(object sender, EventArgs e) { SetName = "Invoice"; if (!IsPostBack) { KeyID = new Guid(Request.Params["Id"]); Invoice inv = (DataItem as Invoice); DropDownListLocation.DataBind(); ListItem li = DropDownListLocation.Items.FindByValue(inv.Location.Id.ToString()); if (li != null) { li.Selected = true; } DropDownListLedger.DataBind(); li = DropDownListLedger.Items.FindByValue(inv.Ledger.Id.ToString()); if (li != null) { li.Selected = true; } RebindControls(); } }
//private void SaveEmployeeRole(int employeeId) //{ // try // { // if (DropDownListEmployeeRole.Items.Count > 0) // { // if (DropDownListEmployeeRole.SelectedValue != "0") // { // EmployeeRole.InsertEmployeeRole(employeeId, DropDownListEmployeeRole.SelectedItem.ToString(), this.Master.LoggedOnAccount); // BindEmployeeRoleList(); // } // } // } // catch (System.Data.SqlClient.SqlException sqlEx) // { // LabelError.Text = ""; // for (int i = 0; i < sqlEx.Errors.Count; i++) // { // LabelError.Text += (sqlEx.Errors[i].Message + "<br />"); // } // PanelError.Visible = true; // } //} #endregion #region Employee Location private void BindLocation() { DropDownListLocation.DataSource = Location.GetLocationList(); DropDownListLocation.DataTextField = "Description"; DropDownListLocation.DataValueField = "LocationId"; DropDownListLocation.DataBind(); DropDownListLocation.Items.Insert(0, new ListItem("All", "0")); }
private void BindLocationList() { DropDownListLocation.DataSource = Location.GetLocationListByAccountId(Account.GetAccountByUserName(Page.User.Identity.Name.ToString()).AccountId); DropDownListLocation.DataTextField = "Description"; DropDownListLocation.DataValueField = "LocationId"; DropDownListLocation.DataBind(); if (DropDownListLocation.Items.Count > 1) { DropDownListLocation.Items.Insert(0, new ListItem("Please select", "0")); } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { //--------Testing with hard coded user id------- //Session["userId"] = new Guid(); if (Session["userId"] == null) { LinkButtonHistory.Visible = false; } // Dropdown box DataSet ds = client.SelectDistinctLocationFromBranch(); DropDownListLocation.DataSource = ds; DropDownListLocation.DataTextField = "city"; DropDownListLocation.DataValueField = "city"; DropDownListLocation.DataBind(); DropDownListLocation.Items.Insert(0, new ListItem("All", "All")); ds = client.SelectDistinctCategoryFromBranch(); DropDownListCategory.DataSource = ds; DropDownListCategory.DataTextField = "category"; DropDownListCategory.DataValueField = "category"; DropDownListCategory.DataBind(); DropDownListCategory.Items.Insert(0, new ListItem("All", "All")); Session["search"] = ""; // Display search Result BindListView(); } // Autofill for search Names = client.SelectDistinctShopNameFromBranch().ToList <String>(); }