I have multiple fileupload function where users can upload Pictures and it works.
The Problem is it gets save in SQL like this:
id|| Path ||Extension||Size ||ContentType ||Title
1 ||roses ||.jpg || 11477 || Image/jpeg || flowers
2 ||tulips ||.jpg || 11477 || Image/jpeg || flowers
2 ||carnations||.jpg || 11477 || Image/jpeg || flowers
So it saves the files in many columns...
I have gridview and if select a row and click on it, it will load all the Details based on the clicked row.
And I Need a Code/function that will Show me all the Images based on the title.
So if People choose a row and the title is folwers(like above) it should load all the Images with the title = flowers.
What I have tried:
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridView listBox = sender as GridView;
int selectedID = Int32.Parse(listBox.SelectedDataKey.Value.ToString());
string titel = listBox.SelectedRow.Cells[1].Text;
LoadDetail(selectedID, titel);
}
void LoadDetail(int id, string titel)
{
List<pic> sb = (from x in myEnt.Pic where (x.ID == id) && (x.Titel == titel) select x).ToList();
lblTitel.Text = String.Join(", ", sb.Select(x => x.Titel));
Img1.ImageUrl = "data:Image/jpg;base64," + String.Join(", ", sb.Select(x => Convert.ToBase64String((byte[])x.FileContent)));
}
// it only Shows the first Picture.