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.
- protected void Page_Load(object sender, EventArgs e)
- {
- try
- {
- if (PortalApplication == null)
- return;
- if (!IsPostBack)
- FillRptUsers();
- }
- catch (Exception ex)
- {
- PortalApplication.HandleException(ex);
- ShowFailureText();
- }
- }
- public void FillRptUsers()
- {
- var serviceProviderId = PortalApplication.User.serviceProviderId;
- var groupId = PortalApplication.User.groupId;
- var users = PortalApplication.GetGroupUsers(serviceProviderId, groupId, UserFilter.Text, (CurrentPage - 1) * PageSize, PageSize);
- }

Chetan RanpariyaRank #1,852 · 801 reputationPosted Mar 6, 2017, 4:55 AM EST
How are you getting only 10 users in PostBack?
Cassie ModRank #3,821 · 387 reputationPosted Mar 6, 2017, 5:08 AM EST
so if it is the first page. first 10, if it is the second page, skip 10 and take 10 something like that.
Chetan RanpariyaRank #1,852 · 801 reputationPosted Mar 6, 2017, 5:18 AM EST
In that case can you share code of "PortalApplication.GetGroupUsers".
What are you using for getting data from the database? ADO.NET or Entity Framework ?
Cassie ModRank #3,821 · 387 reputationPosted Mar 6, 2017, 11:27 PM EST