troubleshooting Question

Add filename from datasource to end of filesystem path

Avatar of analogue
analogueFlag for United Kingdom of Great Britain and Northern Ireland asked on
.NET ProgrammingASP.NET
8 Comments1 Solution306 ViewsLast Modified:
ASP.NET C# WEB PAGE + SQL SERVER 2005 DB

I am trying to display a Flash Video on a page with the FILENAME supplied to an asp.net flash video control from a sqldatasource. I have filtered my sqldatasource with a value sent by the querystring and that works ok pulling back the required data.

I have put my flash movie control inside an asp:repeater to enable me to pull in the data (this works ok because I have some text labels that pull in data just fine - see txt labels in code). I'm using a flashvideo control from http://www.aspnetflashvideo.com/

My files are stored in the filesystem (in the public part of my website /uploads/airtimetv/*******.flv)

I have a hard coded path that leads to where my flash file are stored on my server and I'd like to stick a filename from the datasource to the end of the path to achieve this...

VideoURL="~/uploads/airtimetv/movie.flv"

The part I want pulled from my datasource is 'movie.flv' which will be different for each movie that is selected from a list on the previous page.

I have my aspx code set like up this

VideoURL='uploads/airtimetv/<% #Eval("moviefile")%>' & this doesn't work.

I'm assuming that there needs to be some sort of C# in the codebehind to create a string that will replace the whole VideoURL but quite how I'd put that together I don't know.

Hope I've got what I'm trying to achieve clear enough - if not just shout and I'll add more info. Cheers guys.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:MyConnetionString %>" SelectCommand="SELECT * FROM [CAirtime] WHERE ([id] = @id)">
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="id" QueryStringField="AirtimeID" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
 
 
 
 
<asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
<div class="VideoDisplayWrapper">
<ASPNetFlashVideo:FlashVideo ID="FlashVideo1" runat="server" Height="360px" VideoURL='uploads/airtimetv/<% #Eval("moviefile")%>' Width="480px" AllowFullScreen="False" >
</ASPNetFlashVideo:FlashVideo>
</div>
 
<p>movielabel: <asp:Label ID="movielabelLabel" runat="server" Text='<%# Eval("movielabel") %>' /></p>
<p>moviefile: <asp:Label ID="moviefileLabel" runat="server" Text='<% #Eval ("moviefile") %>' /></p>
</ItemTemplate>
</asp:Repeater>
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros