 |
BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3
 | This is the forum to discuss the Wrox book Beginning ASP.NET 3.5: In C# and VB by Imar Spaanjaars; ISBN: 9780470187593 |
|
Welcome to the p2p.wrox.com Forums.
You are currently viewing the BOOK: Beginning ASP.NET 3.5 : in C# and VB BOOK ISBN: 978-0-470-18759-3 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|
|

December 3rd, 2009, 12:26 PM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 31
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
Runtime selection of video in ASP web site using <object> tag
Hi Imar...
I have included <object> tag in my website to render video....
Code:
<object type="video/x-ms-wmv" width="420" height="340">
<param name="src" value="../Abc.wmv" />
<param name="autostart" value="false" />
<param name="controller" value="true" />
</object>
But, in
Code:
<param name="src" value="../Abc.wmv" />
, each time, i have specified the video file explicitly to value attribute...
As, given in your book, i want to have the data bind just like
Code:
<asp:Image ID="ImageUrl" runat="server" ImageUrl='<%# Eval("ImageUrl")%>' />
for <object>...
Is that possible...
My intention is to create a webpage which can play video... But the video which it plays should be determined at runtime...
As in your book's picture gallery, where picture ll be displayed depending on the selected picture album, i want to have a video gallery ,where video is displayed depending on the selected video album...
The only info which i want now to accomplish this idea is about "the runtime selection of video file"... How can this be done sir......
Please help me...
Thank you in advance...
Last edited by varunbwj; December 3rd, 2009 at 12:28 PM..
|
|

December 3rd, 2009, 12:53 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You can place a Literal control inside your code and bind that Literal...
Imar
|
|
The Following User Says Thank You to Imar For This Useful Post:
|
|
|

December 6th, 2009, 04:07 AM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 31
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
Thanks Imar
Thanks Imar...
Using Literal control to bind data, as you said, it was possible to enter the url of video file in database...
Thanks...
But, my intention is to create a webpage which can play video... But the video which it plays should be determined at runtime...
As in your book's picture gallery, where picture ll be displayed depending on the selected picture album, i want to have a video gallery ,where video is displayed depending on the selected video album...
How can i accomplish this Sir...
Thanking you in advance....
|
|

December 6th, 2009, 06:17 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Hi there,
You can do it exactly as done in the book. Have a DropDownList to display the albums and use a ListView for the videos. Rather than using an asp:Image with an ImageUrl, you enter the necessary <object> HTML inside the ItemTemplate and use a Literal to display the video URL.
I believe there is an exercise at the end of Chapter 13 on displaying the image on a details page, in case you don't want to show all your videos at once.
Cheers,
Imar
|
|

December 7th, 2009, 03:12 AM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 31
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
I have followed your book to get all the things done expect about linking this <object> tag dynamically to specific video... This is the "code in vain" in which i have tried to link <object> tag to "runtime time selected video url"...
Thats actually my problem...
Code:
<%@ Page Title="Videos Gallery" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Videos.aspx.cs" Inherits="Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cpMainContent" Runat="Server">
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"
DataSourceID="LinqDataSource1" DataTextField="Name" DataValueField="Id">
</asp:DropDownList>
<asp:ListView ID="ListView1" runat="server" DataKeyNames="Id"
DataSourceID="LinqDataSource2">
<ItemTemplate>
Description:
<asp:Label ID="DescriptionLabel" runat="server"
Text='<%# Eval("Description") %>' />
<br />
<object type="video/x-ms-wmv" width="420" height="340">
<param name="src" value="<%# Eval("VideoUrl") %>" />
<param name="autostart" value="false" />
<param name="controller" value="true" />
</object>
VideoUrl:
<asp:Literal ID="VideoUrlLabel" runat="server" Text='<%# Eval("VideoUrl") %>' />
<br />
</ItemTemplate>
<EmptyDataTemplate>
<span>No data was returned.</span>
</EmptyDataTemplate>
<LayoutTemplate>
<div ID="itemPlaceholderContainer" runat="server" style="">
<span ID="itemPlaceholder" runat="server" />
</div>
<div style="">
<asp:DataPager ID="DataPager1" runat="server">
<Fields>
<asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True"
ShowLastPageButton="True" />
</Fields>
</asp:DataPager>
</div>
</LayoutTemplate>
</asp:ListView>
<asp:LinqDataSource ID="LinqDataSource2" runat="server"
ContextTypeName="NanasuManageVideoGalleryClassDataContext"
TableName="VideoDetails" Where="VideoAlbumId == @VideoAlbumId">
<WhereParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="VideoAlbumId"
PropertyName="SelectedValue" Type="Int32" />
</WhereParameters>
</asp:LinqDataSource>
<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="VideoGalleryManagingClassDataContext"
Select="new (Id, Name)" TableName="VideoAlbums">
</asp:LinqDataSource>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
Actually, i am not getting how to enter the necessary <object> HTML such that "runtime selected Video url" is played...
Can it be done by using <object> tag sir... Or else, is there any other way to accomplish this task like by using silverlight or any thing else...
Thanking you in advance...
Last edited by varunbwj; December 7th, 2009 at 03:15 AM..
|
|

December 7th, 2009, 03:29 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Ah, so this is more about the actual player than it is about ASP.NET, right?
Depending on the video, you can use Flash, QuickTime, Silverlight or another player. For example, for Flash movies you can use JW Player: http://www.longtailvideo.com/players/jw-flv-player/
Each player requirs different code (often the <object> element) to embed the player in a page.
You'll need to search Google a bit and search for a player that matches your video format(s) and your budget.
You could also decide to upload your movies to a site like YouTube and link to those.
Cheers,
Imar
|
|
The Following 2 Users Say Thank You to Imar For This Useful Post:
|
|
|

December 7th, 2009, 04:14 AM
|
|
Authorized User
|
|
Join Date: Oct 2009
Posts: 31
Thanks: 11
Thanked 0 Times in 0 Posts
|
|
Thank you Imar
Hi Imar,
Thanks for the information... I ll do as you have said...
Thank again...
|
|

December 7th, 2009, 02:40 PM
|
|
Authorized User
|
|
Join Date: Jun 2009
Posts: 70
Thanks: 18
Thanked 1 Time in 1 Post
|
|
Quote:
Originally Posted by Imar
|
And that little gem is an example of why I lurk this forum. I am surprised I had not come across JW Player before - but I hadn't. Thanks.
|
|

December 7th, 2009, 03:44 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
Yeah, it's quite a nice player. One of my colleagues showed it to me some time ago...
Imar
|
|
 |