Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

How to hide Panel if the PARAM NAME="FileName" VALUE='no file'"

Posted on 2007-10-17
7
Medium Priority
?
489 Views
Last Modified: 2012-06-27
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="AdsDataSource" OnItemDataBound="Video_ItemDataBound">
      <ItemTemplate>
      <table summary="This is a table for video preview">
      <caption class="none">Video Preview</caption>
      
      
<tbody>

<br />
      <OBJECT
                                                      
    ID="MediaPlayer"
    classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
    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-oleobject">
    <PARAM NAME="FileName" VALUE='<%# Eval("VideoFile").ToString() %>'>
0
Comment
Question by:Netlink2
  • 4
  • 3
7 Comments
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 20098981
Dear Netlink2,
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(Server.MapPath(YOUR_EXISTING_PARAMETER))Then
    VideoPanel.Visible=true
Else
    VideoPanel.Visible=false
End If
0
 
LVL 1

Author Comment

by:Netlink2
ID: 20099020
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_ItemCommand" ID="PhotoList" runat="Server"
                              DataSourceID="PhotosDataSource" DataKeyField="Id" RepeatLayout="Flow">
                              <ItemTemplate>

                              </ItemTemplate>
                        </asp:DataList>
0
 
LVL 29

Accepted Solution

by:
David H.H.Lee earned 1500 total points
ID: 20099042
Dear Netlink2,
You can check the file's existance inside onItemDataBound event. The reason is you never know wheter the file is exist or not in your spesified location.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:Netlink2
ID: 20099085
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.
0
 
LVL 29

Expert Comment

by:David H.H.Lee
ID: 20099095
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.
0
 
LVL 1

Author Comment

by:Netlink2
ID: 20105555
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 ?.
0
 
LVL 1

Author Comment

by:Netlink2
ID: 20286285
I still can't hide the panel, but I'll close the question.
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Today is the age of broadband.  More and more people are going this route determined to experience the web and it’s multitude of services as quickly and painlessly as possible. Coupled with the move to broadband, people are experiencing the web via …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question