Netlink2
asked on
How to hide Panel if the PARAM NAME="FileName" VALUE='no file'"
I have a video panel and I want to code in VideoPanel.visible = false if there isn't a valid video filename loaded. I want to do this in code-behind using vb.
The code is.
<asp:Panel ID="VideoPanel" runat="server">
<asp:Repeater ID="VideoRepeater" runat="server" DataSourceID="AdsDataSourc e" OnItemDataBound="Video_Ite mDataBound ">
<ItemTemplate>
<table summary="This is a table for video preview">
<caption class="none">Video Preview</caption>
<tbody>
<br />
<OBJECT
ID="MediaPlayer"
classid="CLSID:22d6f312-b0 f6-11d0-94 ab-0080c74 c7e95"
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
width=320 height=240
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobj ect">
<PARAM NAME="FileName" VALUE='<%# Eval("VideoFile").ToString () %>'>
The code is.
<asp:Panel ID="VideoPanel" runat="server">
<asp:Repeater ID="VideoRepeater" runat="server" DataSourceID="AdsDataSourc
<ItemTemplate>
<table summary="This is a table for video preview">
<caption class="none">Video Preview</caption>
<tbody>
<br />
<OBJECT
ID="MediaPlayer"
classid="CLSID:22d6f312-b0
CODEBASE="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715"
width=320 height=240
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobj
<PARAM NAME="FileName" VALUE='<%# Eval("VideoFile").ToString
ASKER
Sorry, I should have mentioned, the file value is in a table and I don't want to duplicate calling the table because it's already called by a datalist, per the following code:
<asp:DataList OnItemCommand="PhotoList_I temCommand " ID="PhotoList" runat="Server"
DataSourceID="PhotosDataSo urce" DataKeyField="Id" RepeatLayout="Flow">
<ItemTemplate>
</ItemTemplate>
</asp:DataList>
<asp:DataList OnItemCommand="PhotoList_I
DataSourceID="PhotosDataSo
<ItemTemplate>
</ItemTemplate>
</asp:DataList>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks, so how do I know the filename in code-behind ?. The file name is different for every page which is displayed, per the table data.
Dear Netlink2,
You can use System.IO.File.Exists() to check file existance. However, i'm not sure what you meant by
>> The file name is different for every page which is displayed, per the table data.
Do you meant by the display will be different based on different filename? Please post your web layout if that the case and please give some details regarding this mentioned.
You can use System.IO.File.Exists() to check file existance. However, i'm not sure what you meant by
>> The file name is different for every page which is displayed, per the table data.
Do you meant by the display will be different based on different filename? Please post your web layout if that the case and please give some details regarding this mentioned.
ASKER
Seeing if the file exists is no problem, it's knowing which file I'm looking for which is the problem. The filename is stored as a table variable and the filename will change for every page which is shown. The filename is obtained by PhotosDataSource. So how can vb know what html knows (or the object knows), which is the name of the file ?.
ASKER
I still can't hide the panel, but I'll close the question.
You can check the existance of the file and set the panel's visibility to false there are no file on the located at the server.
eg:
Code-behind
----------------------
If System.IO.File.Exists(Serv
VideoPanel.Visible=true
Else
VideoPanel.Visible=false
End If