HighTechTalks DotNet Forums  

Datagrid TemplateColumn

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Datagrid TemplateColumn in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Jake K
 
Posts: n/a

Default Datagrid TemplateColumn - 01-08-2007 , 04:32 PM






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
  #2  
Old   
Jim in Arizona
 
Posts: n/a

Default Re: Datagrid TemplateColumn - 01-09-2007 , 12:35 PM






Jake K wrote:
Quote:
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 Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.