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:
This is coming from the following code:
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
to this
How can I get the variable to work in this context? Any help would be appreciated. Thank you for your time.
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")%>" [COLOR="Green"]<%#DataBinder.Eval(Container.DataItem, "PERSONID").ToString().Equals(SubmitTo) ? "selected" : "" %>[/COLOR]><%#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.