473,395 Members | 1,386 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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.
Jan 8 '07 #1
1 1044
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.
Jan 9 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: shamila | last post by:
</asp:label><asp:datagrid id="DataGrid3" runat="server" cssclass="DataGrid" showfooter="True" onupdatecommand="DataGrid3_Update"ondeletecommand="DataGrid3_Delete" oneditcommand="DataGrid3_Edit"...
1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: Richard Ryerson | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch...
9
by: tshad | last post by:
How do I find (and set) a couple of labels in the Footer after a DataGrid is filled? I have a bunch of DataGrids that get displayed nested inside a DataList. The datagrid looks like: ...
0
by: Wyatt70 | last post by:
I'm attempting to implement a javascript popup calendar in a DataGrid. The calendar will be used to insert a date into a textbox. I keep getting a "System.NullReferenceException: Object reference...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.