protected void Page_Load(object sender, EventArgs e) { } protected void drplist_SelectedIndexChanged(object sender, EventArgs e) { string selectvalue = (((DropDownList)sender).SelectedValue).ToString(); SqlConnection cnn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["myConnectionString"].ConnectionString); try { SqlCommand cmd = new SqlCommand(); cmd.Connection = cnn; cmd.Parameters.Add("@Email", SqlDbType.VarChar).Value = selectvalue; cmd.CommandText = "select * from tbl_Registration where Email=@Email"; cmd.CommandType = CommandType.Text; cnn.Open(); SqlDataReader reader = cmd.ExecuteReader(); GridView1.DataSource = reader; GridView1.DataBind(); cnn.Close(); } catch (Exception ex) { Response.Write(ex.Message); if (cnn.State == ConnectionState.Open) { cnn.Close(); } } finally { if (cnn.State == ConnectionState.Open) { cnn.Close(); } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)