Sure,
<html xmlns="
http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title>Hello there</title>
</head>
<body>
<form id="form1" runat="server" enctype="multipart/form-data"
method="post">
<a href='#'><asp:Image ID="imgProdItem" runat="server" /></a>
</form>
</body>
</html>
code-behind:
protected void ShowCurrentPic()
{
SqlConnection oConn = new SqlConnection(CONN_STRING);
SqlCommand oCmd = new SqlCommand();
SqlDataReader oDr;
string strCatID = Request.QueryString["cat.id"].ToString();
string strSubID = "";
if(Request.QueryString["sub.id"] == null)
{
strSubID = "0";
}
else
{
strSubID = Request.QueryString["sub.id"].ToString();
}
string sImgQuery = "SELECT img_data, img_name, img_contenttype " +
"FROM tbl_FeatureBoxes " +
"WHERE CategoryID = " + strCatID + " AND " +
"SubCategoryID = " + strSubID + " AND " +
"BoxName = 'Online'";
oCmd.CommandText = sImgQuery;
oCmd.CommandType = CommandType.Text;
oCmd.Connection = oConn;
oConn.Open();
oDr = oCmd.ExecuteReader();
if (oDr.Read())
{
string img_data = oDr["img_data"].ToString();
if (img_data == "")
{
this.imgProdItem.ImageUrl = "~/images/img_niu.gif";
}
else
{
byte[] byteArray = (byte[])oDr["img_data"];
Response.ContentType = oDr["img_contenttype"].ToString();
Response.BinaryWrite(byteArray);
}
}
oDr.Dispose();
oCmd.Dispose();
oConn.Close();
}
-------
I want to also note that the page that holds my .net image control is the
only thing on the page. When I try to add anything else on the page, it is
never displayed/showed. No matter what I put on that page, the only thing
visible is the image from the SQL server.
S. Justin Gengo said:
Sirplaya,
Would you be able to show us both the portion of code that is to produce
the
<a href, and the viewstate of the page so we may see what that code
produces?
Thanks,
--
S. Justin Gengo
Web Developer / Programmer
Free code library:
http://www.aboutfortunate.com
"Out of chaos comes order."
Nietzsche