protected void PopulateListOfButtonsWithUserInfo() { String query_string = "SELECT LOGIN, PASSWORD, EMAIL FROM"; query_string += " ENTRIES"; MySqlCommand cmd = new MySqlCommand(query_string, connection); using (MySqlDataReader rdr = cmd.ExecuteReader()) { if (rdr.Read()) { Label_Error.Text = "Reader is working"; String s = ","; do { String login = (String)rdr["login"]; String pwd = (String)rdr["password"]; String email = (String)rdr["email"]; String caption = login; SuperButton b = new SuperButton(login, pwd, email); b.Text = caption; lst.Add(b); } while (rdr.Read()); } else { Label_Error.Text = "Reader is broken"; } //rdr.Close(); } return; }
protected void OnDynamicClick(object sender, EventArgs e) { SuperButton b = (SuperButton)sender; //String caption = b.Text; //char[] separator = { ',' }; //String[] elements = caption.Split(separator ); //String login = elements[0]; //String pwd = elements[1]; //String email = elements[2]; //Response.Write("login = "******"About to edit user with login " + b.Login + " and password = "******" and email " + b.Email; String query_string = "EditUser.aspx?login="******"&pwd=" + b.Pwd + "&email=" + b.Email; Response.Redirect(query_string); }