Contents tagged with C#

  • Bind Custom Radio Buttons to Integer Data

    In the last blog post I showed you how to bind radio buttons to a boolean value. In this blog post we will look at how to bind to integer values. In certain business applications you might have the user select a single value from a list of items coming from a database. You want to display these options as radio buttons and then retrieve the value the user selects.

  • Creating Radio Buttons using Bootstrap and MVC

    As I previously published, the normal HTML check boxes and radio buttons just do not look good in bootstrap. Yes, bootstrap has a CSS class that will attempt to at least let render a radio button consistently across browsers, but it still is just the default HTML look. In addition, trying to hit a radio button on a mobile phone can sometimes be a little challenging.

  • Bind Check Boxes to a Collection in MVC

    In my last two blog posts I showed you how to use the bootstrap ‘btn-group’ class to create check boxes that are a little nicer looking and easier to use on a mobile device. In addition I showed you how to bind check boxes to individual properties on an entity class. In this blog post you will learn how to create a set of check boxes from a collection of entity classes. You will also learn how to retrieve which check boxes were checked by the user and update the appropriate entity class in the collection with these values.

  • Using Value Converters in Silverlight

    When you start to bind data in Silverlight (or WPF for that matter) you will most likely have data that is in one format that you may need to convert to another format. For example if you have a decimal number (price) that is 19.95, you would want to display it as $19.95. Of course you can use a normal .NET format string to accomplish this, but you could also write some code to convert the decimal number 19.95 to a string with the dollar sign in front of it “$19.95”.

  • About Nothing

    Sometimes in your code you will need to check to see if a value is nothing/null or not. In .NET there are many different ways to check for this condition. It can also be different depending on the language you use. These little differences can really bite you in the a**, so you need to be aware of the differences.

Past Blog Content

Blog Archive