Solved

Asp:repeater & linkbutton

Posted on 2006-11-23
4
779 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 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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…
Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now