分页(下一步按钮)不适用于自定义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;
答案 0 :(得分: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\"" + "/>";