前台代码:
 <% foreach (Entity.Product p in lp)
                       {
                        
                       
                             %>
                       <TD align="center" valign="top">
<a href="<%=p.Pname%>" target="_blank"><img src="upfile/<%=p.Pimgurl%>"  width="90" height="50" /></a></td><td style="width: 25px">&nbsp;&nbsp;&nbsp;&nbsp;</td>
           
             <%} %>
后台代码:
  public List<Product> lp;
  lp = SWH.Data.Accesser<Product>.List.FindAll(s=>s.CategoryId==1);
            lp.Sort();为何前台说找不到定义lp,   我用的是否vs2005。不知道是什么原因?

解决方案 »

  1.   

    <%
    Entity.Product p;
    %>
    定义在外面<% foreach ( p in lp)
      

  2.   

    <% foreach (Entity.Product p in lp)
      {
        Response.Write("");
        }
      %>

    <% Entity.Product o;
      for(int i=0;i<lp.Count;i++)
      {
        o=lp[i];
       }
      %>
      

  3.   

    这些都用过了,也不行,还是自己打到的,原本是文件头那地方的事,我是修改别人的网站,别人用的是:CodeBehind=" "
                 
    改成codeFile=""  就好了,要不是,前台和后台都联系不到一起!
    可能是用的vs不一样的事.