protected void Repeater3_ItemCommand(object source, RepeaterCommandEventArgs e) { XmlDocument xmldoc = new XmlDocument(); xmldoc.Load(Server.MapPath("~/" + "XML/album.xml")); XmlNodeList nodelist = xmldoc.GetElementsByTagName("Album"); DataTable dt = (DataTable)Session["dt"]; if (dt.Rows.Count > 0) { for (int i = 0; i < nodelist.Count; i++) { string val = e.CommandArgument.ToString(); BindVideo(val); string attr = nodelist[i].Attributes["Name"].Value; if (attr == val) { List<string> videos = new List<string>(); XmlNodeList Videolist = xmldoc.GetElementsByTagName("VideosFolder"); string[] separators = { "/", "\\" }; if (Videolist[i] != null) { string videopath = Videolist[i].InnerText; string[] vdowords = videopath.Split(separators, StringSplitOptions.RemoveEmptyEntries); foreach (var word in vdowords) { Console.WriteLine(word); string val1 = "\\Gallary\\"; string val2 = "\\Videos"; string val3 = val1 + word + val2; bool newpath = videopath.Contains(val3); if (newpath == true) { DirectoryInfo di = new DirectoryInfo(Server.MapPath("") + val3); int count = di.GetFiles().Length; DataTable imgdt = new DataTable(); imgdt.Columns.Add("VideosFolder", typeof(string)); for (int j = 0; j < count; j++) { DataRow dr = imgdt.NewRow(); string imgpath = Videolist[i].InnerText; //bind folder images to datarow here. dr["VideosFolder"] = Videolist[i].InnerText; imgdt.Rows.Add(dr); DirectoryInfo directoryInfo = new DirectoryInfo(imgpath); FileInfo[] fileInfo = directoryInfo.GetFiles(); string fullpath = "~" + val3 + "\\" + fileInfo[j].Name; videos.Add(fullpath);//i want this path in linkbutton eval } Repeater3.DataSource = videos; Repeater3.DataBind(); } } } } } } }
<asp:Repeater ID="Repeater3" runat="server" OnItemCommand="Repeater3_ItemCommand"> <ItemTemplate> <td> <%-- <div id="PlayMP4Video"> </div>--%> <asp:LinkButton ID="LinkButton4" runat="server" CommandArgument='<%#Eval("Name") %>' Text='<%#Eval("Name") %>' Height="80px" Width="120px"></asp:LinkButton> </td> </ItemTemplate> </asp:Repeater>
<%# GetPath(Eval("Name")) %>'
protected string GetPath(Object name) { // Do logic with to Add the concatenated full path and return return "fullPath"; }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)