MSDN > 論壇首頁 > SharePoint - Business Data Catalog > Custom BusinessDataListWebPart Pagination (Next Button) - pageindex never changes
發問發問
 

已答覆Custom BusinessDataListWebPart Pagination (Next Button) - pageindex never changes

  • 2009年6月24日 下午 03:06sHrUDiP 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     包含代碼
     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.
    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;
    • 已編輯sHrUDiP 2009年6月24日 下午 05:37
    •  

解答

  • 2009年6月24日 下午 07:42sHrUDiP 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆包含代碼

    OK..I found the answer.

    For pagination I needed to add "ParameterBindings" to the business data list webpart. My final code is following and 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\"" + "/>";

所有回覆

  • 2009年6月24日 下午 07:42sHrUDiP 使用者勳章使用者勳章使用者勳章使用者勳章使用者勳章
     已答覆包含代碼

    OK..I found the answer.

    For pagination I needed to add "ParameterBindings" to the business data list webpart. My final code is following and 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\"" + "/>";