public void GetAllUsers() { Location_Bll obj = new Location_Bll(); cmbUsers.DataSource = obj.getAllUsers(); cmbUsers.TextField = "bmet"; cmbUsers.ValueField = "idbmet"; cmbUsers.DataBind(); }
public void EvalQueryString() { string UID = Request.QueryString["UID"];//Get UID Argument from Query String ?UID //Create new instance of getAllUsers() Method Location_Bll obj = new Location_Bll(); List<Location_Entity> list = obj.getAllUsers(); //Create new instance of GetUserName Method. Get's user names to be compared with query string value... List<string> User = GetUserName(); Dictionary<string, int> dictionary = new Dictionary<string, int>(); try { int i = 0; foreach (string value in User) { //Add key (User Name) && value (index) to dictionary dictionary.Add(value, i); i++; } if (dictionary.ContainsKey(UID)) { cmbUsers.SelectedIndex = dictionary[UID]; //Set index for cmbUsers at page load event lblUserName.Text = list[dictionary[UID]].bmet.ToString(); //Set user name to lblUserName at page load event //int index = cmbUsers.SelectedIndex; Get_UserPicture(dictionary[UID]); //Fill ImgUser with binary value } else { return; } } catch (ArgumentNullException) { } }
protected void cmbUsers_SelectedIndexChanged(object sender, EventArgs e) { indexUser = Int32.Parse(cmbUsers.SelectedIndex.ToString()); userID = Int32.Parse(cmbUsers.Value.ToString()); Location_Bll obj = new Location_Bll(); List<Location_Entity> list = obj.getAllUsers(); lblUserName.Text = list[indexUser].bmet.ToString(); Get_UserPicture(); //Fill ImgUser with binary value //Get_UserPicture(indexUser); }