Pagination - Nullable / Non-nullable

Dean Everhart 1,541 Reputation points
2022-11-29T20:10:28.347+00:00

Working on Pagination Tutorial for Core 6.

Pagination would not work with nullable string property. I created a non-nullable string property and the code works well.

I would like to be able to paginate on either a nullable or non-nullable properties: Is there a restriction on pagination to non-nullable properties? Why would I be experiencing this?

Model

using System.ComponentModel.DataAnnotations;  
  
namespace Project.Models  
{  
    public class Model  
    {  
        public int ID { get; set; }  
  
        public string? Text { get; set; }                                              <- would not allow pagination  
  
        public string TextNoNull { get; set; }                                     <- allows pagination  
  
        public int? Number { get; set; }  
  
        public bool? Bool { get; set; }  
  
        [DataType(DataType.Date)]  
        public DateTime? Date { get; set; }  
    }  
}  
Developer technologies | ASP.NET | ASP.NET Core
{count} votes

Answer accepted by question author
  1. Michael Taylor 61,106 Reputation points
    2022-11-29T22:08:10.173+00:00

    We don't have enough context here to be useful. Paging, in general, works against anything. Please provide the code that you're using to actually do the paging (as that is where the problem lies) along with any errors you're getting and ideally a set of sample code and data to replicate your problem with.


0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.