WebListBox Index was out of range error. Please help.

1 reply. Last post: September 30, 2011 5:11 AM by Handy Surya
Tags :
  • New Discussion
  • New Question
  • New Product Feedback
Syed KhanMember
<ISWebEssentials:WebListBoxID="WebListBox1"runat="server"Height="600px"Width="210px" DefaultStyleMode="Minimalist"EnableKeyboardSupport="true"DataSourceID="SqlDataSource1" TextFieldDataMember="Description"ValueFieldDataMember="Description" AutoPostBack="true"OnSelectedItemChanged="WebListBox1_SelectedItemChanged" SelectedIndex="0"AllowDefaultStyleMerging="false"> <LayoutSettingsItemHeight="30"ScrollMode="Scroller"DisplayMode="Text" ItemAlignment="Center"DisplayActiveItemIndicator="true"/> <Items> <ISWebEssentials:WebListBoxItemName="Description"/> </Items>

protectedvoidWebListBox1_SelectedItemChanged(objectsender, WebListBoxSelectedItemChangedEventArgse)

{

int index = e.SelectedIndex; WebListBoxItem item = WebListBox1.Items[index] as WebListBoxItem;

I am getting Index out of range error when it gets to WebListBoxItem item... line.

I should have my collection count to 4 but it only shows 0.

 

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

All times are GMT -5. The time now is 1:09 PM.
Previous Next