Pagination - Nullable / Non-nullable

Dean Everhart 1,536 Reputation points

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?


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; }  
        public DateTime? Date { get; set; }  
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

    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