Description:
An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30201: Expression expected. Source Error:
Line 167:
Line 168:
Line 169: <div id="bodyframe" style='<%#Eval("VideoUrl")==""?" visibility:hidden":" visibility:show"%>'> Line 170:
Line 171: <iframe width="600" height="315" src='<%# Eval("VideoUrl") %>' frameborder="0"></iframe>
Gracien
Member
42 Points
125 Posts
Hide an empty field of Datalist
Apr 02, 2012 05:22 PM|LINK
I have got this datalist with the following fields:Title,Date,Description,Video.
Sometimes there is no record to display for the Video,but cause the width and height of the frame has already been set up
a big blanc space is being shown on the page,how to solve this.
In short how to hide a empty field from the datalist?
here re th codes
<asp:DataList ID="DataList1" runat="server"
DataSourceID="SqlDataSource1">
<ItemTemplate>
<asp:Label ID="TitleLabel" runat="server" Text='<%# Eval("Title") %>' />
<br /><asp:Label CssClass="DateLabeldate" ID="DateLabel" runat="server" Text='<%# Eval("Date","{0:dd/MM/yyyy}") %>' />
<asp:Label ID="DescriptionLabel" runat="server" Text='<%# Eval("Paragraph1") %>' />
<br /> <br />
<asp:LinkButton CssClass ="button" ID="LinkButton1" PostBackUrl ='<%# Eval("Id", "actu.aspx?Id={0}") %>' runat="server">lire
plus</asp:LinkButton>
<p><iframe width="600" height="315" src='<%# Eval("VideoUrl") %>' frameborder="0"></iframe></p>
</ItemTemplate>
</asp:DataList>
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Hide an empty field of Datalist
Apr 04, 2012 01:20 AM|LINK
Hello:)
Just put the iframe into the container placer of "div",and then set the property of "style“——
<div id="bodyframe" style='<%#Eval("VideoUrl")==""?"visibility:hidden":"visibility:show"%>'>
<iframe width="600" height="315" src='<%# Eval("VideoUrl") %>' frameborder="0"></iframe>
</div>
Gracien
Member
42 Points
125 Posts
Re: Hide an empty field of Datalist
Apr 06, 2012 10:08 AM|LINK
Hi,
I've tried but it's giving an error at run time
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.
Compiler Error Message: BC30201: Expression expected.
Source Error:
Line 167: Line 168: Line 169: <div id="bodyframe" style='<%#Eval("VideoUrl")==""?" visibility:hidden":" visibility:show"%>'> Line 170: Line 171: <iframe width="600" height="315" src='<%# Eval("VideoUrl") %>' frameborder="0"></iframe>Source File: C:\Users\Gracien\Documents\customers\congosynthese\actu.aspx Line: 169
Decker Dong ...
All-Star
118619 Points
18779 Posts
Re: Hide an empty field of Datalist
Apr 07, 2012 01:02 AM|LINK
Hello again:)
Sorry but plz have a try like this:
style='<%#Eval("VideoUrl").ToString().Equals("")?"visibility:hidden":"visibility:show"%>'This should work,plz welcome your feedback……Regaurds!