1

分页(下一步按钮)不适用于自定义 BusinessDataListWebPart。

我正在使用代码添加 BusinessDataListWebPart。一切正常。我可以同时看到 20 个原始数据,但是当我单击“下一步按钮”时,我看不到接下来的 20-40 个数据。回发发生,但 pageindex 永远不会改变。我正在使用以下代码将 BusinessDataListWebPart 添加到 Sharepoint 站点。

BusinessDataListWebPart consumer = new BusinessDataListWebPart();
    consumer.Title = title;
    consumer.Application = instance.Name;
    consumer.Entity = projEntity.Name;

    consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
    consumer.PageSize = 20;
4

1 回答 1

1

好的..我找到了答案。

对于分页,我需要将“ParameterBindings”添加到业务数据列表 webpart。我的最终代码是,它完美无缺。

BusinessDataListWebPart consumer = new BusinessDataListWebPart();
ServerContext serverContext = ServerContext.GetContext(site);
            SqlSessionProvider.Instance().SetSharedResourceProviderToUse(serverContext);
            LobSystemInstance instance = ApplicationRegistry.GetLobSystemInstanceByName(applicationName); 
            Entity projEntity = instance.GetEntities()[entityName];

            consumer.Title = title;
            consumer.Application = instance.Name;
            consumer.Entity = projEntity.Name;

            consumer.XslLink = "/Style%20Library/XSL%20Style%20Sheets/" + xslFileName;
            consumer.PageSize = 20;

            consumer.ParameterBindings = "<ParameterBinding Name=" + "\"dvt_firstrow\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
                   " <ParameterBinding Name=" + "\"dvt_sortdir\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
                   " <ParameterBinding Name=" + "\"dvt_sortfield\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
                   " <ParameterBinding Name=" + "\"dvt_filterfields\"" + " Location=" + "\"Postback;Connection\"" + "/>" +
            " <ParameterBinding Name=" + "\"dvt_partguid\"" + " Location=" + "\"Postback;Connection\"" + "/>";
于 2009-06-24T19:38:35.380 回答