.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Melody Anderson

Post New Resource Bookmark and Share   

Play all video formats in datalist using asp.net c# code from folder

Posted By:Ashutosh Jha       Posted Date: July 26, 2014    Points: 40    Category:    URL: http://www.dotnetspark.com  

Here you will see how to play all video formats in datalist using asp.net c# code from folder.

<asp:DataList ID="d1" runat="server">
<video controls="controls" width="500" height="500" src='<%# Eval ("Name","videos/{0}") %>'></video>

public partial class videos : System.Web.UI.Page
protected void Page_Load(object sender, EventArgs e)
if (!IsPostBack)
protected void BindDataList()
DirectoryInfo dir = new DirectoryInfo(MapPath("~/videos"));
FileInfo[] files = dir.GetFiles();
ArrayList listItems = new ArrayList();
foreach (FileInfo info in files)
d1.DataSource = listItems;
d1 .DataBind(); 


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend