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

Error because of GridTemplateColumn

I have a Win RT syncfusion Grid, which is having GridTemplateColumn and its CellTemplate  contain the button. but when ever I  click on header to sort it throw the error.

Note: Following is the code i am using for the cancel button column and the issue came just after adding this column.


Please suggest me the way to solve this.





<Grid1:GridTemplateColumn Width="120"  HeaderText="Action" TextAlignment="Left" HorizontalHeaderContentAlignment="Left" AllowSorting="False">
                                <Grid1:GridTemplateColumn.HeaderStyle>
                                    <Style TargetType="Grid1:GridHeaderCellControl">
                                        <Setter Property="Background" Value="#1F6996" />
                                    </Style>
                                </Grid1:GridTemplateColumn.HeaderStyle>
                                <Grid1:GridTemplateColumn.CellTemplate>
                                    <DataTemplate>
                                        <Button Width="120" HorizontalAlignment="Left" Margin="-15,-2"
                                    Height="45" BorderBrush="Black" BorderThickness="1" Background="#3E61B9" Foreground="White"
                                    Command="{Binding Path=CancelCommand}"
                                     CommandParameter="{Binding AppointmentID}" 
                                    Content="Cancel" Click="Button_Tapped" />
                                    </DataTemplate>
                                </Grid1:GridTemplateColumn.CellTemplate>
                            </Grid1:GridTemplateColumn>


1 Reply

JG Jai Ganesh S Syncfusion Team September 30, 2013 11:06 AM UTC

Hi Khurram,

 

Thanks for contacting Syncfusion support.

 

We have analyzed your query. You must define the MappingName for the GridTemplateColumn to perform the Sorting, Grouping and Filtering operations. If your application doesn’t have any bounded property to define the MappingName for the GridTemplateColumn then you can use GridUnBoundColumn instead of GridTemplateColumn to achieve your requirement. For GridUnBoundColumn you can define any string value as MappingName.  Following code snippet to illustrate how to use the GridUnboundColumn,

 

Code snippet[Xaml]:

 

<syncfusion:GridUnBoundColumn AllowSorting="True" HeaderText="Action" MappingName="Property">

                        <syncfusion:GridUnBoundColumn.CellTemplate>

                            <DataTemplate>

                                <Button Width="120"

                                    Height="45"

                                    HorizontalAlignment="Left"

                                    Background="#3E61B9"

                                    BorderBrush="Black"

                                    BorderThickness="1"

                                    Command="{Binding Path=CancelCommand}"

                                    CommandParameter="{Binding EmployeeCountry}"

                                    Content="Cancel"

                                    Foreground="White" />

                            </DataTemplate>

                        </syncfusion:GridUnBoundColumn.CellTemplate>

                    </syncfusion:GridUnBoundColumn>

 

Please let us know if you need further assistance.

 

Thank you,

Jai Ganesh S


Loader.
Live Chat Icon For mobile
Up arrow icon