public void LoadImages(int id) { // gridviewGallery.DataSource = usrCl.RetriveImages(id); // gridviewGallery.DataBind(); dlistImages.DataSource = usrCl.RetriveImages(id); dlistImages.DataBind(); }
public void LoadImages(int id) { // gridviewGallery.DataSource = usrCl.RetriveImages(id); // gridviewGallery.DataBind(); List <DataTable> result = usrCl.RetriveImages(id).AsEnumerable() .GroupBy(row => row.Field <string>("MName")) .Select(g => g.CopyToDataTable()) .ToList(); //dlistImages.DataSource = usrCl.RetriveImages(id); //dlistImages.DataBind(); lblName.Text = result[0].Rows[0]["UName"].ToString(); int listcount = 1; for (int i = 0; i < result.Count; i++) { HtmlGenericControl li = new HtmlGenericControl("li"); HtmlGenericControl div = new HtmlGenericControl("div"); HtmlGenericControl label = new HtmlGenericControl("label"); label.InnerText = result[i].Rows[0]["MName"].ToString(); ul1.Controls.Add(li); li.Controls.Add(label); li.Controls.Add(div); DataList dlist = ConstructDataList(listcount); listcount = listcount + 1; div.Controls.Add(dlist); dlist.ItemDataBound += new DataListItemEventHandler(dlistImages_ItemDataBound); dlist.DataSource = result[i]; dlist.DataBind(); // phArticles.Controls.Add(dlArt); } }