Creating a dropdownlist the ajax way using jQuery is kind of messy. Ajax Helpers in MVC3 has an elegant alternative using unobtrusive jquery. Lets first create a simple page with ajax form The UpdateTargetId property of the AjaxOptions says where the partial view is to be inserted on form submit. The corresponding controller will be Create a partial view that will hold the second dropdownlist like this Now one last important thing do not forget to include the unobtrusive script in your layout page In this example when we have binded the on change of event so that the form it is contained in is posted. The argument name of the method SelectFromDDL1 and the id of dropdownlist should be the same so that it is posted when the form is submitted. Using the same you can create any number of cascading dropdownlists.
Showing posts from September, 2012
- Other Apps
- Other Apps
KISS- Keep it Simple Stupid This post is about a simple html tabular view using bootstrap and a kind of raw grid with sort & search option using ASP.MVC framework. I always like to keep a lot of things (not everything) simple, not that i don't like owning NOT so simple things ;) From development perspective the KISS principle has been spreading lately. Simplicity, the first thing that pops up when i hear that word, it would be Google . Well in fact "simple" is more like "beauty" it's in the eye of the beholder. Here is a sample whose idea on simple contradict with that of mine. May be we can't jump into conclusion that if something is simple to someone it is the same for the other. So on that same idea of Simple i will try to make a simple page with a simple grid with simple lines of code. Here is simple table which has got nothing to do with this post. Let us Create trivial class Employee like this Now lets create a PersonContro