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
close icon

Syncfusion Data Grid

Hi 

I am facing an issue regarding Syncfusion DataGrid. I have used data grid view in 3 pages of my project. The issue is when I am trying to execute the project,it is getting crashed and showing an exception called Null Reference Exception. Here is the exception 

System.NullReferenceException: Object reference not set to an instance of an object.\r  at Syncfusion.UI.Xaml.Grid.GridHeaderCellControl.OnPointerExited(PointerRoutedEventArgs e)

I have nowhere implemented this method called OnPointerExited. Still it is throwing exception

Here is my Code Snippet-

----XAML Page---

<SFGrid:SfDataGrid x:Name="ListData" BorderThickness="1" Margin="0" Height="270" AutoGenerateColumns="False" 
                                                       ColumnSizer="SizeToHeader" ScrollViewer.VerticalScrollBarVisibility="Auto" VerticalAlignment="Top" ScrollViewer.HorizontalScrollBarVisibility="Disabled" AllowSorting="False" 
                                                       BorderBrush="Transparent" AllowGrouping="False" SelectionMode="Single"   
                                                       HeaderStyle="{StaticResource HeaderCell}"   
                                                       AllowDeleting="False" NavigationMode="Row" AllowRowHoverHighlighting="True"
                                                       Padding="5" Visibility="Visible" Background="White" 
                                                       SelectionChanged="ListData_SelectionChanged">
                                    <SFGrid:SfDataGrid.Columns>
                                        <SFGrid:GridTextColumn HeaderText="CATEGORY" MappingName="name" Width="450" TextAlignment="Left" HorizontalHeaderContentAlignment="Left"/>
                                        <SFGrid:GridTextColumn HeaderText="SUB-CATEGORIES" MappingName="categories" Width="175" TextAlignment="Center"/>
                                        <SFGrid:GridTextColumn HeaderText="THREADS" MappingName="threadCount" Width="150" TextAlignment="Center" HorizontalHeaderContentAlignment="Center"/>
                                        <SFGrid:GridTextColumn HeaderText="POSTS" MappingName="messageCount" Width="100" TextAlignment="Center" HorizontalHeaderContentAlignment="Center"/>
                                        <SFGrid:GridTemplateColumn HeaderText="ACTIONS" Width="150" HorizontalHeaderContentAlignment="Center" TextAlignment="Center" >
                                            <SFGrid:GridTemplateColumn.CellTemplate>
                                                <DataTemplate>
                                                    <StackPanel Width="50" Background="Black" VerticalAlignment="Center" HorizontalAlignment="Center">
                                                        <ComboBox x:Name="CategoryAction"  Foreground="White" Width="20" SelectionChanged="CategoryAction_SelectionChanged" DataContext="{Binding categoryId}">
                                                            <ComboBox.Background >
                                                                <ImageBrush ImageSource="/Assets/nav.png"   />
                                                            </ComboBox.Background>
                                                            <ComboBoxItem Background="#4d4d4d" Tag="Edit">
                                                                <StackPanel Orientation="Horizontal">
                                                                    <Image Source="/Assets/edit_2.png" Width="15"></Image>
                                                                    <TextBlock Foreground="White" Margin="6,0,0,0">Edit</TextBlock>
                                                                </StackPanel>
                                                            </ComboBoxItem>
                                                            <ComboBoxItem Background="#4d4d4d" Tag="Delete">
                                                                <StackPanel Orientation="Horizontal">
                                                                    <Image Source="/Assets/delete.png" Width="15"></Image>
                                                                    <TextBlock Foreground="White" Margin="6,0,0,0">Delete</TextBlock>
                                                                </StackPanel>
                                                            </ComboBoxItem>

                                                        </ComboBox>
                                                    </StackPanel>
                                                </DataTemplate>
                                            </SFGrid:GridTemplateColumn.CellTemplate>
                                        </SFGrid:GridTemplateColumn>

                                    </SFGrid:SfDataGrid.Columns>
                                </SFGrid:SfDataGrid>

----CS Page---
// Assigning ItemSource to the data grid
mbctrgy = await MessageManager.GetAllCategories();
if (mbctrgy.Count != 0)
                {
                    ListData.ItemsSource = mbctrgy;
                }


// getting which row is to be selected
 private void ListData_SelectionChanged(object sender, Syncfusion.UI.Xaml.Grid.GridSelectionChangedEventArgs e)
        {
            try
            {
                if (ListData.SelectedItem != null)
                {
                    category_id = ((LN2Entities.Model.Forum.MBCategory)(ListData.SelectedItem)).categoryId;
                    if (category_id != 0)
                    {
                        string category_name = ((LN2Entities.Model.Forum.MBCategory)(ListData.SelectedItem)).name;

                        viewSubCategoryList(category_id, category_name);
                    }
                }
            }
            catch { }



        }

Except this there is no method related to datagridview was implemented anywhere. Please help me regarding this issue.Waiting for you reply.

Thanks in advance.


6 Replies

AN Ashok N Syncfusion Team March 20, 2014 11:12 AM UTC

Hi Arpita,

Sorry for the inconvenience caused.

We are unable to reproduce the reported issue. We have tested the reported issue by creating simple sample but we couldn’t get any Exception. We have attached our sample in the below location. Could you please revert us by modifying the sample based on your application? This would be more helpful for us to serve you.

Sample Link: http://www.syncfusion.com/uploads/user/directTrac/120163/winrtsample-1211715240.zip

Please let us know if you have any queries.

Thanks,

Ashok



AR Arpita March 20, 2014 02:18 PM UTC

Thanks for such a quick Reply Ashoke.
I was not able to execute your project,it is showing cannot resolve windows metadata.


AR Arpita March 20, 2014 02:21 PM UTC

I am also not getting the error everytime I execute the project. Rarely it is showing.But when the error occurs my app is getting crashed. Also I am developingWindows Store App with Caliburn Micro Framework. 


AN Ashok N Syncfusion Team March 24, 2014 06:17 AM UTC

Hi Arpita,

Sorry for the inconvenience caused.

We have downloaded and tested the attached sample but we didn’t face any error. However, can you please remove the assembly and add correct version of assembly installed in your machine and run the sample?  Else, share the simple sample based on your application that will help to reproduce the issue and would be more helpful for us to serve you.

Please let us know, if you have any queries.

Thanks,

Ashok



SN Syed Najmuddin Asif January 16, 2015 08:05 PM UTC

Hi,

Even I'm getting this error, this is not something we can reproduce as it is comes very rarely but it does crashes the app. 

Thanks,
Syed Asif


AN Ashok N Syncfusion Team January 19, 2015 12:45 PM UTC

Hi Syed Asif,

We are sorry about the inconvenience caused.

We have analyzed your query but we are unable to reproduce the reported issue. We have tested the reported issue with previously updated sample using product version 12.4 but we couldn’t get any Exception in the time of project execution. We have tested this query in many times but we didn’t face any exception. We have attached our sample in the below sample location. Could you please revert us by modifying the sample based on your application? This would be more helpful for us to serve you.

Sample Link: http://www.syncfusion.com/downloads/support/directtrac/116028/Headerbinding-1167626170.zip

Please let us know, if you require further assistance.

Thanks,

Ashok



Loader.
Live Chat Icon For mobile
Up arrow icon