Pagination - Nullable / Non-nullable

Dean Everhart 1,536 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; }  
    }  
}  
ASP.NET Core
ASP.NET Core
A set of technologies in the .NET Framework for building web applications and XML web services.
4,384 questions
{count} votes

Accepted answer
  1. Michael Taylor 51,256 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