Here is my issue. I have a SearchViewModel
that has a large number of search criteria, the values simply won't fit in the URL. I'm currently using Troy Goode's Html.PagedListPager
, but it is designed to use Url.Action()
to send the parameters in the URL. Here is an example. I don't think client-side filtering is an option, due to the fact I'll have a lot of records.
@Html.PagedListPager(
(IPagedList)@Model.SearchResults,
page => Url.Action("Results",
new {
YearBuiltFrom = Model.YearBuiltFrom,
}
))
}
This is a fine solution if you only have one or two simple parameters.
SearchViewModel
public class SearchViewModel
{
public int? page { get; set; }
public int? size { get; set; }
[IgnoreDataMember]
public IPagedList<Property> SearchResults { get; set; }
public string[] Locations { get; set; }
[IgnoreDataMember]
public MultiSelectList LocationOptions { get; set; }
public string[] ZipCodes { get; set; }
[IgnoreDataMember]
public MultiSelectList ZipCodeOptions { get; set; }
[Display(Name="Year Built")]
public int? YearBuiltFrom { get; set; }
[Display(Name = "Year Built")]
public int? YearBuiltTo { get; set; }
public int? SqftFrom { get; set; }
public int? SqftTo { get; set; }
public string Bedrooms { get; set; }
public string Bathrooms { get; set; }
[DataType(DataType.Date)]
public DateTime? SalesFrom { get; set; }
[DataType(DataType.Date)]
public DateTime? SalesTo { get; set; }
public int? SaleAmountFrom { get; set; }
public int? SaleAmountTo { get; set; }
public int? LandAreaFrom { get; set; }
public int? LandAreaTo { get; set; }
public string[] Waterfront { get; set; }
[IgnoreDataMember]
public MultiSelectList WaterfrontOptions { get; set; }
//TODO: Implement LandAreaType as a search parameter
//public string LandAreaType { get; set; }
public Boolean? IsVacant { get; set; }
public string[] PropertyFeatures { get; set; }
[IgnoreDataMember]
public MultiSelectList PropertyFeatureOptions { get; set; }
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…