Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
HI,

I have a doubt in Asp.net MVC3 application.i am creating a login page and login page contains a javascript function (index.chtml - View) and the javascript function contains the validation of controls and displaying the Errors.

Here i need the code for calling javascript function from my controller page.


Please help me.....

Thanks in advance..


Dil
Posted

First of all you can not call javascript from controller. Javascript runs on client side, your controller is running on the server.
Although you can make the view execute code on behalf of the server.

If speaking from validation in general, you can do client and server side validation in MVC3, or you can (should) use both. If you use server side validation, the page is posted, thus refreshed. If you use client side one, you need to send the logic on client side. Validating credentials is not really possible this way - and this is called authentication, not validation.

If I understand your post correctly, you want authentication to look and feel like client side validation. Than you need remote validation[^].
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900