473,811 Members | 3,290 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Hide when Empty. How to do this?

Hello,

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

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

2. Show nothing if <%# DataBinder.Eval (Container.Data Item, "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 1729
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
programmaticall y 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:hyperlin k ...>.
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.*DELETE 2SEND*com> wrote in message
news:eB******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

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

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

2. Show nothing if <%# DataBinder.Eval (Container.Data Item, "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
6937
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 JavaScript in this code from a couple different sites but I'm not 100% sure what each line is doing...This is the ASP code that I'm using for the page....Take a look at the JavaScript code and please let me know what each line is doing....I have been...
2
12193
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 { display: none; }
2
7015
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 contract table the empty field is left. You can see example in left side menu on www.kijevo.hr when you click on plus or minus. If you
2
2220
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 = false). However, when I have the bottom one in that column to be the one to be used
3
6409
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 that layer further down uppon showing this layer. When a person closes that layer the content underneath the layer moves up again and closes the empty space. How is this possible? I am playing around with some code I am posting with this thread....
3
7738
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 am finding this sort of problem by far the most annoying part about working with ASP.NET controls. What I want is to know how to do three things: - conditionally show or hide an ImageField +column+ based on whether or not an the...
13
2267
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 when I close and try and show it again. What is the proper way to do this? I only want 1 open at a time. They can cover it up and leave it open if they want. But whenever they click to show it I want it to come to the surface and/or to load if it...
1
1606
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
12944
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 am getting Run-Time Error 438, stating that the object doesn’t support this property or method. I don't know if I am writing the code to the wrong place or if I have an error in the code itself. Any help is appreciated!! (I am running Access...
0
9726
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10647
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10384
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7667
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6887
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5553
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4338
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.