Q2 GridView

4 posts, 0 answers
  1. GlenC
    GlenC avatar
    12 posts
    Member since:
    May 2009

    Posted 17 Jul 2009 Link to this post

    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??
  2. koray
    koray avatar
    12 posts
    Member since:
    Jul 2012

    Posted 17 Jul 2009 Link to this post

    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;

        }

    }

  3. DevCraft banner
  4. GlenC
    GlenC avatar
    12 posts
    Member since:
    May 2009

    Posted 17 Jul 2009 Link to this post

    thanks for the quick response. However where does OfType<> come from in

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

    ?
  5. Rossen Hristov
    Admin
    Rossen Hristov avatar
    2478 posts

    Posted 17 Jul 2009 Link to this post

    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.
Back to Top