Image

  • November 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Image as PDF for free.

More details

  • Words: 172
  • Pages: 2
Image Inserting: 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"; } Retriving an image from folder to DATALIST:

Displaying an image from database with fixed size: SqlDataAdapter da = new SqlDataAdapter("select * from listing1 where tblid = '" + Session["tblid"].ToString() + "'", cn); DataSet ds = new DataSet(); da.Fill(ds); if (ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) {

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(); } } }

Related Documents

Image
November 2019 40
Image
June 2020 13
Image
November 2019 28
Image
June 2020 13
Image
November 2019 35
Image
June 2020 14