Weird eh! bug is it?

Posts   
 
    
LLBLGen
User
Posts: 43
Joined: 10-Apr-2006
# Posted on: 22-Apr-2006 02:45:30   

I am using infragistics Ultra grid, so i am not sure if this is infragistics, LLBL or me?

I have an UltraGrid that has Employee's phoneNumber. i have the following as data source

UltraGrid.DataSource = EmpPhoneList;

----> This is EmpPhone Entity Collection for selected employee

(EmpPhoneGuid is the PK). This Ultragrid has 3 columns

EmpPhoneGUID (Cell=0), PhoneType (This is a drop down,Cell =1), Number (Cell =2)

User can change the Phone Type column on the UltraGrid from the drop down. for some Weird reason i get different EmpPhoneGUID from the active row.

Following is the code on the CellListSelect action (when user selects phoene type drop down). Lest assume the user changed the first row on the DataDrid (Index =0)

EmpPhone _ep =new EmpPhone();

_ep= (EmpPhone)EmpPhoneList[UltraGrid.ActiveRow.Index];

1) MessageBox.Show(_ep.EmpPhoneGUID.ToString()); -----> shows "XYZ....." 2) MessageBox.Show(UltraGrid.ActiveRow.Index); -----> shows "0" 3) MessageBox.Show(UltraGrid.ActiveRow.Cell[0].Value.ToString()); -----> shows "ABC..."

Why is my No 1 different than No 3? even though the active row index shows 0? for some reason my no 1 gets the EmpPhoneGUID from the other rows...its random.

so when i select the fourth row (Index =3) my No 1 statement has EmpPhoneGUid from Index 1.??

Any Thoughts?

Rogelio
User
Posts: 221
Joined: 29-Mar-2005
# Posted on: 22-Apr-2006 04:48:03   

Hi,

This is normal with almost grids, because the grid could sort the data.

To get the correct datasource´s index use the position currencyManager´s position property.

dim cr as CurrencyManager

MyGrid.DataSource = MyDataSource cr = MyGrid.BindingContext(MyDataSource)

.... ....

MySelectedRow = MyDataSource(cr.Position)

LLBLGen
User
Posts: 43
Joined: 10-Apr-2006
# Posted on: 25-Apr-2006 22:45:14   

Thank you that worked!!