hi
i have 2fileupload control 2 button and 2 <asp:image>
i want when user select their image from FUP and click on button it show their selected image into image tag so i should bind image tag from database but i don't know where should i write code that bind my image tag from database
these are my code
protected void BtnUpload_Click(object sender, EventArgs e)
{
string path = Server.MapPath(".") + "\\../image/House\\";
string filename = System.IO.Path.GetFileName(fup1.PostedFile.FileName);
fup1.PostedFile.SaveAs(path + filename);
SqlCommand _cmd = new SqlCommand("Fileup1", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
string data = Server.UrlDecode(Request.QueryString["BehCode3"]);
_cn.Open();
_cmd.Parameters.AddWithValue("@image", fup1.FileBytes);
_cmd.Parameters.AddWithValue("@Behcode", data);
_cmd.Parameters.Add("@id", SqlDbType.Int).Direction = ParameterDirection.Output;
_cmd.ExecuteNonQuery();
ViewState["Id"] = _cmd.Parameters["@id"].Value.ToString(); _cn.Close();
_cn.Close();
and second button
protected void BtnUpload2_Click(object sender, EventArgs e)
{
fup2.PostedFile.SaveAs(path + filename);
SqlCommand _cmd = new SqlCommand("Fileup3", _cn);
_cmd.CommandType = CommandType.StoredProcedure;
string data = Server.UrlDecode(Request.QueryString["BehCode3"]);
_cn.Open();
_cmd.Parameters.AddWithValue("@image1", fup2.FileBytes);
_cmd.Parameters.AddWithValue("@Behcode", data);
_cmd.Parameters.AddWithValue("@id", Convert.ToInt32(ViewState["Id"]));
_cmd.ExecuteNonQuery();
_cn.Close();
}
Best Regards