I think this might be a race condition problem. Your data might not have been loaded when the creationComplete event is fired (it is fired after all the UI components are created, but any service call you made to load up the data might not have returned yet).
Ban --- In [email protected], "guitarguy555" <[EMAIL PROTECTED]> wrote: > > In my application, I have a datagrid that is bound to XML data. The > datagrid has a corresponding form that contains the details. When > the user clicks on a row in the datagrid the form populates with the > values from the DataGrid's selectedItem. > > I want to programatically select the first row in my DataGrid when > the application loads. > > In order to do this, I have to call validateNow() and scrollToIndex() > > eg. > > dg.selectedIndex = 0; > dg.validateNow(); > dg.scrollToIndex(0); > > I put this code in the Applications creationComplete handler. > > This all works great - the first row is highlighted and selected and > the selectedIndex is 0. The problem is that I can't access the data > to populate the details form. When I try to retrieve the > dg.SelectedItem property - it is null. > > How does one programatically select the first row in the grid on load > AND access the row data? > > thanks >

