ExtendedListBox AutoPostBackIssue

Apr 24, 2009 at 3:27 PM
Edited Apr 24, 2009 at 3:29 PM
I am not sure rather I am supposed to be using AutoPostBack or not with this control; however, I really need its functionality.  Right now I have it where when an item is selected it fills in information into another extendedlistbox.  The problem right now is when you click an item in the listbox it posts back and then resets itself to selecting the first item in the list.  Oddly enough this didn't happen when I declared the items in the aspx page but unfortunately my items will need to be asigned via code.

Here is the code I am using:

In the aspx page

 

<piece:ExtendedListBox Width="200px" ID="lvUserNames" runat="server" Rows="12" OnSelectedIndexChanged="lvUser_SelectChanged" />

 

AIM.Data.AIMdb db = AIM.Data.AIMdb.factory(); 
 
int iLastClinic = -1;
foreach (AIMUser u in users) 
 {
     
var exi = new SharpPieces.Web.Controls.ExtendedListItem(u.UserName); 
     exi.GroupingType = SharpPieces.Web.Controls.
ListItemGroupingType.Inherit; 
     
if (iLastClinic != u.iClinic) 
     {
        exi.GroupingText = (
from c in db.Clinics where c.Id == u.iClinic select c.ClinicName).First(); 
        exi.GroupingType = SharpPieces.Web.Controls.
ListItemGroupingType.New; 
        iLastClinic = u.iClinic;
    }
        lvUserNames.ExtendedItems.Add(exi);
}

 

 

Any help would be greatly appreciated since it.