Image
Image
if (flpup.PostedFile.FileName != "")
{
if(flpup.PostedFile.ContentType.StartsWith("image"))
{
img =
flpup.PostedFile.FileName.Substring(flpup.PostedFile.FileName.LastIndex
Of("\\") + 1);
s = id.ToString() + "_" + img;
flpup.PostedFile.SaveAs(Server.MapPath("listing\\" + s));
}
else
{
lblerror.Visible=true;
lblerror.Text="Please Upload images Only";
}
}
else
{
img = "NO-Image";
}
<tr>
<td colspan="2" align="center" class="membertextinside" ><asp:Image
ID="img" runat="server"
ImageUrl='<%#"listing/"+DataBinder.Eval(Container.DataItem,"addlogo")
%>' />
</td>
</tr>
{
if (dr["addlogo"].ToString() == "")
{
//System.Web.UI.WebControls.Image im =
((System.Web.UI.WebControls.Image).FindControl("img"));
img.ImageUrl = "images/" + "no-img.jpg";
}
else
{
System.Drawing.Image i =
System.Drawing.Image.FromFile(Server.MapPath("listing/" +
dr["addlogo"].ToString()));
//img.ImageUrl = "listing/" +
dr["addlogo"].ToString();
float h = i.Height;
float w = i.Width;
//float height, width;
if (w > 500)
{
//System.Web.UI.WebControls.Image im =
((System.Web.UI.WebControls.Image).FindControl("img"));
img.Width = 500;
}
if (h > 100)
{
img.Height = 100;
}
img.ImageUrl = "listing/" +
dr["addlogo"].ToString();
}
}