Custom TempDataProvider for Azure

We are using Azure for deploying our ASP.NET MVC Web application. As you know, Azure behaves like a web farm. It hosts multiple instances of the same application in multiple VMs. The advantage of this approach is that the number of instances can be scaled up or scaled down according to the load. For a web developer working with Azure, there[…]

Read more

AutoComplete TextBox with ASP.NET MVC and jQuery

jQuery UI has an AutoComplete widget. The autocomplete widget is quite nice and straight forward to use. In this post, how to integrate the AutoComplete widget with an ASP.NET MVC application. The first step is to add the jQuery scripts and styles. With ASP.NET MVC 4, the following code does the work:

Using the AutoComplete widget is also simple.[…]

Read more

CheckBox Helper in MVC

Consider the following code which has a checkbox and a submit button:

When a form gets submitted, the form collection has name, value pairs. If the checkbox is checked, the form contains the [name, value] of [Select, on]. If the checkbox is unchecked, the form does not contain [Select]. The value of Select can be retrieved by the following[…]

Read more

Move items from one listbox to another using jQuery – Part 2

I have posted an earlier post on moving items from one ListBox to another. There were few comments that wanted enhancements on the post. Especially, a lot of readers wanted to know how this can be handled on the server side. So, I have come up with a second version of the post. Here is the code:

I have added[…]

Read more

Introduction to Knockout.js and ASP.NET MVC

Knockout.js is a javascript framework for creating MVVM like browser apps. MVVM stands for Model-View-ViewModel. Model represents the data. View represents the UI. ViewModel represents how the model is represented within the View. ViewModel also encapsulates the behaviour of the view. For eg, the rule: for some conditions in the data (model), set a green background to the table cell,[…]

Read more

Little things about the Page Lifecycle

The handler for an ASP.NET WebForms Application is the Page object. The Page object is responsible for generating the response for the request. The Page object fires various events which helps the application developer to customize the HTML generated. The events which are fired are: PreInit Init InitComplete Load Control Events LoadComplete PreRender PreRenderComplete SaveStateComplete Render Unload PreInit Master Pages[…]

Read more

Updating textbox with checked items using jQuery

I have a CheckBoxList. When the user checks or unchecks the items in the CheckBoxList, a TextBox should be updated with the checked values separated by a comma. How can I do this? You can open up the designer. Add a CheckBoxList and TextBox as shown below:

After adding the HTML, you can add a simple script using jQuery.[…]

Read more