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 6898679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T07:19:37+00:00 2026-05-27T07:19:37+00:00

I have a book database where i have book information. I have a row

  • 0

I have a book database where i have book information. I have a row where i store the name of the picture of the book i want to display on the page. For example cprog.jpeg

Now, i want to append that name to the src to display the picture. However, its just displaying the name itself. Im not quite sure how to do it.

 + " <img src=\"{0} \">" + row[8].ToString() + "</div>"

Here is the complete code..

foreach (DataTable table in dsgrid2.Tables)
            {
                foreach (DataRow row in table.Rows)
                {
                    strBooksInCategory +=
                          "<div style=\"height:150px;\">"

                          + " <img src=\"{0} \">" + row[8].ToString() + "</div>"
                        + "  <div style=\"height:110px;float:left;padding-left:10px;\">"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[0] + "</div>"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[1] + "</div>"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[2] + "</div>"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[3] + "</div>"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[4] + "</div>"
                        + "   <div style=\"height=auto;left-margin:10px;\">" + row[5] + "</div>"
                        + " </div>"
                        + "</div>";
                    strBooksInCategory += "<div style=\"height:10px;width=100%;\"></div>";
  • 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-05-27T07:19:38+00:00Added an answer on May 27, 2026 at 7:19 am

    I am assuming row[8] is your image name… try something like

    + "<img src=\""+ row[8].ToString() +"\"></div>"
    

    You will have to put in the path to the image too, that will look like

    + "<img src=\"/path/to/image/"+ row[8].ToString() +"\"></div>"
    

    However… the other answerer is correct, this is very messy & will only break your heart later. Databound controls are the way to go, read up on DataGrids and Repeaters… it will be worth your while!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some information in my database like 'author', 'book' etc., that are all
i have a form which inserts book information into the database. however it is
I have a book database(2 books in total right now) where for each book
I have one sqlite database in which I store both user-defined information and information
i'm having a problem with my database. I have the folowing: create table book
The code below works great. I have a MySQL database that contains book titles
I have four Database Tables like these: Book ID_Book |ID_Company|Description BookExtension ID_BookExtension | ID_Book|
I have a table [Book] in a database that has a [AuthorId] and [Description]
I have a database, which is a part of a Library Information system. It
I have a database where i am displaying books. Main page displays 2 links

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.