I feel very happy.It encourage me to post more articles.This year I am trying to contribute more.
Once again thanks for your comments and suggestions those helps to me a lot.
With jQuery you can write in simple way to achieve this. Here is the code for populate the state dropdown based on the country dropdown selected value.
New optimized code
The above code has totally 21 lines. This we can optimize to 12 lines. Here is the code.
This happens due to many reasons.In one my project i have faced this was an image with an
empty “src” property and that would call controller once again.
This is not the issue with ASP.NET MVC .It is browser behavior .If the response form(Web form )
having any broken div tags (Unclosed div tags) or Image source is empty then browser thinking that
form not loaded properly and resubmit the form .It causes to call action method twice in ASP.NET MVC
Precautions to prevent the issue
Once you specify your webpage “url” in the Validator.w3.org site and click on check button .it shows the list of issues and description of respective error
Ex: One of the sample web page I have validated using http://validator.w3.org/ . The result you can find below snap shot
When your run the application with IE browser you will face one issue that is after stop the debugging Visual Studio automatically closes your IE browser
Here is the solution to prevent the closing IE browser
->Click on start debug button in toolbar
->Once the application is running in IE browser
->Click on Detach All as I showing below when ever you don’t want to debug
->Now your browser will not close .
Recently i got this exception when i work with WCF service. One of the Web Method returns heavy data.It is not an issue. The problem hear is maxReceivedMessageSize is exceeded .
The Default value of maxReceivedMessageSize is "65536". We can change this value upto "2147483647".I have increased the size of maxBufferSize,maxReceivedMessageSize in Web.config file (Binding section).
The problem got resolved .
Note: Don’t copy all the code .Only change the maxBufferSize,maxReceivedMessageSize as I specified in below .
Happy coding ..
ASP.NET MVC having power full mechanism of model binding.Whatever data HTTP request carries from the client side to server ASP.NET MVC engine
takes the all keys and binds the values to relevant properties .If the Model contains more than one key with same name ASP.NET throws this
1.Identify the duplicated properties in the model (May be your model inherited some base model which is having same key )
and rename with unique name
2.Same name with different data types also you will face the exceptions.So change the data type If you have more than
one property in model or base classes.