[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Asp:repeater & linkbutton

Posted on 2006-11-23
4
Medium Priority
?
787 Views
Last Modified: 2012-05-05
Hi
I am writing a web application in vb.net(Visual studio 2003)
on the page I have a repeater that lists account details and underneath each record I want a linkbutton to appear based on the account type
How do I test a value againt a dataitem in the repeater.

I have tried the code below but get a container not declared error

<asp:repeater id=AccountListing runat="server" DataSource="<%# dsaccounts %>" DataMember="customeraccount">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "CompanyName")%>
<%# DataBinder.Eval(Container.DataItem, "AddressLine1")%>
<%# DataBinder.Eval(Container.DataItem, "AddressLine2")%>
<%# DataBinder.Eval(Container.DataItem, "City")%>
<%if  DataBinder.Eval(Container.DataItem, "AccountType") = "S1" then %>
<asp:lINKButton  id="MoreInfoLink" oncommand="MoreInfoLink_command" runat="server" text="More Info">
<asp:lINKButton>
<% end if %>
</ItemTemplate>
</asp:repeater>
0
Comment
Question by:canbar
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 

Author Comment

by:canbar
ID: 18001762
Sorry forgot to mention the error occurs at the  on the line of the IF statement
0
 
LVL 12

Expert Comment

by:sandip132
ID: 18001881
0
 
LVL 58

Accepted Solution

by:
amit_g earned 1500 total points
ID: 18004572
Change

<%if  DataBinder.Eval(Container.DataItem, "AccountType") = "S1" then %>
<asp:lINKButton  id="MoreInfoLink" oncommand="MoreInfoLink_command" runat="server" text="More Info">
<asp:lINKButton>
<% end if %>

to

<asp:lINKButton  id="MoreInfoLink" oncommand="MoreInfoLink_command" runat="server" text="More Info"  Visible='<%# DataBinder.Eval(Container.DataItem, "AccountType") = "S1" %>'>
<asp:lINKButton>
0
 
LVL 58

Expert Comment

by:amit_g
ID: 18005410
What better could the solution be for an A?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question