Skip to content

Latest commit

 

History

History
7 lines (4 loc) · 2.35 KB

README.md

File metadata and controls

7 lines (4 loc) · 2.35 KB

In ASP.Net, we often need list boxes with a provision to move items between the lists using buttons. We normally end up developing custom controls for this purpose, with its UI elements also handcrafted through custom code in a class. The other approach people take is to drop list boxes (HTML or ASP.Net Controls) and use jQuery / javascript to move items between the lists. This approach may sound really simple. But, the downside, is when you have to get the selected items on a post back, especially, to retain the selection on the selection of some other server control, which would initiate a post back. You can also go in for a completely HTML and JavaScript based control, but the drawback is that, once you want to add more than one instance of the control on a page, you will start facing a whole set of issues with the IDs and events of the control.These are the scenarios which necessitate the presence of a pre-built custom control, which can be simply dragged and dropped onto the UI and use it like other controls, namely textbox, gridview and so on, byt simply setting some properties and invoking some methods on it. At the same time, any customization required to the control's UI should not involve code and there should be a clear separation between UI and code behind logic of the control. This control is exactly meant for these purposes. It gives you a strong named assembly (so that you can deploy it in GAC, as well), which can be directly consumed in an ASP.Net project or even in a Share Point project which involves UI (Visual Web parts and so on). The control can be customized to expose more properties and methods as required. Once the assembly is added to the project, register it in the page using the Register tag and start using it like any other control. I have also provided a sample ASP.Net web site, whether I have demonstrated the use of the control. Since it is a server control (using Server list boxes and buttons), there will be screen flicker, while posting back. Hence in my web site, I have used it within Update Panel to avoid the flicker. Hope it is useful.

The following screen shot shows the appearance of the control on a page. Don't worry..;), you can definitely change the UI and styles of the control without much effort.

Note: I have moved my actual project hosted (now archived) in CodePlex at:

https://archive.codeplex.com/?p=associatedlistbox