I'm trying to create simple login page, which will validate user.
In my view
<script type="text/javascript">
$(document).ready(function () {
$('#btnLogin').click(function () {
document.location = '@Url.Action("Validateuser", "Login")';
});
$('body').css("background", "#517EAD");
$('body').css("color", "Green");
$('body').css("margin", "0");
});
</script>
<div style="background:white;text-align:right;padding:0px 50px;">
<h2>Please Login</h2>
</div>
<div style="float:right;">
<table border="0">
<tr>
<td>
<label id="lbllogin">LoginID:</label>
</td>
<td>
<input type="text" id="txtLogin" required placeholder="Prashant" style="border-radius:5px;background:orange;"/>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" id="btnLogin" value="Login" style="border-radius:15px;background:silver;"/>
</td>
</tr>
</table>
</div>
How i can pass textbox value to the controller??
I have on controller with 2 actions as follows
namespace MVC.Controllers
{
public class LoginController : Controller
{
public ActionResult Index()
{
return View();
}
public ActionResult Validateuser()
{
Login objLogin = new Login();
int intUser = objLogin.validateUser();
return RedirectToAction("Index","Login");
}
}
}
In above code if you check, in Validateuser() i have not written any logic but i'm trying to redirect to Index.cshtml view and want to pass "Invalid User" massage to the view where i will display.
can i know how can i do this??
thanks in advance