Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Accessing Variable from Repeater

Reply
Thread Tools

Accessing Variable from Repeater

 
 
beanland beanland is offline
Junior Member
Join Date: Mar 2010
Posts: 1
 
      03-10-2010
Hello,

I am trying to set up a repeater and have certain data be displayed conditionally. This is done by comparing something in Databinder.Eval to a variable I have. However, I keep getting the following error:

Code:
CS0103: The name 'SubmitTo' does not exist in the current context
This is coming from the following code:

Code:
<select name="newSubmitTo">
<ASP:Repeater id="rSubmitTo" runat="server">
<ItemTemplate>
<option value="<%#DataBinder.Eval(Container.DataItem , "PERSONID")%>" <%#DataBinder.Eval(Container.DataItem, "PERSONID").ToString().Equals(SubmitTo) ? "selected" : "" %>><%#DataBinder.Eval(Container.DataItem, "PERSONFULLNAME")%></option>
</ItemTemplate>
</ASP:Repeater>
</select>
I've highlighted the offending bit of code. Now, this perplexes me because when I want to interact with this variable outside of the Repeater, I have no problem whatsoever--

<%Response.Write(SubmitTo);%> works both before the <ASP:Repeater> tag and after its ending </ASP:Repeater> tag.

If I change the following

Code:
<%#DataBinder.Eval(Container.DataItem, "PERSONID").ToString().Equals(SubmitTo) ? "selected" : "" %>
to this

Code:
<%#DataBinder.Eval(Container.DataItem, "PERSONID").ToString().Equals(63) ? "selected" : "" %>
How can I get the variable to work in this context? Any help would be appreciated. Thank you for your time.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
repeater inside a repeater problem. uncensored ASP .Net 0 10-25-2006 06:10 PM
Repeater inside a repeater....how? voidfill3d@yahoo.com ASP .Net 1 08-10-2005 01:58 PM
Repeater Using Javascript Referencing a Column in the Repeater rwoo_98@yahoo.com ASP .Net 0 02-26-2005 05:02 PM
Repeater control with nested repeater chris.reed@digus.com ASP .Net 0 02-11-2005 05:10 PM
Accessing a global variable when there is a local variable in the same name Mohanasundaram C Programming 44 08-23-2004 11:17 PM



Advertisments