Click here to Skip to main content
15,893,487 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi....

I Am Retrieving Data From Database And Displaying In Table Dynamically
For That I Had used The Code in .cs file
C#
 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
Updated 21-Jan-13 1:43am
v2
Comments
CHAITANYA KIRAN KASANI 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....

Hi,

may be it ll help you :

Store or Save images in SQL Server[^]
 
Share this answer
 
v2
Comments
fjdiewornncalwe 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.
Hi,

You can use Image handler for converting Binary data to images.

Search for that. if you need further help i will

Thank you
 
Share this answer
 
Comments
CHAITANYA KIRAN KASANI 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 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 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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900