不知道哪位GGJJ研究过Pet Shop3.0,在Category.aspx我看了半天就找不到它那些数据是在什么时候绑定的,还有那个Repeater控件是怎么样产生的,还忘各位指教

解决方案 »

  1.   

    关键是这几句
    (1)IList productsByCategory = product.GetProductsByCategory(categoryKey);
    (2)products.DataSource = productsByCategory;
    (3)products.DataBind();(1)查看PetShop\BLL\Product.cs 中的
    public IList GetProductsByCategory(string category) 
    {// Return null if the string is empty
    if (category.Trim() == string.Empty) 
    return null;// Get an instance of the Product DAL using the DALFactory
    IProduct dal = PetShop.DALFactory.Product.Create();  //查看PetShop\DALFactory\Product.cs中的相应方法public static PetShop.IDAL.IProduct Create()// Run a search against the data store
    return dal.GetProductsByCategory(category);
    }在VS.NET中用右键"转到定义"可以查看相应的代码...
      

  2.   

    我发现
    IList productsByCategory = product.GetProductsByCategory(categoryKey);
    // Store the results of the call in the Cache and set the time out to 12 hours
    Cache.Add(categoryKey, productsByCategory, null, DateTime.Now.AddHours(12), Cache.NoSlidingExpiration , CacheItemPriority.High, null);
    products.DataSource = productsByCategory;
    是在翻页事件里面啊,我跟踪的话,它也没有执行这个方法啊