0

我正在尝试将我的转发器与 dataview 绑定,但是当我通过断点看到它时,它没有在 dataview 中显示数据

 private void Get_Data()
    {
        String File = Server.MapPath("BlogContent.xml");
        DataSet ds = new DataSet();
        ds.ReadXml(File);

    DataView dv = new DataView(ds.Tables[0]);
        DataTable dt = dv.Table;
        ViewState.Add("Mytable", dt);

    }

    private void Bind_Data(int take, int pageSize)
    {
        PagedDataSource page = new PagedDataSource();
        page.AllowCustomPaging = true;
        page.AllowPaging = true;
        DataTable dtv = (DataTable)ViewState["Mytable"];
        DataView dv = new DataView();
        dv = dtv.DefaultView;
        dv.RowFilter = "id>=" + pageSize + " AND " + "id<=" + take;
        page.DataSource = dv;
        page.PageSize = psize;
        Repeater1.DataSource = page;
        Repeater1.DataBind();
        if (!IsPostBack)
        {
            int rowcount = dtv.Rows.Count;
            CreatePagingControl(rowcount);
        }

    }   

 PagedDataSource page = new PagedDataSource();
            page.AllowCustomPaging = true;
            page.AllowPaging = true;
            DataTable dtv = (DataTable)ViewState["Mytable"];
            DataView dv = new DataView();
            dv = dtv.DefaultView;
            dv.RowFilter = "id>=" + pageSize + " AND " + "id<=" + take;
            page.DataSource = dv;
            page.PageSize = psize;
            Repeater1.DataSource = page;
            Repeater1.DataBind();
            if (!IsPostBack)
            {
                int rowcount = dtv.Rows.Count;
                CreatePagingControl(rowcount);
            }

请检查并告诉我哪里出错了。我尝试在转发器中添加分页控制分页显示的数量,但数据视图中没有获取数据。当我检查我的数据表时,它正在填充,但是当涉及到数据视图时,我什么也没有显示

4

1 回答 1

0

我得到了答案.. 我的 xml 中的 id 顺序不正确在我的 xml 中,每个节点的 id 就像

5 3 4 1 2

我做对了 1 2 3 4 5

它现在正在工作....

于 2013-07-15T11:46:32.230 回答