AngularJS form validation with MVC 4 [closed] - c#

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm building a single page web application. This has many different forms on it that will require validation. I'm not using any of the Razor form validation, or views. Instead everything is held in Angular templates.
I get my data from the server using Web Api calls, including lists of form elements as many of the forms are dynamic.
I would prefer that my models hold all of the validation. I know I could duplicate this validation onto my angular templates for forms that aren't dynamic but this means that the validation has to be maintained in two places - I would rather keep it in one place, on my model, so that client and server validation are inline with each other.
What would be the best way to extract the validation on my model and use it on the front end?

Related

Cleaner way to get form parameters in ASP.NET Core MVC Web App? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
I've got a web app for a form in which we collect a lot of information from the user from a single form, what's the best way to collect all this data without having [FromForm] type variableName 30 times in my parameter list?
If not using the action results and models that are able to transform your requests directly to a model, The MVC controller provides a list of keys vai this.Request.Form.Keys and you can loop over these keys.

Using angular 4 for making just ajax call [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I want to use Angular 4 for doing small operation like just making ajax call. Note: I know, I can use plain jquery to do this... blah... blah...
Question:
What Angular 4 Nuget Packages I need to Install for doing small operations like just making ajax call. Any example will help.
Technologies I am working with: Asp.net MVC, .Net Core, C-Sharp
This would be an inappropriate use of Angular. Angular is a client-side technology whose primary purpose is to provide a single-page application (or SPA) user interface for a Web application.
The idea is that the entire application runs on the client and does not require going back to the server to navigate between the pages of the application. The only time an Angular application needs to hit the server is to get data or to lazy load more of the application.
It makes no sense to use Angular within an MVC application to retrieve data.

A scenario in ASP.MVC Application [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
We are creating an ASP.MVC Application. We are following a MVC pattern.
In a page, we need to show a chart. Now, my senior suggests me a way which doesn’t follow MVC pattern.
My Way(follow MVC pattern) – On the button click, handle an input request by controller. Controller handles the model and view. View renders the chart on the browser which is simple MVC pattern.
Senior suggestion – Don’t waste your time on Model, controller.(as per him, this process will take extra time.) Direct call to a JS function on the button click. JS function using Ajax call, get the data from the DB and provide the data to chart. Chart will render on the browser.
In above scenario, which way should I follow?
Please suggest.
Since the js function is calling a method of one of your controllers, the MVC pattern is not violated. Just a call to the controller without loading the whole page. Trust your Senior ;-)

How to: CRUD Using AngularJS and MVC Web API [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I would like to use AngularJS and MVC Web API to create a form and its CRUD operations (see image below)
The form is constituted of three tables: Page, Preamble, Sections. It also has 3 drop down lists that will need to be populated from the database.
This is my first attempt to create a project like this one, and I am finding lots of examples and most of them use only one table.
Do anybody has an tutorial/ example in which more than one table is used?
There are lots of Angular tutorials at the end of a Google search, but can I suggest that you not think of your page controls/layout as being sourced from tables in a database but more as results returned from an API call (actually you shouldn't even be thinking about it like that, but it will start you on the right road) - ultimately these values may well be formed as a result of some database query but from the UI perspective that's implementation detail that it shouldn't be privy to.
Rather than:
Title, SEO Title, Percent Page = "Page Table"
Consider:
Title, SEO Title, Percent Page = api/pages/{page}
Then the implementation behind api/pages/{page} is hidden from the UI and so not tightly coupled to the database schema.

Razor in winforms [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
For my job i have to make many small projects that require to send different mails and set up some html. I usually make these forms in Winforms. Now at this moment whenever i need to fill my html I take the string replace some values and have functions that write hardcoded table rows.
To make my job a little easier I was wondering if it was possible to import the razor engine(not sure if it's the right word choice) in my winforms project and simply pass a model to a CSHTML file which returns me the HTML in a string so i can mail it to coworkers.
If this is possible, instructions on how to do it are welcome.
Kind Regards Roxas

Categories

Resources