In MVC 5 (.Net Framework 4.6) i used PagedList.Mvc with following solutions:
It separates query into pages and gets results for needed page (not all query results).
It used HtmlHelper to render group of buttons with needed filter!
I could customize numbers of pager buttons to display (if get large resultset).
In asp.net core 2.0 documentation https://learn.microsoft.com/en-us/aspnet/core/data/ef-rp/sort-filter-page i can't find 2 and 3 solutions.
Does anyone know better approach?
I tried PagedList from https://github.com/dncuug/X.PagedList it worked!
I used X.PagedList this link was very helpful
https://github.com/troygoode/PagedList/blob/master/README.markdown#example
Related
I am using the standard new ASP.NET Core 3.1 + Angular project template and I am trying to find the text displayed on the standard Log In page:
This is displayed at https://localhost:xxxxx/Identity/Account/Login
Searching all files in the solution for any text from this form returns no results and I am starting to think it's in a DLL or some other place I don't see. Is that the case?
Where can I modify that text?
ASP.NET Core provides ASP.NET Core Identity as a Razor Class Library. And it enables us to apply the scaffolder to selectively add the source code contained in the Identity Razor Class Library (RCL), then you can modify the code and change the behavior based on your actual scenario and requirement.
For more information about "Scaffold Identity in ASP.NET Core projects", you can refer to this doc: https://learn.microsoft.com/en-us/aspnet/core/security/authentication/scaffold-identity?view=aspnetcore-3.1&tabs=visual-studio
This appears to have been moved into a Razor Class library, source here.
When creating a new ASP.Net Core web project in ASP.Net Core 2.0, and choosing the 'Individual account' authentication option, the authentication views/controllers where originally implemented using ASP.Net MVC. Recently it appears they have been updated to use Razor pages. My questions is...is there a way I can revert the new project template to using the MVC instead of Razor pages or at the very least is there a way I can see what code the MVC template used to create?
Simply, no. Identity now comes with a Razor Class Library containing a default UI, which as you've noted, is Razor Pages-based. If you want the old-style MVC setup, you'll need to create it yourself. You can scaffold the Default UI pages into your project and then refer to these to move code into controllers/views. Then, when you're done with that, remove the default UI pages in your project, and turn off the default UI in general by using AddIdentity<TUser, TRole> instead of AddDefaultIdentity<TUser> (which adds the default UI under the hood).
FWIW, I used to be totally opposed to Razor Pages until I endeavor the same thing you're about to embark on. After moving all the code into controllers, I started to remember how much of a mess it actually was. There's so much boilerplate code involved in auth: sign in, sign out, registration, password resets, 2FA, third-party login, etc. You end up with monstrous controllers with hundreds or even thousands of lines of code. Even if you try to break it up into many different controllers, that just kind of makes it worse. Long and short, Razor Pages actually works pretty well for something like this. It keeps each unit of functionality self-contained, so you know exactly where your need to go to edit stuff. I'd encourage you to give it a go as-is, first, and see how it works for you.
Also, one of your main concerns may be the Web Forms style of routing with Razor Pages, where you the path becomes the URL, and if you're like me, that probably offends your sensibilities. This can actually be changed, though it's not documented well at all. You can simply specify whatever route you'd like the page to have with the #page directive. For example, you could do something like following in Login.cshtml:
#page "/signin"
Then, you can access the page via /signin, instead of /Identity/Account/Login.cshtml.
I'm trying to implement some days Breeze in my project with NHibernate and webapi 2 but without success.
Examples on github are for webapi 1
I'm having several problems, among them:
Not exist BreezeNHController in webapi 2
With IUnitOfWork architecture, ContextProvider was confused.
I tried to add the attribute BreezeController to the controller but to perform the action {{odata}}/GruposUsuarios?$filter=substringof('Vivo', Nome) still having trouble translating the query.
The main objective is to use Breeze to perform queries using odata queries as substringof and expand.
Any help will be appreciated!
The nuget package is now available, and the NorthBreeze sample
is now updated to use Breeze 1.4.8 and WebApi 2
With this update, your queries should be working in Web Api 2. Please let me know if they are not. Thanks.
Using ASP.NET MVC 4 and T4MVCExtension 4.0, I generate a link with #Url.Action(T4Controllers.EnhancementList.ByVotes()) and get http://localhost:1025/Enhancements/EnhancementList?Area=. Any ideas on how to get rid of that extra-ugly url parameter?
Note: I thought of titling this "Areas? We don't need no stinkin' Areas."
Mostly the same as T4MVC #Url.Action(MVC.Controller.Action()) Renders "?Area=" Parameter in QueryString. Though I thought that was fixed earlier. What T4MVC version are you using?
I read on many forums suggesting to use #Html.MailTo to send emails using local client (i.e similar to "mailto:" in anchor.
But when I try doing that, I simply dont find "MailTo" option in intellisense... Am I missing something, or if its obsolete now, or if its a customer HtmlHelper?
#Html.Mailto is one of the Features of ASP.NET MVC 3 Futures. ASP.NET MVC 3 Futures includes a bunch of features which may become the part of ASP.NET MVC in future.
Inorder to use it you need to download it from codeplex
You can check all the features in Imran Baloch's Blog Post
Hope it helps.
You can use #Html.DisplayFor such as #Html.DisplayFor(modelItem => Model.emailAddress) and it will produce an email link.