Friday, September 19, 2008

Movement of items from one ListBox to another ListBox in asp.net is a typical issue sometimes programmers face. However in windows application it seems to be a common practice. It is due to the postback nature of asp.net web page. But we can do it. In my case I had to explore the situation in one of my projects where I had to convert a windows based project into web based one. Anyway I have presented below the way I use to code to move items from one asp.net ListBox control to another asp.net ListBox control.

Fig: Moving items from one asp.net ListBox control to another asp.net ListBox control

The left side ListBox in the above figure is listBoxFrom and another is listBoxTo. The top textbox is txtAddItem and top button is btnAddItem. The textbox and the button are used to add new items into the left ListBox. The remove button is used to remove the selected item from the ListBox .

We have two buttons to move items left and right as indicated by the arrows in the button text. The left button is btnAdd and the right button is btnRemove. We should handle the button click event handler to move items from one ListBox to another.

Monday, September 15, 2008

In one of my recent projects, I had to insert into a table where one column had to be unique and auto generated. Further I also had to maintain the data so that it was in serial with previously inserted data.

In oracle this can be accomplished by the combined use of Trigger and Sequence. I am going to describe the technique in this post.

Sequence: A sequence can generate unique number. User can limit the minimum and maximum value and also the starting value of the generated number. In other words a sequence is like a unique number generator whose nature can be controlled by a user. One sequence can be maintained per table so that we can provide unique and serial id for each table.

Trigger: A trigger can be fired before insert, update or delete operations in any table. This can be designed to help apply business logic while using data manipulations using insert, update and delete plsql programming.