Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Datagrid TemplateColumn (http://www.velocityreviews.com/forums/t763101-datagrid-templatecolumn.html)

Jake K 01-08-2007 09:32 PM

Datagrid TemplateColumn
 
I have an ItemTemplate in a datagrid that must use a conditional statement.
The templatecolumns is as follows:

<asp:TemplateColumn HeaderText="Listen To File">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="sound.gif"
NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.path_to_file",
"{0:g}") %>'>
</ItemTemplate>
</asp:TemplateColumn>

I only want to display the hyprlink/sound.gif if dataitem.patch_to_file
contains a string. So if the value of path_to_file is null or empty then I
do not want to display the sound.gif. Path_to_file in the database may be
something like http://.../whatver.wav or may be null or empty.

Can this be accomplished? Thanks a lot for the advise.



Jim in Arizona 01-09-2007 05:35 PM

Re: Datagrid TemplateColumn
 
Jake K wrote:
> I have an ItemTemplate in a datagrid that must use a conditional statement.
> The templatecolumns is as follows:
>
> <asp:TemplateColumn HeaderText="Listen To File">
> <ItemTemplate>
> <asp:HyperLink ID="HyperLink1" runat="server" ImageUrl="sound.gif"
> NavigateUrl='<%# DataBinder.Eval(Container, "DataItem.path_to_file",
> "{0:g}") %>'>
> </ItemTemplate>
> </asp:TemplateColumn>
>
> I only want to display the hyprlink/sound.gif if dataitem.patch_to_file
> contains a string. So if the value of path_to_file is null or empty then I
> do not want to display the sound.gif. Path_to_file in the database may be
> something like http://.../whatver.wav or may be null or empty.
>
> Can this be accomplished? Thanks a lot for the advise.
>
>


How is the data retrieved from the database? Could this be something you
could solve in your SQL statements, but removing any empty or null
values with your select statement(s) before the processing is started by
asp.net? Other than that, I don't know how you could fix this.


All times are GMT. The time now is 12:37 PM.

Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.