Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hi....
 
I Am Retrieving Data From Database And Displaying In Table Dynamically
For That I Had used The Code in .cs file
 
 StringBuilder b = new StringBuilder();
        
  b.Append("<table style="background-color:#f3f3f3; border: #336699 3px solid; ");<br mode="hold" />        b.Append("width:750px; font-size:10pt; font-family:Verdana;" cellspacing="0" cellpadding="3">"); 
 
b.Append("<tr><td colspan="4" style="background-color:#336699; color:white;">");
        b.Append("Product Details"); b.Append("</td></tr>");
        b.Append("<tr><td style="width:80px;">Product Name</td>");
        b.Append("<td style="width:350px;">Product Description</td>");
        b.Append("<td style="width:50px;">Product Price</td>");
        b.Append("<td style="width:200px;">Product Image</td></tr>");
 b.Append("<tr>");
        b.Append("<td>" + table.Rows[0]["ProductName"].ToString() + "</td>");
        b.Append("<td>" + table.Rows[0]["ProductDescription"].ToString() + "</td>");
        b.Append("<td>" + table.Rows[0]["ProductPrice"].ToString() + "</td>");
      
        b.Append("<td>" + table.Rows[0]["ProductImage"].ToString() + "</td>");  // Here I am unable to Display The Image ..I Had Tried A lot by giving the                                                                                                                                       Imageurl..but it is not possible.

        b.Append("</tr></table>");
pls Help me....
Posted 21-Jan-13 2:36am
Edited 21-Jan-13 2:43am
v2
Comments
CHAITANYA KIRAN KASANI at 21-Jan-13 7:39am
   
Hi....
 
I Am Retrieving Data From Database And Displaying In Table Dynamically
For That I Had used The Code in .cs file
 
StringBuilder b = new StringBuilder();

b.Append("<table style='background-color:#f3f3f3; border: #336699 3px solid; ");
b.Append("width:750px; font-size:10pt; font-family:Verdana;' cellspacing='0' cellpadding='3'>");
 
b.Append("<tr><td colspan='4' style='background-color:#336699; color:white;'>");
b.Append("Product Details"); b.Append("</td></tr>");
b.Append("<tr><td style='width:80px;'>Product Name</td>");
b.Append("<td style='width:350px;'>Product Description</td>");
b.Append("<td style='width:50px;'>Product Price</td>");
b.Append("<td style='width:200px;'>Product Image</td></tr>");
 

b.Append("<tr>");
b.Append("<td>" + table.Rows[0]["ProductName"].ToString() + "</td>");
b.Append("<td>" + table.Rows[0]["ProductDescription"].ToString() + "</td>");
b.Append("<td>" + table.Rows[0]["ProductPrice"].ToString() + "</td>");

b.Append("<td>" + table.Rows[0]["ProductImage"].ToString() + "</td>"); // Here I am unable to Display The Image ..I Had Tried A lot by giving the Imageurl..but it is not possible.
 
b.Append("</table>");
 
pls Help me....
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

Hi,
 
may be it ll help you :
 
Store or Save images in SQL Server[^]
  Permalink  
v2
Comments
Marcus Kramer at 21-Jan-13 9:37am
   
Just updated your answer to link to the original article that exists here on Code Project. The link you provided was to a plagiarized version of the article.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

Hi,
 
You can use Image handler for converting Binary data to images.
 
Search for that. if you need further help i will
 
Thank you
  Permalink  
Comments
CHAITANYA KIRAN KASANI at 21-Jan-13 9:29am
   
Ya but...where to use image handler...i used In The Place Of "ProductImage"...But It is Showing error "WebService call Failed:500"...i am unable to understand where to use image handler...
sijo 2 at 21-Jan-13 9:33am
   
you need to follow the steps
create the image handler
in the source page where you want the image use it.
 
CHAITANYA KIRAN KASANI at 21-Jan-13 9:49am
   
created image handler...i wanna display it in a table dynamically...so i had taken like this:
b.Append("<td>" + table.Rows[0]["ProductImage"].ToString() + "</td>");
here in the place of "ProductImage" I used ImageHandler i.e., "ShowImage.ashx?id="+ProductID. But It SHowing The error "WebService call Failed:500"

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 BillWoodruff 300
1 Mathew Soji 274
2 Afzaal Ahmad Zeeshan 268
3 DamithSL 225
4 Sergey Alexandrovich Kryukov 205
0 OriginalGriff 6,249
1 Sergey Alexandrovich Kryukov 5,853
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 3,865


Advertise | Privacy | Mobile
Web01 | 2.8.1411019.1 | Last Updated 21 Jan 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100