Data înscrierii: 18 mai 2022

0 like-uri primite
0 comentariu primit
0 răspuns excelent

1st-Studio-Siberian-Mouse-HD-129...ND-14-.rar --> DOWNLOAD

1st-Studio-Siberian-Mouse-HD-129...ND-14-.rar --> DOWNLOAD

Category:Mongolian cuisine Category:Farewell ducksQ: Pagination and Determining Id for User I am working on a C# ASP.NET MVC project. I am using EntityFramework as the ORM. I have a FAQ page that I paginate. I am using a Model that has a list of FAQs. These FAQs are returned in the Index View as a ViewModel. My problem is I want to pass an Id to my viewmodel instead of just passing the FAQs back. How can I determine what the Id is for the particular user after a page has been served? A: Take the ID from the URL and pass it to the view model. I can think of a couple of ways of doing this (whether you need to just pass the ID depends on the view model's purpose, whether you need to depend on user specific view models, etc.). 1. Do it with the URL I'd pass the ID to the view model and have the controller pull it out of the URL: public ViewResult Page(int pageNumber, int pageSize) { var model =... var id = pageNumber * pageSize; model.Id = id; return View(model); } 2. Pull it from the Request The Request object is available to your action filter (or the OnActionExecuting method) in all request actions. Assuming you need to do this on each page request, you can read the id from the current HttpContext.Request.QueryString: public ActionResult Page(int pageNumber, int pageSize) { var model =... if (HttpContext.Current.Request.QueryString["id"]!= null) { var id = int.Parse(HttpContext.Current.Request.QueryString["id"]); model.Id = id; } return View(model); } /* * * (c) Copyright Ascensio System Limited 2010-2017 * * This program is a free software product. You can redistribute it and/or * modify it under the terms of the GNU Affero General Public License (AGPL