hi guys, i have a problem with the listbox 's event.( i m working on C# ASP.NET )
When the page loaded the person's name and surname is listed on the list box. What i want is when clicked the lisxtbox's random element , the informations is related to the element will be listed in textboxes.
my code is below ( to look for the values comes or not, i only wrote txtEvtel.text )
thanks..Code:String i; String kisi_ad; protected void Page_Load(object sender, EventArgs e) { OleDbConnection con = dbConnection.GetConnectionObject(); OleDbCommand cmd = new OleDbCommand("SELECT kisi_ad,kisi_soyad FROM kisi where k_id=@kid", con); cmd.Parameters.AddWithValue("@kid", Session["k_id"]); con.Open(); OleDbDataReader rdr = cmd.ExecuteReader(); while (rdr.Read()) { i = (String)(rdr.GetValue(0)+" "+ rdr.GetValue(1)); kisi_ad = (String)(rdr.GetValue(0)); } lbName.Items.Add(i); con.Close(); } protected void lbName_SelectedIndexChanged(object sender, EventArgs e) { OleDbConnection conn = dbConnection.GetConnectionObject(); OleDbCommand cm = new OleDbCommand("SELECT * FROM kisi WHERE kisi_ad=@pad", conn); cm.Parameters.AddWithValue("@pad", kisi_ad); OleDbDataReader rd = cm.ExecuteReader(); while (rd.Read()) { txtEvTel.Text = rd["kisi_evtel"].ToString(); } conn.Close(); }



LinkBack URL
About LinkBacks



what must i do?