One of my friend asked me how do you manage videos in your Asp.Net page. In first shot i said "HTML5". After that one asked me how to display video in GridView Control.
Believe me firstly i was confused about it then i thought about what can we do inside item template to display the videos in our grid. Then first answer came to my mind (HTML5) and i was like "Oh man!!".
This post have no complicated code in it to understand. One simple grid view and Simple HTML5 video tag.
Lets start doing it:
P.S. :
Believe me firstly i was confused about it then i thought about what can we do inside item template to display the videos in our grid. Then first answer came to my mind (HTML5) and i was like "Oh man!!".
This post have no complicated code in it to understand. One simple grid view and Simple HTML5 video tag.
Lets start doing it:
- Place a asp.net gridview control on your page.
- Add all the fields from database (Here i am assuming that you are saving link to videos in your database).
- Use what ever field you want to use for your data (Bound field/Checkbox field etc) but for video column you have to take the ItemTemplate only.
- Bind data to your grid. and its done.
P.S. :
- Please Note that HTML5 tags don't work in every browser.
- In my case I m using Chrome25.
- Its not working in Firefox 13.
- For saving video url's in database dont save them using (~/Videos...)
- Save directly as (Videos/video.mp4)
- Also its not necessary that every file format will run. I tried with wmv, it didnt worked.
No comments:
Post a Comment