SelectedIndexChanged Event is firing too many times

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using a custom collection class to fill a combo box. When I set the
data source properties, the SelectedIndexChanged event is firing for every
item in the collection. Here is a code snippet:

// Collection class
public class ReconcileBatchList : CollectionBase
{
}

// Combo box binding
this.m_ReconcileBatchList = new ReconcileBatchList ( );
this.cbReconcileBatch.DataSource = this.m_ReconcileBatchList;
this.cbReconcileBatch.ValueMember = "ID";
this.cbReconcileBatch.DisplayMember = "BatchDate";

If my collection has 20 items in it, the SelectedIndexChanged event fires 20
times?
 
.... also if you go down the flag route, consider removing the event handler
instead (and re-adding it later):
http://www.danielmoth.com/Blog/2005/03/back-to-basics-1.html

Cheers
Daniel
--
http://www.danielmoth.com/Blog/


Peter Foot said:
Yuo can either set a flag yourself while you assign the datasource so that
you ignore these events, or you can use this technique to implement
BeginUpdate/EndUpdate on the ComboBox which should also improve
performance significantly:-
http://blog.opennetcf.org/afeinman/CommentView,guid,9305a1d9-e24e-4310-89e2-f80808076a37.aspx
the OpenNETCF.Windows.Forms.ComboBoxEx in the latest source in the vault
implements these methods too.

Peter
 
It looks like you have a very simple table structure, with this list of items
in it. From your example, you have two columns, one with the item text and
one with the price.

Using the ComponentOne webgrid, you would have built in functionality for
sorting and column/row moving on the client.

All of the ComponentOne JavaScript files are on your machine in the
inetpub/wwwroot/aspnet_client/ folder.

I suggest dropping a grid on a sample webform and running it. Then do a
view source. You will see all of the scripts and client side mumbo jumbo it
takes to do item moving.

The JavaScripts created by these guys and Infragistics are really powerfull.

If you can get a handle on them, you will become really good at providing a
more user friendly web experience.
--
Direct Email: Michael.Baltic@RemoveCharactersUpTo#NCMC.Com

Staff Consultant II
Enterprise Web Services
Cardinal Solutions Group
 
Back
Top