c# - The name does not exist in the current context inline -
I have a problem where I am inline a foreach on my default.aspx and I'm getting ??? ? Does not exist in the current context ???? There is an error for the collection list lst that I created behind in my code. IA is not sure what is missing, I can see the control with my code so that I know that page_load is firing.
Should I look first in my designer? If not being produced correctly, then I am not 100% positive. I added a test verbal and added that was added. I have compiled my project in debug and runtime
- Namespace matches
- is set to true
- Put! Page Iso Postback
I can loop through mysteries and add a literal values and see the values I can come by.
Thank you for any help.
& lt;% @ page title = "home page" language = "c #" masterpagefile = "~ / masterpages / website.master" codebahind = "default.aspx.cs" inherited = "Admin. Default" autoAvntware = "true" & gt%; & Lt; Asp: Content ID = "Content1" content placeholder = "content placeholder 1" runat = "server" & gt; & Lt; H2 & gt; & Lt; / H2 & gt; & Lt; Div & gt; & lt;% foreach (Services in list service) {%> & Lt;%}% & gt; & Lt; ASP: Little ID = "ltrl_ServiceList" runat = "server" /> & Lt; / Div & gt; & Lt; / ASP: Content & gt;
Back-up code
using the system; Using System.Collections.Generic; Using System.Linq; Using System.Web; Using System.Web.UI; Using System.Web.UI.WebControls; Using System.Data; Using System.configuration; Using System.Collections; Using System.Web.Security; Using System.Web.UI.HtmlControls; Using System.Security.Principal; Using RecycleAdmin.Utilities; Using System.Data.SqlClient; Using the system. Namespace Admin {Public Partial Category _Default: System.Web.UI.Page {// Make Your Properties Safe Page_Load (Object Sender, EventArgs e) {getListOfClosuresFollowups (); If (! Page.IsPostBack) {DataTable dt = getTable (); & Lt; Services & gt; Lst = dt.ToCollection & lt; Services & gt; (); Foreach (lst in service) {ltrl_ServiceList.Text = = service.service_nm.ToString (); }}}}}}
= "post-text" itemprop = "text">OK, you created a local variable named
At a minimum, you will need to declare it as the area or property of the
protected class and it will be accessible from the markup portion of your page:
class .... {protected list & lt; Services & gt; lst; }
BTW, it is sad that you need to
to
loop:
Comments
Post a Comment