- Online Barcode Generator
- How To
- Buy Now
Similar to other listbox controls, this PerListBox UI Component offers the item reordering function. Using the item reordering feature, developers can easily create a listbox where items can be freely re-located. And the item reordering action can be easily performed using an easy drag and drop or the up & down buttons in the listbox.
In this online tutorial page, we will show you how to activate this item re-ordering feature in the PerListBox Control.
How to Reorder Items in the ListBox Programmatically
Before offering detailed sample programming code for enabling listbox item reordering feature, we will illustrate four properties that will be used in the ASP.NET item re-ordering project.
AllowReorder property is used to enable or disable the item re-ordering function of the PerListBox control. When you set this property to true, by default, two buttons (up button and down button) will appear next to the listbox.
AutoPostBackOnReorder property is mainly used to enable developers to fire a postback after clicking on the up or down buttons.
EnableDragAndDrop property allows users to reorder the items using the drag and drop action.
ShowReorder property is responsible for the showing or hiding state of the up and down buttons. To put it in another way, if you set this property to false, the up and down buttons will not appear in the listbox.
To help you better use above four listbox item reordering properties, we offer a sample programming example below.
PerListBox1.AllowReorder = AllowReorderCheckBox.Checked;
And the attached image is used to show the result of above listbox item reordering project.
One thing that needs to be noted here is that when the selected item is relocated at the last item, the down button function will be automatically disabled. Similarly, if the selected item is re-ordered at the first item, the up button function will be automatically disabled.
Other ListBox Related Features
How to transfer items from one listbox to another one in ASP.NET
ASP.NET AJAX UI Controls