SiteExperts.com Logo Home | Community | Developer's Paradise
User Groups | Site Tools | Site Information | Search
 Main Menu
 Forums
SiteExperts.com Forums
All Discussions

SiteExperts Feedback
The Lounge
Dynamic HTML
Site Design/ Critiques
HTML and CSS
XML Technologies
The Wireless Internet
Internet Explorer
Microsoft .NET
The Server
Technical Support

Sponsored Links

User Groups : Forums : SiteExperts : Microsoft .NET :

Previous DiscussionNext Discussion
 Link Button problem.

Ok...I'll bet it's good to see an actual issue on here.

Today I was tasked with modifying some code. We need to make a link button appear, but only when certain criteria is met.

Due to the nature of the functionality, I'm using a DataList, and so I'm populating it with DataBinder.Eval(Container.DataItem, "MY_FIELD").

That piece works fine.

What I want to do, though, is use something similar to that to essentially toggle a LinkButton (again, it's a functionality thing, and there's too much to re-write at this point).

I've tried various things.

Anyone got any ideas?

Basically, what I want is this:

If (DataBinder.Eval(Container.DataItem, "MY_FIELD") = "A") Then
' Show the Link Button
End If

Started By Monte on Oct 24, 2008 at 12:53:39 PM

6 Response(s) | Reply

Earlier Replies | Replies 5 to 6 of 6 | Later Replies
jalarie on Oct 29, 2008 at 7:30:34 AM (# 5)

I don't know "DataBinder" and you didn't mention what language you're using, so these are only wild guesses:

Should the equals sign (=) be doubled like this:

If (DataBinder.Eval(Container.DataItem, "MY_FIELD") == "A" Then Show the Link Button
End If

Perhaps you should be using all lower-case.

In Perl, the equals sign should be "eq" to check a non-numeric field.


Monte on Oct 29, 2008 at 11:32:37 AM (# 6)
This message has been edited.

I was using VB.NET in an ASP.NET app.

I figured it out yesterday. Here's the solution:

<asp:LinkButton ID="MyLinkButton" runat="server" CommandName="reopen" Font-Bold="true" Font-Italic="true" Text="Re-Open" Visible=<%# IIF (Container.DataItem("STATUS") = "Closed","true","false") %> />

That did the trick. Took me three days to figure that out. That's way too long.


Earlier Replies | Replies 5 to 6 of 6 | Later Replies

To respond to a discussion, you must first logon.

If you are not registered, please register yourself to become a member of the SiteExperts.community.

User Name
Password
Copyright 1997-2004 InsideDHTML.com, LLC. All rights reserved.