you will have to create a new page called Picture.aspx
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
int ImageID = DropDownList1.SelectedIndex;
Image1.ImageURL = "Picture.aspx?ImageID=" + ImageID;
}
in picture.aspx pageload
protected void Page_Load(object sender, EventArgs e)
{
if (Request.QueryString["ImageID"] != null)
{
int ImageID = Convert.ToInt32( Request.Params["ImageID"]);
using(SqlConnection myConnection = new SqlConnection("Data Source=.\\SQLEXPRESS;AttachDbFilename=C:\\Inetpub\\wwwroot\\WebserviceUpload2\\App_Data\\Database.mdf;Integrated Security=True;User Instance=True"))
{
const string SQL = "SELECT [MIMEType], [Image] FROM [PictureTable] WHERE [ImageID] = @ImageID";
SqlCommand myCommand = new SqlCommand(SQL, myConnection);myCommand.Parameters.AddWithValue("@ImageID", ImageID);
myConnection.Open();
SqlDataReader myReader = myCommand.ExecuteReader(); if (myReader.Read())
{
Response.ContentType = myReader["MIMEType"].ToString();
Response.BinaryWrite((Byte[])myReader["image"]);
}
myReader.Close();
myConnection.Close();
}
}
}
mark as answer is solves your problem, :)