We have an existing web project with MVC 5 that currently accesses a database to show listings and search results.
This project needs to be reskinned, which requires a large amount of frontend work. But we're not sure how to let a developer do this without giving him the entire database.
Since we can't set up the database on his computer, is there an easy way to let him edit the pages (i.e. make changes to views and preview this in the browser with test data)?
Any ideas would be appreciated.
Related
I am trying to create forms which will contain a bit of logic, calling web services and things like that. But I will have maybe 50 forms and when they change I need to be able to keep the old one so I can load it later on.
Is it possible to load the MVC view and the code it uses from a database upon request?
I'm building a large hierarchical web application and I need some help deciding on some best practices with leveraging MVC.
The application will have tabs at the top which control a sub page, and a query pane (off to the side).
There will be two templates for query panes, each used by different sub-pages. The sub-pages will be based on the selected tab with settings derived from the query panes.
Clicking on tabs or updating the query pane will update the sub-page section without refreshing the page.
I'm a bit new to MVC and what I don't quite understand is how I can leverage MVC methodologies to help me manage the web application's state (which consists of the selected tab, query options, and other page-specific options).
Currently I'm planning on initially setting up a model which stores the client state parameters (default values, or values obtained from a DB), and using it to load the page, consisting of several partial views. When anything is changed (tab/query/etc), the view will call a corresponding controller, passing back model parameters via post (I'm assuming there's no way to store session-specific client state models on the server-side?).
My question is:
Am I doing it right?
If not, what am I missing; and specifically, is there a way to store these session-specific state models server side so they don't have to be passed back to the server during every single page transaction?
If I understood everything you need Its a SPA (Single Page Application). This will provide a magic user experience, without full page reload, and low data traffic. But, requireds some MVVM framework (AngularJS, KnockoutJs, etc) and a lot of JavaScript coding. But the result is amazing. The guy behind this in MVC is John Papa, take a look in everything on his blog and you will win.
John Papa Blog
Hopes Its Help you
I'm creating a PoC of an ASP.NET MVC 4 mobile application (tablets) for field operators that needs to support offline capabilities. It's a relatively simple data entry application with a WebAPI backend that will use a SQL database as persistent storage.
This is the first time I'll be implementing offline support, so I'm a bit unsure of which is the best way to design this. Right now I can think of two ways, and not sure which one is better or more correct.
What I want is that whenever there is internet connectivity, the information is retrieved from the server. If the connection is lost, I want the latest information to be cached/served and available to display to the user.
Based on a few tests that I've made, the way the HTML5 offline support appears to work is that as soon as any of the Views is loaded, the browser will check the manifest and cache the version of each page at that moment of time. If my understanding is correct, that means that if the user adds new entries after the browser downloaded the manifest files, then those records would not show in the offline version.
One way I can think to work around that is to change the manifest version (since I'm generating it dynamically) every time it is served, but i feel that would defeat the purpose..or at least be incredibly inefficient bandwidth-wise.
The only other alternative that I can think of is not using regular MVC (not passing the records/db information as the model property or a ViewBag property) to display the records, but just retrieve the json for the page information needed and save in local storage. Then, generate the view using a template or javascript based on the information in localstorage. That would work either online or offline, wouldn't it?
I'm not sure if I'm approaching this the wrong way. Would building an SPA or a simple HTML/javascript application be more appropiate? Maybe using a JS framework? At this point I have some ability to determine what technology or framework we'd use.
Any guidance is greatly appreciated.
Based on a few tests that I've made, the way the HTML5 offline support appears to work is that as soon as any of the Views is loaded, the browser will check the manifest and cache the version of each page at that moment of time. If my understanding is correct, that means that if the user adds new entries after the browser downloaded the manifest files, then those records would not show in the offline version.
This is why you shouldn't use server side rendering. When the server mixes data with formatting before sending to the browser it means that the browser can't tell the difference between the two. HTML5 and Javascript are perfectly capable of handling templating on their own so why not let them?
Write your MVC application as nothing but a series of controller methods. Do not use "views" per-say. Instead use straight HTML files that use javascript to make AJAX requests to the server for data. Populate the HTML view with the data and you're golden. Then you can cache the HTML files because they're static and you can save the data separately for offline mode.
Adding to the accepted answer, there's a thorough post in this matter titled:
Build an HTML5 Offline Application with Application Cache, Web Storage and ASP.NET MVC.
The guy explains everything using a sample/complete app and do a great job explaining each and every point.
Besides that, if you really want to get the crème de la crème from modern web dev with offline capabilities, I'd suggest you take the 2 parts course by extraordinaire/star developer John Papa. It uses the SPA = Single Page Application UI paradigm.
The course is available at Pluralsight:
Building Apps with Angular and Breeze - Part 1
Building Apps with Angular and Breeze - Part 2
Enjoy as much as I'm enjoying it. Make sure you check this keyword/feature in the course: WIP = Work In Progress.
If you're interested, here's is a repo where I keep the updated course's code:
https://github.com/leniel/SPACodeCamper
I built my web application using asp.net mvc3. I need to add admin pages to monitor and manage all user accounts and their posts.
Right now, admin and regular web site are sitting in the same web application. if I only made a small change for the admin pages, i still need to compile everything. is it a way separate them, so I only need to upload admin without touching the web site. the only solution I can think of is to create another web app. is there another way to do it?
You can separate your mvc application into Areas
http://msdn.microsoft.com/en-us/library/ee671793.aspx
Areas help you better organize your application it won't let deploy just that area, but VS2010 does have some good deployment features. Her's a good article
http://weblogs.asp.net/scottgu/archive/2010/07/29/vs-2010-web-deployment.aspx
I'm working on a typical 3-tiered webforms app backed by a SQL server database. In addition, several of the forms call a DAL layer that gets data from a DB2 database on a host, and this logic is well encapsulated. There are about 80 forms in this project but I'd say at least 50 of them are so similar that they would share the same 2 or 3 views.
So tell me if you think this is a recipe for disaster...I've been asked to explore the possibility of converting this project to MVC in an incremental manner. We would never get the ok from management to take the time just to convert the project in one fell swoop. It would have to be done incrementally within our business-related releases - i.e., we have releases every few months and I've been asked to explore how we could make smaller changes with each release to work our way towards MVC. Since they are 2 totally different frameworks I don't immediately see how this can be done. One idea I have is to carve out the UI piece, put that into an MVC project, and have the controllers call down to the DAL that we have now. Can you even have a solution with different project types in it? Any other ideas?
I have done something similar in recent past. I have a running application developed in ASP .Net and Oracle. That application has several performance issues due to which we have to re factor that. And we all agreed that we should migrate it to MVC at the same time.
So, I created a new project MVCWebClient. In that new project we created our pages one by one. Now user use old application's login page to log into our application and we changed the links which point to our new application.
Everything is working smoothly except session. Because we stored uid/pwd in session, so I created a dummy page which transfer the session parameters to our MVC application.
For example my existing application has following URLS:-
/Login.aspx
/Home.aspx
/Finance/Payslip.aspx
and I created a integration page to transfer session like this
/Integration.aspx?urlRequest=/MVCApp/Finance/Payslip
and my main navigation links become like this
/Login.aspx
/Home.aspx
/Integration.aspx?urlRequest=/MVCApp/Finance/Payslip
Feel free to ask details if you are interested in my solution.