我现在做个咨询回复和点评的页面,一个咨询回复对应多个点评,
页面布局是:一个咨询回复(用Repeater绑定)在其下面加了上下页翻页的功能,一个点评(用另一个Repeater绑定)在其下面加了上下页翻页功能,就是页面中有二个Repeater控件,二个上下页翻页分别对应。问题是:点击咨询回复的上下页能实现点评翻页,可是当点击点评的上下页时,此时页面重新加载了,咨询就跳到第一页了。
我弄了2天了,都没搞好。现在我想问的是能不能把点评的数据 单独提取出来放在一个控件里,点击上下页时,不让页面重新加载,有这样的控件吗?这样的想法对吗???
请问我怎么做呀???
摆脱啦!!!

解决方案 »

  1.   

    一般只对一个数据列表控件实现分页
    两个都分页使用AJAX异步,还可使用extjs
      

  2.   

    TO:人生如梦帮帮忙怎么弄呀  这个“两个都分页使用AJAX异步,还可使用extjs”什么意思?能给点代码吗???谢谢啦
      

  3.   

    你的点评分页代码是怎么样的??怎么会重新加载咨询的数据呢??有没有用if(!Page.IsPostBack)??
      

  4.   

     public partial class WebForm1 : System.Web.UI.Page
        {
            private SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["Con"].ConnectionString);        protected void Page_Load(object sender, EventArgs e)
            {
                ParentRepeater.ItemDataBound += new RepeaterItemEventHandler(ParentRepeater_ItemDataBound);
                string strTxt = "select * from online order by id";
                SqlCommand com = new SqlCommand(strTxt, conn);
                SqlDataAdapter adapter = new SqlDataAdapter(com);
                DataSet ds = new DataSet();
                conn.Open();
                adapter.Fill(ds);
                PagedDataSource pds = new PagedDataSource();
                conn.Close();
                pds.DataSource = ds.Tables[0].DefaultView;
                pds.AllowPaging = true;
                pds.PageSize = 1;
                int Pageindex;
                if (Request.QueryString["page"] != null)
                {
                    Pageindex = Convert.ToInt32(Request.QueryString["page"]);
                }
                else
                {
                    Pageindex = 1;
                }
                //设置当前页
                if (Pageindex < 1)
                {
                    Pageindex = 1;
                }
                pds.CurrentPageIndex = Pageindex - 1;
                ParentRepeater.DataSource = pds;
                ParentRepeater.DataBind();
                //显示上下翻页
                lbn_Prev.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + (Pageindex - 1);
                lbn_Next.NavigateUrl = Request.CurrentExecutionFilePath + "?page=" + (Pageindex + 1);
                //确定链接的显示方式
                if (Pageindex <= 1 && pds.PageCount <= 1)
                {
                    lbn_Prev.NavigateUrl = "";
                    lbn_Next.NavigateUrl = "";
                }
                if (Pageindex <= 1 && pds.PageCount > 1)
                {
                    lbn_Prev.NavigateUrl = "";
                }
                if (Pageindex >= pds.PageCount)
                {
                    lbn_Next.NavigateUrl = "";
                }
            }        protected void ParentRepeater_ItemDataBound(object sender, RepeaterItemEventArgs e)
            {
                if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
                {
                    DataRowView row = (DataRowView)e.Item.DataItem;
                    string parentID = row["ID"].ToString();
                    string strSql = "select * from dp where id=" + parentID + " order by C_ID";
                    SqlCommand com = new SqlCommand(strSql, conn);
                    SqlDataAdapter adapter = new SqlDataAdapter(com);
                    DataSet dt = new DataSet();
                    adapter.Fill(dt);
                    PagedDataSource pds = new PagedDataSource();
                    pds.AllowPaging = true;
                    pds.PageSize = 1;
                    int Pageindex;
                    pds.DataSource = dt.Tables[0].DefaultView;
                    if (dt.Tables[0].DefaultView != null)
                    {
                        ChildRepeater.DataSource = pds;
                        ChildRepeater.DataBind();
                    }
                    if (Request.QueryString["Tpage"] != null)
                    {
                        Pageindex = Convert.ToInt32(Request.QueryString["Tpage"]);
                    }
                    else
                    {
                        Pageindex = 1;
                    }
                    //设置当前页
                    if (Pageindex < 1)
                    {
                        Pageindex = 1;
                    }
                    pds.CurrentPageIndex = Pageindex - 1;
                    //显示上下翻页
                    lbn_APre.NavigateUrl = Request.CurrentExecutionFilePath + "?Tpage=" + (Pageindex - 1);
                    lbn_ANext.NavigateUrl = Request.CurrentExecutionFilePath + "?Tpage=" + (Pageindex + 1);
                    //确定链接的显示方式
                    if (Pageindex <= 1 && pds.PageCount <= 1)
                    {
                        lbn_APre.NavigateUrl = "";
                        lbn_ANext.NavigateUrl = "";
                    }
                    if (Pageindex <= 1 && pds.PageCount > 1)
                    {
                        lbn_APre.NavigateUrl = "";
                    }
                    if (Pageindex >= pds.PageCount)
                    {
                        lbn_ANext.NavigateUrl = "";
                    }
                }
            }
        }