Solved

Asp:repeater & linkbutton

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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:  The Exchange of information …
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…
This video discusses moving either the default database or any database to a new volume.
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

747 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

12 Experts available now in Live!

Get 1:1 Help Now