Manoj Maharana

Manoj Maharana

  • NA
  • 362
  • 123.8k

Split Array of data(Dynamics image upload split)

Aug 16 2016 3:38 AM
I have a datatable where i got the image just like ~xyz.png and ~~~~~~phg.jpg
The ~ symbol depends upon how much image if 2 image then ~~~~~ or if 3 image then ~~~~~~~~ just like..
I want to show the split image in a webform using stringbuilder.
 
How to split by using for loop ???
 
Here is my Code:
 
DataTable dt = objDash.ProductList(); 
 
 
for (int i = 0; i < dt.Rows.Count; i++)
{
string hidImg = dt.Rows[i]["Picture"].ToString();
string[] data = hidImg.Split('~');
html.Append(" <img height=50px;width=50px; src=ProductImage/ImageThumbnail/" + data[1] + " alt='Product Image'>");
 
 
How to check data[8] or data[6] or data[0] value  present??? 
 
 
If i am using
//foreach (var item in data)
//{
// // if(data[i]!=null)
// if (!string.IsNullOrEmpty(item))
// {
// html.Append(" <img height=50px;width=50px; src=ProductImage/ImageThumbnail/" + item + " alt='Product Image'>");
// }
//}
Then all the image are showing
I want:
If i have 3 images in  multiple jquery uploder(or database) then only one pic i.e. 1st pic show in webform not all of 

Answers (2)