[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Asp:repeater & linkbutton

Posted on 2006-11-23
4
Medium Priority
?
792 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
  • 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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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 video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month19 days, 7 hours left to enroll

873 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