Call a function when the view loads in an MVC application

Solution Document.ready function is for this purpose. For example, you want to call a function that fills a drop-down dynamically when the view loads, you will give that function a call in document.ready function enclosed in the script tag <script> $(document).ready(function () { fillRoles(); }); </script> In the above example, function fillRoles() is called to... Continue Reading →

Hashing Passwords-Easier Password Management by creating and storing the salt and the hashed password in a single value.

Include header using System.Web.Helpers; In View: To take input <div class="col-sm-4 tb-font"> @Html.Label("UName", "User Name", new { style = "width:140px; margin-bottom:5px; margin-top:5px; float: left;" }) @Html.TextBox("UserName", null, new { @class = "form-control text-box" }) </div> <div class="col-sm-4 tb-font"> @Html.Label("Pswrd", "Password", new { style = "width:140px; margin-bottom:5px; margin-top:5px; float: left;" }) @Html.Password("Password", null, new { @class... Continue Reading →

Return bool value from ajax

Returning bool value from ajax is not similar to any simple function that returns the bool value. BUT DON'T WORRY! it isn't even too difficult. it's just slightly different. Solution var alreadyExists = function () { var role = $("#UserRole").val(); var notexists = false; $.ajax ({ url: "@(Url.Action("checkExists", "UserManagement"))", data: { role: role }, contentType:... Continue Reading →

Blog at WordPress.com.

Up ↑

Design a site like this with WordPress.com
Get started