Solved

Asp:repeater & linkbutton

Posted on 2006-11-23
4
784 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 500 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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…
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

690 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