PC Review


Reply
Thread Tools Rate Thread

Datagrid TemplateColumn

 
 
Jake K
Guest
Posts: n/a
 
      8th Jan 2007
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.


 
Reply With Quote
 
 
 
 
Jim in Arizona
Guest
Posts: n/a
 
      9th Jan 2007
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.
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Datagrid TemplateColumn Jake K Microsoft ASP .NET 1 9th Jan 2007 05:35 PM
Datagrid & TemplateColumn David Microsoft ASP .NET 0 8th Oct 2006 05:56 AM
datagrid templateColumn sam Microsoft Dot NET 0 24th Jun 2004 04:32 PM
datagrid templatecolumn Selen Microsoft C# .NET 0 26th Apr 2004 10:14 AM
TemplateColumn of DataGrid =?Utf-8?B?U3RldmUgUg==?= Microsoft ASP .NET 2 3rd Mar 2004 07:30 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:41 AM.