//自动生成的前台代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="cs20100311160156.aspx.cs" Inherits="tree.Web.aspx.cs20100311160156" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>    <script type="text/javascript">
    
      function pageLoad() {
      }
    
    </script>    <style>
        </style>
            <script src="/js/FancyZoom.js" type="text/javascript"></script>    <script src="/js/FancyZoomHTML.js" type="text/javascript"></script>
</head>
<body style="font-size:12px;">
    <form id="form1" runat="server">
    <div style="width: 658px">
        <asp:DataList ID="DataList1" runat="server" RepeatColumns="4" 
            RepeatDirection="Horizontal" Width="650px">
        <ItemTemplate>
        <a href="/Images/<%# Eval("tree_img") %>"><img style="border:none;" src="/web/imgs/<%# Eval("tree_img") %>" width="145" height="145" /></a>
        <br />名称:<%# Eval("tree_name") %>
        <br />价格:¥<%# Eval("tree_price") %>
        <br />点击:<%# Eval("tree_count") %>
        </ItemTemplate>
        </asp:DataList>
      <div style="text-align: center;">
                <asp:Label ID="lblPriv" runat="server"></asp:Label>
                &nbsp;&nbsp;&nbsp;&nbsp;
                <asp:Label ID="lblNext" runat="server"></asp:Label>
                &nbsp;
                <asp:Label ID="lblMsg" runat="server" Text=""></asp:Label>
            </div>
    </div>
    </form>
</body>
</html>
//后台代码
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;namespace tree.Web
{
    public partial class cs20100311160156 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DataTable table = new BLL.tree_table().GetList("", "tree_type=7 order by ID").Tables[0];
                
                PagedDataSource obj = new PagedDataSource();
                obj.DataSource = table.DefaultView;
                obj.AllowPaging = true;
                obj.PageSize = 12;//设定每页显示的数目
                obj.CurrentPageIndex = 0;//指定当前数据的下标
                if (Request.QueryString["pageIndex"] != null)
                {
                    obj.CurrentPageIndex = Convert.ToInt32(Request.QueryString["pageIndex"].ToString());                }
                if (!obj.IsFirstPage)
                {
                    lblPriv.Text = "<a href=?pageIndex=" + (obj.CurrentPageIndex - 1).ToString() + ">上一页</a>";
                }
                else
                {
                    lblPriv.Text = "上一页";
                }
                if (!obj.IsLastPage)
                {
                    lblNext.Text = "<a href=?pageIndex=" + (obj.CurrentPageIndex + 1).ToString() + ">下一页</a>";
                }
                else
                {
                    lblNext.Text = "下一页";
                }                DataList1.DataSource = obj;
                DataList1.DataBind();
                lblMsg.Text = "当前是第" + (obj.CurrentPageIndex + 1) + "页/总共:" + obj.PageCount + "页";               
            }
        }    }
}

解决方案 »

  1.   

    分析器错误 
    说明: 在分析向此请求提供服务所需资源时出错。请检查下列特定分析错误详细信息并适当地修改源文件。 分析器错误消息: 未能加载类型“tree.Web.aspx.cs20100311160156”。源错误: 
    行 1:  <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="cs20100311160156.aspx.cs" Inherits="tree.Web.aspx.cs20100311160156" %>
    行 2:  
    行 3:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
     源文件: /aspx/cs20100311160156.aspx    行: 1 
    --------------------------------------------------------------------------------
    版本信息: Microsoft .NET Framework 版本:2.0.50727.3603; ASP.NET 版本:2.0.50727.3082 
      

  2.   

    Inherits="tree.Web.aspx.cs20100311160156"???
      

  3.   

    动态生成的时候谢错了吧,,,
    Inherits="tree.Web.aspx.cs20100311160156".....
      

  4.   

    不对吧! 这个是写命名空间的啊! 我是放在aspx文件夹里面啊