Showing posts with label MVC. Show all posts
Showing posts with label MVC. Show all posts

Thursday, January 2, 2014

Accessing Model property in MVC View from Javascript

For example, you have following model in your MVC application:

public class Employee
{
public string EmployeeName
public int EmployeeNumber
}

You have bound this model to your MVC view (Razor/ Html), and there may be a case when you need to access "EmployeeName" in the Javascript from that view.

You can access value of "EmployeeName" property of your model by following way:

<script type="text/javascript">
function showEmployeeName()
{
alert('@(Model.EmployeeName)');
}

</script>

Monday, December 30, 2013

FIX: JQuery date format validation for non US dates in Chrome

Include following script in your javascript file and reference it in your page(s) to get rid of the most common error of JQuery date format validation in Chrome which doesn't allow non US dates.

    $(document).ready(function () {
jQuery.validator.methods["date"] = function (value, element) { return true; }

    })

Tuesday, April 17, 2012

Development and Deployment - Troubleshooting, Investigations (Series of articles)

At times, we, developers or deployment people do come across some technical problems that eat up our hours (and days sometimes).. and when we find the resolution, or real cause of the issue, it makes us feel that such issues were not worth of the time and efforts we spent.

Here, I am making a collection of such issues/ troubleshooting notes that may help us to take extra care in order to avoid that issues raising while we develop or deploy.

There are each new post for each different issue/ troubleshooting note, and this post is an index that will keep growing as I add new post in this category.

Keep checking this place regularly.

INDEX:

ASP.NET



ASP.NET MVC