Smart ListControl in ASP.NET 1.x/2.0
page 2 of 7
by Bilal Haidar
Average Rating: 
Views (Total / Last 10 Days): 38014/ 54

The Solution

In this section we will explain in detail the solution we have implemented to solve the problem.

We have added two Hidden Fields that will be injected by the new control developed.

The first Hidden Field is named with this convention:

ListBoxID + “_ADDED”

The above field will be used to hold any item that has been added to the ListBox on the client side.  Suppose you have added the item with:

Text = “First Item”

Value = “1”

A new item will be added to the Hidden Field in the form of:


For instance, an item will be added as follows:

First Item|1

Any additional item will be added to the Hidden Field.


The format of how the items are added to the Hidden Field is very critical.  Since, as you will see later on, we are going to get the value of the above Hidden Field, split it based on the “,” and then each single item will be added as a new ListItem into the ListBox.

The second Hidden Field used is named with this convention:

ListBoxID + “_REMOVED”

The above Hidden Field will hold the values of all the items that have been removed from the ListBox.  Later on we will see that on the server, those values will be selected in the ListBox and removed, thus reflecting the behavior and changes done on the client side.

In addition to the above mentioned section of the solution, we will be implementing the IPostBackDataHandler, where two methods will be reworked mainly the LoadPostData and RaisePostDataChangedEvent.  More on the implementation of this interface will be discussed shortly in this article.

View Entire Article

User Comments

Title: Re:   
Name: Bilal Hadiar [MVP]
Date: 2007-04-04 1:51:36 AM
I have updated the control to work on other browsers than IE!
Check my post here:
Title: Re:   
Name: Bilal Haidar [MVP]
Date: 2006-12-09 6:40:35 AM
If it is not working on those two browsers, means there is something in the JavaScript that is specific for the IE only!
Let me check what I can do and come back to you!

Title: Re:   
Name: Bilal Hadiar [MVP]
Date: 2006-12-06 1:54:05 AM
Hello, what exactly is happening? I don't have Safari here, all my work in the company is IE that is why I didn't test it there!

Title: Safari / doesnt work   
Name: Sonu Kapoor
Date: 2006-12-05 3:19:28 PM
It doesnt work properly on safari!

Community Advice: ASP | SQL | XML | Regular Expressions | Windows

©Copyright 1998-2024  |  Page Processed at 2024-04-18 2:51:05 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search