Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. images in datalist in asp.net 1.1

images in datalist in asp.net 1.1

Scheduled Pinned Locked Moved ASP.NET
csharpasp-nethelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    sandeep_thakur
    wrote on last edited by
    #1

    Sir, I want to display the images in the datalist control images(landscape, portrait).The images can be of any size in the hard disk and finding the image size the image size in the datalist will be declared dynamically i.e for portrait and landscape the datalist control will have two image size also both the sizes will be fixed like for landscape the image size in the datalist will be 400*200 likewise for the portrait 200*400.The major problem that is occuring in declaring the image control in the datalist control at the run time.I also want to make some description for the image.the discription can be of any length. Can anybody please sort out this problem.Please send me project link if somebody have.I shall be highly obliged. Thanks and Regards Sandeep Thakur

    A 1 Reply Last reply
    0
    • S sandeep_thakur

      Sir, I want to display the images in the datalist control images(landscape, portrait).The images can be of any size in the hard disk and finding the image size the image size in the datalist will be declared dynamically i.e for portrait and landscape the datalist control will have two image size also both the sizes will be fixed like for landscape the image size in the datalist will be 400*200 likewise for the portrait 200*400.The major problem that is occuring in declaring the image control in the datalist control at the run time.I also want to make some description for the image.the discription can be of any length. Can anybody please sort out this problem.Please send me project link if somebody have.I shall be highly obliged. Thanks and Regards Sandeep Thakur

      A Offline
      A Offline
      arpita2006
      wrote on last edited by
      #2

      Create a new aspx page( say image.aspx ) & write this code-- using System; using System.Collections; using System.ComponentModel; using System.Data; using System.Drawing; using System.Drawing.Imaging; using System.IO; using System.Web; using System.Web.SessionState; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.HtmlControls; using System.Data.SqlClient; public partial class newhomesales_admin_imagedisplay : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { string connectionString = System.Configuration.ConfigurationSettings.AppSettings["SqlNewHomeSalesRealty"].ToString(); System.Data.SqlClient.SqlConnection Con = new System.Data.SqlClient.SqlConnection(connectionString); string imgname = Request.QueryString["imgname"]; string modelid = Request.QueryString["modelid"]; System.String SqlCmd = "select " + imgname + " from model_new where modelid=" + modelid + ""; System.Data.SqlClient.SqlCommand SqlCmdObj = new System.Data.SqlClient.SqlCommand(SqlCmd, Con); Con.Open(); System.Data.SqlClient.SqlDataReader SqlReader = SqlCmdObj.ExecuteReader(); if (SqlReader.Read()) { System.IO.MemoryStream thumbStream = new System.IO.MemoryStream(); System.Web.HttpContext.Current.Response.ContentType = "image/jpeg"; System.Drawing.Image _image = System.Drawing.Image.FromStream(new System.IO.MemoryStream((byte[])SqlReader[imgname])); _image.Save(System.Web.HttpContext.Current.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg); _image.Clone(); _image.Dispose(); thumbStream.Close(); thumbStream.Dispose(); } Con.Close(); SqlReader.Close(); } } ***************************************************** Create another aspx page( say datalist.aspx ) & create a datalist Within the datalist, put this code : In the datalist.aspx.cs page write this code: imgupload2.ImageUrl = "imagedisplay.aspx?modelid=" + stmodelid + "&imgname=Floor1PlanPhoto"; where modelid is the imageid, imagename is the datafield name.These two (modelid & imagename) are passed through querystring in image.aspx page. ARPITA -- modified at 14:38 Friday 19th May, 2006

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups