Ankit Agarwal

Ankit Agarwal

  • NA
  • 379
  • 253.4k

How to retrieve image from saved path on selectedvaluechange

Feb 3 2014 3:50 AM
Hello,

How to retrieve image from database saved path on DropdownList Selected Value Changed using c# asp.net?

I am using code for display in image url but my image is not displaying.
My text is displaying but my image it's not displaying.
My code is:-
protected void DDLCity_SelectedIndexChanged(object sender, EventArgs e)     {         SqlConnection con = new SqlConnection(connectionString);                  SqlCommand cmd = new SqlCommand("procGetSponsorDetails",con);         con.Open();         cmd.CommandType = CommandType.StoredProcedure;         cmd.Parameters.Add("@CityId", SqlDbType.Int).Value = DDLCity.SelectedItem.Value;         SqlDataReader sdr = cmd.ExecuteReader();         //cmd.ExecuteReader();         if (sdr.Read())         {                          ImgLogoSponsor.ImageUrl = Server.MapPath("~/Templates/") + sdr[0].ToString();             LblAllotedCards.Text = sdr[10].ToString();                  }         sdr.Close(); con.Close(); } }
DropdownList and Image in Update panel.
please help me.

Thanks in Advance.

Ankit Agarwal
Website Developer 

Answers (1)