This is a migrated thread and some comments may be shown as answers.

Q2 GridView

3 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
GlenC
Top achievements
Rank 2
GlenC asked on 17 Jul 2009, 10:19 AM
Since upgrading to Q2 two importnat functions of the grid no longer work:

1.     I used to Auto select the first row of the grid as follows:

if (myGrid.Records.Count > 0)
{
 DataRecord dataRecord = new DataRecord();
        dataRecord = (DataRecord)myGrid.Records[0];  
        myGrid.SelectedItem = dataRecord.Data;
}
    


2. I used to expand the child grid of the first record:
myGrid.DataLoaded -= new EventHandler<EventArgs>(myGrid_DataLoaded);
if (myGrid.Records.Count > 0)
{
 if (myGrid.Records[0] is ExpandableDataRecord)
 {
         ((ExpandableDataRecord)myGrid.Records[0]).IsExpanded = true;
        }
}

these no longer work - despite Records being deprecated they should still function shouldn't they??

3 Answers, 1 is accepted

Sort by
0
koray
Top achievements
Rank 1
answered on 17 Jul 2009, 11:06 AM

I guess this can work for the 1st one:



if
(myGrid.Records.Count > 0)

 

{

 

    DataRecord firstDataRecord = myGrid.Records.OfType<DataRecord>().ElementAtOrDefault(0);

 

 

    if (firstDataRecord != null)

 

    {

    myGrid.SelectedRecord = firstDataRecord;

    }

}

0
GlenC
Top achievements
Rank 2
answered on 17 Jul 2009, 11:26 AM
thanks for the quick response. However where does OfType<> come from in

DataRecord firstDataRecord = myGrid.Records.OfType<DataRecord>().ElementAtOrDefault(0);

?
0
Rossen Hristov
Telerik team
answered on 17 Jul 2009, 12:41 PM
Hi GlenC,

We had some issues that we have already resolved. I am sending you back a sample project with our latest binaries and using the source code snippet that you sent me. Later today we will have a weekly internal build which you can download and upgrade to.

Please, excuse us for the inconvenience. Let us know if you encounter the same or any other problems with the latest internal build.

Kind regards,
Ross
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
GridView
Asked by
GlenC
Top achievements
Rank 2
Answers by
koray
Top achievements
Rank 1
GlenC
Top achievements
Rank 2
Rossen Hristov
Telerik team
Share this question
or