Monday, November 23, 2009

SelectedIndex if nothing selected

SelectedIndex property of Infragistics' WebCombo class has the following syntax


public int SelectedIndex {get; set;}

The documentation reads 'If no row is selected, this property returns Nothing or Null.' That sounds suspiciously since int cannot be null.

The property actually returns -1 if there are no selected rows.

By the way, the index is zero-based, i.e. the first row has the index 0.

No comments: