Custom Model Binding in MVC

Some times we have to use our own Modal binding mechanism in MVC. In MVC default Modal binding machansim is perfect. It binds our modal to posted variables . We can create our custom Modal binder. We can use DefaultModalBinder Or IModalBinder to do that. In following video you can find Custom ModalBinder Using IModalBinder. Custom Modal Binder in MVC Download Source Code Advertisements

Difference between == and === in JavaScript

So we know in javascript we have == and === comparisons. Why two? What are the differences between them? So what is the difference between followings this returns true. when it comes === equals this returns false. So what it is? The triple-equals comparator compares both type and contents So ‘1’ === 1 contains string value and int value. Even contents are same they are in different types. So it is not equals. Double equals tries to help with type coercion. But it’s not always the help we want. So keep in mind when you are using above equal comparisons.  

format currency in jquery

So when we are in web development we want show Currency value with some formatting. Like thousand separator, decimal separator and currency symbol. I am using below Jquery function to format the currency values. We can format currency value as we required. If we just pass the currency value it will give us value with default formatting. formatCurrency(5873839) will give us ” $5,873,839.00″

reading xml in sql server

So some times we want to read xml file in sql server. I am passing list of details to sql server using xml file format. It reduce several db calls when we passing list of data. Suppose we have List of Students. In List of Student we have to loop it and fire db calls to save data. To overcome this I create xml of List of Student and Pass it to sql server with one db call and then in my stored procedure I will handle those data as follow.

Serializing Lists of Classes to XML

So some times we want to convert object to xml. We can follow severel cumbersome methods. So I am using Utlity methods to convert c# object to xml and xml to c# object. Suppose we have class like below And we want serialize List<Student> to xml. So we can use this utlity function As a example we populate List<student>  with dummy data Then call out utility function then out xml variable look like as below