Web Development Blog

Getting the selected value of RadioButtonList with JQuery

It struck me the other day that it is so easy to use AJAX with ASP.NET it can make you lazy. I was working on a project where I had some radio boxes and based in the selection of the radio boxes another fields was displayed or hidden. I didn't want the page to post back so initially it though I'll just pop it in a AJAX UpdatePanel and write some code to show or hide the fields after the selection is made on the RadioButtonList.

Using a multiple class selector on the one element

I came across the situation the other day where I wanted to apply a CSS rule when two classes appeared in the same element. The Html generated was a div containing buttons. I wanted to apply a custom background to one of the items in the list. As you hover over each of the button elements JavaScript toggled the button-hover class. I wanted to have background image change on all of the list elements when button-hover was applied. The problem was I wanted to have a custom roll over images for each of the buttons.

Sort a generic collection dynamically by class properties

Sorting items in a database using SQL is easy, simply order by whatever field you want that supports sorting, its easy to take that power for granted. But what if you already have your data in the form of a generic object collection which you want to sort. It turns out to be quite simple, all you need to do is create a collection of System.Collections.Generic.List and call the Sort() method.