Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Hide when Empty. How to do this?

Reply
Thread Tools

Hide when Empty. How to do this?

 
 
Shapper
Guest
Posts: n/a
 
      06-17-2005
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

 
Reply With Quote
 
 
 
 
Dave Fancher
Guest
Posts: n/a
 
      06-17-2005
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:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
How to selectively hide Wireless Network Connection icon =?Utf-8?B?SmFtZXM=?= Wireless Networking 1 10-27-2005 10:18 PM
GRE, hide nat on PIX Jean-Michel Dewaal Cisco 1 08-14-2005 11:50 PM
Ports to open to the firewall (Hide Nat, Cisco VPN) Alabama Circus Cisco 1 06-04-2005 12:15 PM
[HIDE LAN] Hide a part of hosts into the LAN at VPN users? Paolo Bresi Cisco 1 04-04-2005 02:41 PM
"Hide Selection" - can this be remembered? Scott McNair ASP .Net 1 06-17-2004 02:26 PM



Advertisments