I’m developing a application based on two technologies: ASP.net (SharePoint) and JavaScript.
I use server-side code for retrieve data from database and manipulate it whereas I use client-side code for build front-end(I’m using JSON format).
I have very problem with this “architecture” because ASP.net is strong-type whereas JavaScript is less-type. My data “jumps” from front-end to back-and and vice versa.
How can I have my model class in client-side code too?
1
As of today there are many (much many if that’s the case) javascript frameworks that allow you to model on the client. Among all the features they offer you can validate/calculate the data is correct before sending it to the server.
However when the data gets into the server, it is your responsability to make sure everything is ok. You should never trust 100% on client side validations, because some skilled user might change that logic for you.
I would suggest to dive into KnockoutJs framework and play with it until you got the point. Later move to AngularJs which is more powerful but more complex also.