1

Pagination (Next button) doesn't work for custom BusinessDataListWebPart.

I am adding BusinessDataListWebPart using code. Everything works fine. I can see 20 data raw at the same time but when I click "Next Button", I can not see next 20-40 data. A postback occurs, but the pageindex never changes. I am using following code to add BusinessDataListWebPart to the Sharepoint site.

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;
user116627
  • 47
  • 1
  • 9
  • What do you mean with Custom webpart / pagination? where does the data come from, how is the pageindex sent to the datasource. Not much to go on here... – Colin Jun 24 '09 at 15:16
  • Custom webpart means I add BusinessDatalistwebpart using code to the sharepoint site. Data is coming from oracle database. I have provided application name and entity name to the webpart. Also, provided Xsl file link to the BDC Webpart. I can see the data from oracle database. I don't know how to send pageindex to the oracle database. Please let me know how to do that.. – user116627 Jun 24 '09 at 17:25

1 Answers1

1

OK..I found the answer.

For pagination I needed to add "ParameterBindings" to the business data list webpart. My final code is, It works perfect.

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\"" + "/>";
user116627
  • 47
  • 1
  • 9