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. Display image in Detailsvew control....

Display image in Detailsvew control....

Scheduled Pinned Locked Moved ASP.NET
tutorialdatabasequestion
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.
  • P Offline
    P Offline
    pranavcool
    wrote on last edited by
    #1

    Hi, I have never used this control.Cay any one tell me:- 1) how to display image in detailsview control.I have store that image path in database.I want to display that image using the path store in that database. 2) and i want to hide columns of the detailsview control.Is it possible?.If yes how it is possible. Can any one provide me the example..........if possible. Thanks in advance. Regards, Pranav.

    Pranav Dave

    L 1 Reply Last reply
    0
    • P pranavcool

      Hi, I have never used this control.Cay any one tell me:- 1) how to display image in detailsview control.I have store that image path in database.I want to display that image using the path store in that database. 2) and i want to hide columns of the detailsview control.Is it possible?.If yes how it is possible. Can any one provide me the example..........if possible. Thanks in advance. Regards, Pranav.

      Pranav Dave

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Put this code in .aspx page <asp:DataList ID="dataListImages" runat="server" RepeatColumns="3" RepeatDirection="Horizontal" Width="100%" CellPadding="2" CellSpacing="0"> <ItemTemplate> <img alt="" src='<%#DataBinder.Eval(Container.DataItem, "Image_Path")%>' /> </ItemTemplate> </asp:DataList> In code behind .cs file private void BindDataList() { using (SqlConnection connection = new SqlConnection("Database=DOTNET;Server=HELLO-COMP;Integrated Security=SSPI")) { string queryString = "SELECT Image_Path FROM Image_Table"; SqlCommand command = new SqlCommand(queryString, connection); SqlDataAdapter da = new SqlDataAdapter(command); DataTable dt = new DataTable(); da.Fill(dt); dataListImages.DataSource = dt; dataListImages.DataBind(); } } protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { BindDataList(); } }

      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