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

Adding DataMemberBinding for sorting is messing up Editing Template

3 Answers 26 Views
GridView
This is a migrated thread and some comments may be shown as answers.
James
Top achievements
Rank 1
James asked on 14 Jan 2015, 06:12 PM
GridView V2014.1.0428.45

So I have the following GridViewDataColumn.  Everything was working fine with the editing binding until I added the DataMemberBinding to the GridViewDataColumn header to facilitate sorting.

<telerikGrid:GridViewDataColumn IsReadOnly="{Binding Data.IsReadOnly, Source={StaticResource bindingProxy}}"
                                                            Header="Public Domain" HeaderCellStyle="{StaticResource GridViewHeaderCellStyle}" Width="100"
                                                            DataMemberBinding="{Binding PublicDomain}">
                                <telerikGrid:GridViewDataColumn.CellTemplate>
                                    <DataTemplate>
                                        <TextBlock Text="{Binding PublicDomain}" />
                                    </DataTemplate>
                                </telerikGrid:GridViewDataColumn.CellTemplate>
                                <telerikGrid:GridViewDataColumn.CellEditTemplate>
                                    <DataTemplate>
                                        <TextBox Text="{Binding PublicDomain, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
                                                 PreviewTextInput="PublicDomainTextBox_PreviewTextInput" />
                                    </DataTemplate>
                                </telerikGrid:GridViewDataColumn.CellEditTemplate>
                            </telerikGrid:GridViewDataColumn>

Once I added the DataMemberBinding to the ColumnHeader, now when I navigate out of this cell on the Grid, I get an additional set to PublicDomain that sets it back to null, no matter what the user has typed into the TextBox.  I've verified that taking out the DataMemberBinding returns things to working.

My understanding was that adding that DataMemberBinding shouldn't change the behavior of the CellEditTemplate.  Is there something else that's been done wrong here that could be causing the binding to not work properly once DataMemberBinding is set?

Thanks.

3 Answers, 1 is accepted

Sort by
0
Dimitrina
Telerik team
answered on 15 Jan 2015, 09:35 AM
Hi,

You can specify SortMemberPath to configure the sorting to be done based on a property directly. You can also use GridViewColumn in that case.

How does this work for you?

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
James
Top achievements
Rank 1
answered on 15 Jan 2015, 06:11 PM
Well, that doesn't work for us, but I honestly can't figure out what is wrong.  I've downloaded the test app that you sent us in a previous problem in December and can't reproduce the problems we are having.  I don't know why the GridView works differently in our app than it does in your test applications but it is unbelievably frustrating and a massive time sink.   I don't know what exactly we are doing, but something we are doing is breaking the grid and causing it to send out odd results in binding (especially with Nullable DateTimes) and causing all kinds of bizarre problems for us. 

I spent about 8 hours hacking around the problems yesterday and got the grid into a workable state, but the stuff I did to make it work is just off the wall..  At this point I honestly have no idea how to get the grid working properly in our app.  I'm sure it's something odd that we have done, but I don't have a good idea of how to diagnose what or fix it. 
0
Dimitrina
Telerik team
answered on 17 Jan 2015, 07:04 AM
Hi,

In your previous reply you said it is working fine if no DataMemberBinding is specified. Have you deleted it and tried just using SortMemberPath instead?

If so, and you still experience the problem, may I ask you to try isolating the issue in a demo project illustrating your exact setup and send it to us in a support ticket? You can also take a look at this blog post for a reference on how to isolate an issue. 

Regards,
Dimitrina
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
GridView
Asked by
James
Top achievements
Rank 1
Answers by
Dimitrina
Telerik team
James
Top achievements
Rank 1
Share this question
or