Wrox Programmer Forums
|
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 2nd, 2006, 01:49 PM
Authorized User
 
Join Date: Sep 2005
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default ASP Repeater without DataBinder

Hi
I'm using a ASP:Repeater bound to an ArrayList as a DataSource
I have this code

<asp:Repeater id="myRepeaterPlain" runat="server">
  <ItemTemplate>
    <%# DataBinder.Eval(Container.DataItem, "Id") %>,
    <%# DataBinder.Eval(Container.DataItem, "Name") %>,
    <%# DataBinder.Eval(Container.DataItem, "URL") %>,
    <%# DataBinder.Eval(Container.DataItem, "Image") %>
    <br />
  </ItemTemplate>
</asp:Repeater>

I was wondering, how can i get the value stored in a Variable, because i would
like to do some checking before i "print" the value
It tried

<% string id = DataBinder.Eval(Container.DataItem, "Id"); %>

But i get an error with the Container saying that is not available in the scope or something

I would like to check the variable with some ifs (that's why i need it stored somewhere) like this

<% string id = DataBinder.Eval(Container.DataItem, "Id");
if(id > 100) {
%>
<h1> SOMETHING SOMETHING </h1>
<% } else { %>
<p> THIS IS JUST AN EXAMPLE </p>
<% } >

Get the idea ?

Thanks

 
Old February 3rd, 2006, 12:20 PM
Friend of Wrox
 
Join Date: Nov 2003
Posts: 1,348
Thanks: 0
Thanked 5 Times in 5 Posts
Default

Why are you using traditional ASP coding with ASP.NET technology?

Use the ItemDataBound event of the Repeater






Similar Threads
Thread Thread Starter Forum Replies Last Post
asp:hyperlink in repeater visibility spinout ASP.NET 2.0 Basics 11 February 27th, 2008 08:51 AM
ASP:Repeater and Mouseover gbrown ASP.NET 1.0 and 1.1 Basics 1 June 4th, 2007 01:17 AM
DataBinder Eval in Repeater New2VBnetChic Classic ASP Basics 0 August 18th, 2005 12:44 PM
Databinder.Eval jpfree71 ASP.NET 1.0 and 1.1 Basics 2 August 26th, 2004 11:07 AM
DataBinder.Eval(Container, etc. - Please explain pete_m ASP.NET 1.0 and 1.1 Basics 1 June 25th, 2004 11:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.