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

Breaking changes to GridView

1 Answer 82 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Scott
Top achievements
Rank 1
Scott asked on 16 Mar 2009, 08:21 PM
Our code used to work before upgrading to March 09. 

  public SearchResultsPage(cRecordIndexObjectList[] recordIndexObjectList) 
        { 
            InitializeComponent(); 
 
            dt = new DataTable(); 
            General.ConvertRecordIndexObjectToTable(recordIndexObjectList, dt,null); 
 
            gvSearchResults.ItemsSource = dt
 
            // Hide the IsBold column 
            GridViewColumn columnBold = gvSearchResults.Columns["IsBold"]; 
            if (columnBold != null) 
                columnBold.IsVisible = false
 
            // Hide the RecordIndexObjectList object 
            GridViewColumn column = gvSearchResults.Columns["RecordIndexObjectList"]; 
            if (column != null) 
                column.IsVisible = false
 
            gvSearchResults.Visibility = Visibility.Visible; 
 
            lblTotal.Content = "Total Records: " + gvSearchResults.Records.Count; 
        } 

None of the columns are there and the count that I used to get on my last line is 0.

Can you please advise?

1 Answer, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 18 Mar 2009, 03:29 PM
Hi Scott,

Indeed there are some breaking changes related to data source initialization. Now it is not recommended to bind RadGridView with data on initialize step, because the initialization will be finished after complete loading of the control. In your case this result in incorrect value of the Records.Count property. It will be fine after loading is complete.

As for the missing columns - you've hit a bug in RadGridView related to automatic creation of the "DataMemberBinding" property. For the bug report I'll update your Telerik points. As a workaround you can set DataMemberBinding property from xaml for every GridViewDataColumn. For your scenario with DataTable as data source Xaml should look like this:

<telerik:GridViewDataColumn DataMemberBinding={Binding [IsBold]} /> 

P.S. The bug will be fixed with next release or SP. If this is a showstopper for you just let me know and I'll do my best to send you latest stable build.

Greetings,
Nedyalko Nikolov
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
Scott
Top achievements
Rank 1
Answers by
Nedyalko Nikolov
Telerik team
Share this question
or