plazza sele

plazza sele

  • NA
  • 15
  • 21.3k

Display image from database dynamically

Nov 11 2010 4:56 AM
Hi all. I try to establish a dynamic HTML table with data for an item. i am getting trouble showing the image for the item, i am getting my data

from the database, i have saved my image as image in the database, and i used byte[].
I have the following code for desplaying data:

protected void DDLitem_SelectedIndexChanged(object sender, EventArgs e)
{

var item = new ItemControl(); // this is in the BLL layer.

  // DDLGoods is a DropDownList. and the method returns a List<Goods>

  List<Goods> get = item.returnGoods(DDLGoods.SelectedItem.Text); var out = new StringBuilder();

  out.Append("<table><tr><td>Name:</td><td>Designation:</td><td>Price:</td><td>Item Number:</td>");
   foreach (var v in get)
   { 

       out.Append("<tr><td>" + v.name + "</td><td>" + v.designation + "</td><td>" + v.price + "</td><td>" + v.itimId + "</      

       td><td></tr>");

    }
    out.Append("</table>");
    Label1.Text= out.ToString();
}

 in the List<Goods> get  i have objects, and each object contains images. here in the foreach loop v.image.

how can i display the image in the same out.append in the foreach loop.

 I need to wrigth in the foreach loop something that will display my v.image, can anyone please help me ???

can anyone help me please and finish my code with some/little comments on what is happening ?? 


Answers (2)