We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

unexpected or unpredictable behavior of UnBoundRow

I'm using sfDataGrid where complete code is written in c# (not in XAML)

when user runs app and try to refresh data multiple time then code written in 

void LV_QueryUnBoundRow(object sender, sync.Grid.GridUnBoundRowEventsArgs e) 
{
     //----
}

runs the number of time user has previously refreshd grid 

for more explanation I'm attaching sample code
please keep an eye on top row values you will understand what I want to say

Amit Saraf

Attachment: sfDataGridUnboundRow_fd5d59ff.zip

1 Reply

SR Sivakumar R Syncfusion Team April 19, 2017 05:11 PM UTC

Hi Amit Saraf, 

Thank you for contacting Syncfusion support. 

We have analyzed your provided sample. You have subscribed to QueryUnBoundRow whenever you click the button, so handler triggered multiple time. You can achieve your requirement by unsubscribing the QueryUnBoundRow event before subscribing again as in the below code., 
Code Snippet: 

private void btnRefresh_Click(object sender, RoutedEventArgs e) 
{ 
    tcount = 0; 
    LV.QueryUnBoundRow -= LV_QueryUnBoundRow; 
    LV.QueryUnBoundRow += LV_QueryUnBoundRow; 
    LV.Columns.Clear(); LV.UnBoundRows.Clear(); LV.TableSummaryRows.Clear(); 
    LV.ItemsSource = null;             
    LV.UnBoundRows.Add(new sync.Grid.GridUnBoundRow { Position = sync.Grid.UnBoundRowsPosition.Top }); 
    LV.UnBoundRows.Add(new sync.Grid.GridUnBoundRow { Position = sync.Grid.UnBoundRowsPosition.Top }); 
 
    LV.ItemsSource = GenDT(); 
} 


Please let us know if you have any query. 

Regards, 
Muthukumar K 


Loader.
Live Chat Icon For mobile
Up arrow icon