Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9053885
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T13:32:20+00:00 2026-06-16T13:32:20+00:00

I am making a Bookstore website. I use Visual Studio 2010 and MS SQL

  • 0

I am making a Bookstore website. I use Visual Studio 2010 and MS SQL Database. I have images about books. I have a Book table in database and there is an image column in this table.

I saved these images (in byte array format) in database.

I tested it in Windows Form Application and everything is ok. I mean i can retrieve and save images to/from database. when I retrieve them from database, i save them (in System.Drawing.Image format) in Book class.

    public Book
    {
          private int id;
          private System.Drawing.Image image;
          // name and other .. informations,  constructor, get and set methods;
    }

    public BookLayer
    {
           // after call this method i can get all informations from database
           public static List<Book> getBooks()
           {
            }
    }

I use datalist with objectdatasource in Asp.net 4 Web Project. I wrote Book and BookLayer class for objectdatasource. I can show all informations in datalist except image.
because image is System.Drawing.Image in Book class but image is System.ui.WebControls.Image which in datalist template item. Format is different. How can i do that ? is that way wrong ? Pls give me any advice.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T13:32:22+00:00Added an answer on June 16, 2026 at 1:32 pm

    Yes use handler. You can do as Add a template field

     <ItemTemplate>
    <img border="2" width="150px" src="../images/loading.gif" onload="getpic(this,'<%# Eval("bkid")%>');"/>
    </ItemTemplate>
    

    use the following java script
    function getpic(img, pid) {

    try {
    img.onload = null;
    img.src = '../Getimage.ashx?id=' + pid;
    } catch (e) {
    alert(e);
    }
    }
    </script>
    

    in your getimage.ashx

    byte[] imageBytes = ;// ToDOget your byte
                Bitmap newBmp = ConvertToBitmap(imageBytes);
                if (newBmp != null)
                {
                    newBmp.Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
                    newBmp.Dispose();
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Making a word document of our network set-up. We have about 7 servers and
Making a primary key in a table in database is fine. Making a Composite
im making an application where i have to load my database from html file
Making an adobe flex ui in which data that is calculated must use proprietary
Making my way through the GAE documents. I have a question I can't find
Making a flash page that can cycle through these three images on mouseclick. For
Im making a simple rock paper scissors game and I need to use the
Making a quick JQuery demo where clicking a table element changes it from black
Making .htaccess (mod_rewrite) work has been very difficult I already have this script for
Making this tutorial: http://developer.android.com/resources/tutorials/notepad/notepad-ex1.html I have ListActivity-derived class and onCreateContextMenu, onContextItemSelected overrides. I think

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.