473,386 Members | 1,753 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,386 software developers and data experts.

Hide when Empty. How to do this?

Hello,

I have this code line inside an ASP.Net Repeater:
<a href='<%# DataBinder.Eval(Container.DataItem, "link") %>'><%=
readMore %></a>

What I need to do is:
1. Show readMore value if <%# DataBinder.Eval(Container.DataItem,
"link") %> is not empty.

2. Show nothing if <%# DataBinder.Eval(Container.DataItem, "link") %> is
empty.

In this moment it is showing all the time the value of readMore.

Or maybe just hide the <a> tag.

Is this possible?

Thanks,
Miguel

Nov 19 '05 #1
1 1712
Both Azat and Gregory gave good possible solutions for this the last time
you asked. Personally, I'd prefer to filter out the rows where the value is
"empty" but if your solution doesn't allow for that, you can
programmatically hide the link during the ItemDataBound event
(http://msdn.microsoft.com/library/de...oundtopic.asp).

If you want to hide it by setting the link's Visible property to false or by
appending a display: none to its class attribute is up to you. Of course,
in order to access the link from the event handler, you'll have to either
set Runat="Server" on the link OR switch to using <asp:hyperlink ...>.
You'll also want to give the control an ID so you can easily access it
through FindControl().

HTH
----------------
Dave Fancher
http://www.davefancher.com

"Shapper" <mdmoura*NOSPAM*@gmail.*DELETE2SEND*com> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
Hello,

I have this code line inside an ASP.Net Repeater:
<a href='<%# DataBinder.Eval(Container.DataItem, "link") %>'><%= readMore
%></a>

What I need to do is:
1. Show readMore value if <%# DataBinder.Eval(Container.DataItem, "link")
%> is not empty.

2. Show nothing if <%# DataBinder.Eval(Container.DataItem, "link") %> is
empty.

In this moment it is showing all the time the value of readMore.

Or maybe just hide the <a> tag.

Is this possible?

Thanks,
Miguel

Nov 19 '05 #2

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

Similar topics

19
by: dmiller23462 | last post by:
Hi guys....I have absolutely NO IDEA what I'm doing with Javascript but my end result is I need two text boxes to stay hidden until a particular option is selected....I've cobbled together the...
2
by: MOHSEN KASHANI | last post by:
Hi, I am trying to hide some form elements in a form by default and show/hide depending on which radio button is clicked. This is what I have but it is not working: <head> <style> ..noshow {...
2
by: Mateo | last post by:
Hi! I have a litle JS problem.... I'm trying to make show/hide table JS function, but my show/hide table function works only on IE.... It works in mozilla partially. Actually,every time when I...
2
by: | last post by:
I have a page where I have 3 combo boxes listed in a column. sort of like: combo1 combo2 combo3 Based on which one is clicked, the others are supposed to hide (i.e. combobox.visible =...
3
by: Merlin | last post by:
Hi there, I am trying to create a form with an dynamic field that can be shown or hidden. As I saw for example on google it is possible with JS to show a layer and move the content underneath...
3
by: | last post by:
I'm using the DataList and GridView controls, and I am trying to wrap my head around the problem of conditionally showing or hiding cells/cell content based on the presence or absence of DB data. I...
13
by: jeff | last post by:
I am attempting to be able to show and hide a form called viewAllForm. I declared an instance of the form in a module. Public viewAllForm As New frmViewAll However I keep getting runtime errors...
1
by: naboumerhi | last post by:
Hi, I have a a custom report trying to hide empty fields and shift the next field up. It still shows and empty space. Example: company1 company2 company3
8
by: elastreto | last post by:
Hello, I have been trying, so far in vain, to hide the label and text control in a form when the text control is empty/null. I have looked at past postings and tried the code below, however I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.