Dears,
Iam a beginner in umbraco and i want to make pagination with custom list that comes from database.
1. First i made the following controller with an action result with template name to render view to user.
public class formsPageController : Umbraco.Web.Mvc.RenderMvcController
{
public ActionResult Index(RenderModel model)
{
return base.Index(model);
}
public ActionResult ServiceProviders(ServiceProviderSearchForUmbracoViewModel model)
{
using (CustomUoW uow = new CustomUoW())
{
int categoryId = 0;
bool parseSuccess = int.TryParse(Request["category"], out categoryId);
if (parseSuccess)
{
model.ServiceProviderSearchViewModel = new ServiceProviderSearchViewModel();
model.ServiceProviderSearchViewModel.ServiceCatagoryId = categoryId;
var results = uow.ServiceProviders.GetList(model.ServiceProviderSearchViewModel);
model.ServiceProviderSearchViewModel.Items = new StaticPagedList<ServiceProviderViewModel>(results, results.PageNumber, results.PageSize,
results.TotalItemCount);
return CurrentTemplate(model);
}
else
{
return CurrentTemplate(model);
}
}
}
}
3. And Make controller that extend surface controller:
public ActionResult RenderCategoryServicesByCategoryId(ServiceProviderSearchForUmbracoViewModel searchModel)
{
using (CustomUoW uow = new CustomUoW())
{
var results = uow.ServiceProviders.GetList(searchModel.ServiceProviderSearchViewModel);
searchModel.ServiceProviderSearchViewModel.Items = new StaticPagedList<ServiceProviderViewModel>(results, results.PageNumber, results.PageSize, results.TotalItemCount);
return View("~/Views/" + "ServiceProviders.cshtml", searchModel);
}
}
This line of code is not correct and give me null reference and i donot know how to handle pagination in this code and in normal mvc app this line work well. can anyone help me in this
Need help in making pagination with custom list
Dears, Iam a beginner in umbraco and i want to make pagination with custom list that comes from database.
1. First i made the following controller with an action result with template name to render view to user.
2.Then made the following template for user:
3. And Make controller that extend surface controller:
This line of code is not correct and give me null reference and i donot know how to handle pagination in this code and in normal mvc app this line work well. can anyone help me in this
is working on a reply...