Ajax.BeginForm on DropDownList change

Recently I’ve encountered a problem on how to perform AJAX POST with helpers provided by ASP.NET MVC 5 – Ajax.BeginForm on DropDownList change event.

Idea behind

Imagine you have ViewModel like this:

And MVC controller action like this:

My first thought was to to something like this (note I didn’t used TextBoxFor and DropdownListFor because I actually used Ajax.BeginForm to edit attributes of each item in collection of objects inside TestVM, not the TestVM attributes themselves):

However, what I kept receiving was a postback to the /Post address instead of making an AJAX call.
I’ve also added


in several places around thinking it might be rendered wrong but nothing changed.
I’ve also kept changing how, when and where is jquery and jquery-validate loaded but no luck.


In the end I gave a try something like this (kudos to one of fellow StackOverflow’ers for an answer, can’t find it at the moment):

Yes, that’s right – only change is replacing:

onchange = “this.form.submit();”


onchange = “$(this.form).submit();”

With that you can easily forget about button type=”submit” and move on to more natural way of updating records with Ajax.BeginForm on DropDownList change event.

Combining developer work with entertainment

I guess most of us working as IT staff, either it’s development or administration, find joy in our work and enjoy what we do, even off the work. What to do if we want to keep push ourselves further but out of commercial or even open source project and still have fun?
Well, I’ve been looking for a way to get myself out of too much computer gaming and finding some substitute for such form of entertainment that would make me more productive. Of course playing historically based strategies will build up our history knowledge and FPS gaming will keep our reflexes on top, it’s still a percentage of what the gaming is all about. Browsing through the web I accidentally stumbled upon an advert on Facebook from page called ‘CodinGame’ – http://codingame.com. And guess what? I just can’t get over it.

The whole idea is about something like SPOJ is. If you don’t know it, it’s algorithm solving platform for all the fans of resolving algorithmic problems. CodinGame is more or less about the same but wrapped up with minigames and miniproblems, that let you place it somewhere between gaming and developing yourself.

Games choice

We have several games to choose with along with categorizing them into different difficulties. Every game is about solving different problem with an entertaining wrap up. You can see an example below:

    Minigame choose dashboard

Inside CodinGame IDE

For solving up the problems we’re given with online IDE with possibility to choose different languages including OOP languages like C#, C, C++, VB.NET and Java, scripting languages like Bash, Perl, Python and PHP or functional programming languages like Haskell and Clojure. We’ll make our code face several tests to meet the demands of the riddle.

I won’t push any further with an insight as you’d probably feel interested already and gonna check it yourself!
Either way, please keep in mind that we’re speaking about food for the mind. Don’t forget about other things important things important for your proper rest like sport, that also will get you entertained and – what every personal, business coach will tell you – will get your head refreshed and properly stimulated for further work.