Cassie Mod

Cassie Mod

  • NA
  • 488
  • 71.2k

change function so it will only get a part of the users

Mar 6 2017 9:19 AM
HI ,
 
Ive got the following webapp. using asp.net /c# .
Now when we go to the userpage. The page_load will be loaded.
IN the paige load there is a function to check if it is a postback. If it isn't a postback a function is called to get the users and show them in a repeater. However. The first time it loads it get all the users. the second time it doesn;t get the users ( because, it is a postback). Olso every page shows 10 users ( for now) we can change that by editing the pageSize.
 
How can i change te code, so it will only get the users it need ( not all of them). here is the code. please give me some advice or tips how to change the code.
 
  1.  protected void Page_Load(object sender, EventArgs e)  
  2.         {  
  3.   
  4.             try  
  5.             {  
  6.                 if (PortalApplication == null)  
  7.                     return;  
  8.   
  9.                 if (!IsPostBack)  
  10.                     FillRptUsers();  
  11.   
  12.             }  
  13.             catch (Exception ex)  
  14.             {  
  15.                 PortalApplication.HandleException(ex);  
  16.                 ShowFailureText();  
  17.             }  
  18.         }  
  19.   
  20. public void FillRptUsers()  
  21.         {  
  22.             var serviceProviderId = PortalApplication.User.serviceProviderId;  
  23.             var groupId = PortalApplication.User.groupId;  
  24.             var users = PortalApplication.GetGroupUsers(serviceProviderId, groupId, UserFilter.Text, (CurrentPage - 1) * PageSize, PageSize);  
  25. }  
 
 
 

Answers (4)