Click here to Skip to main content
13,050,614 members (82,433 online)
Rate this:
Please Sign up or sign in to vote.

I have a doubt in 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..

Posted 26-Jul-12 1:09am
Rate this: bad
Please Sign up or sign in to vote.

Solution 3

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[^].

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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 26 Jul 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100