jquery - ASP.Net MVC Client Side and Server Side Calculations -


i new asp.net mvc , trying maintain correct use of mvc development pattern. getting bit lost in mix different technologies @ play.

basically have form typed against model. simplicity sake lets model has 3 ints in it. int1, int2 , total. want create form allows user enter values in int1 , int2 , update total field displayed user whenever either 1 of them changes. want allow user hit save if happy total , http post controller 3 fields saved database.

now went down path of using jquery onchange() calculations , set value of total works. however, feel though getting away true mvc here doing calculations within view.

how things knockout , json play in here? want stay best practices of mvc as possible.

mvc deals sending requested webpage user's web browser. once browser has received it, mvc not enter picture again, unless send new web request (whether page redirect, ajax call, or other means launch web request).

anything happens in browser, not part of mvc. doesn't mean should steer clear client-based interactions! means you'll using other mvc provide part of user experience.

there plenty of javascript frameworks choose if have sizeable need client-side smooth user experience.

but example of having total calculated when user enters separate values, can solved javascript, , perhaps preferably jquery.

but shouldn't worry moving away mvc structure. it's not supposed all-encompassing framework. there's beautiful synergy between asp.net mvc , javascript/jquery, , can encourage such approach.

long story short: you're on right track. no reason doubt yourself.


Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -