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

adding/validating problems

3 Answers 254 Views
GridView
This is a migrated thread and some comments may be shown as answers.
branko
Top achievements
Rank 1
branko asked on 14 May 2009, 08:12 AM
Hello. 

I'm back with more questions and problems.

  1. When inserting new row into master grid (master/child scenario), new row is out of alignment with other rows. This is clearly a bug?
  2. When cell in grid has focus, routed commands (trigerred through button in a toolbar) get selected GridViewCell as ExecutedRoutedEventArgs.OriginalSource. When only row has focus (row is selected but no cell has focus) nothing (button itself) is returned as OriginalSource. Shouldn't selected GridViewRow be passed in OriginalSource?
  3. 4. After adding new record to child grid (in a way explained here here), that new row is immediately removed. I add record to database (LINQ) in RowEditEnded, so after restarting an application record does show. The cause seems to be RadGrid not inserting data into underlying LINQ container. This does not happen in master grid. Child grid ItemsSource is set to "{Binding MasterRecord.Data.Addresses}". Addresses is a property of class EntitySet. The workaround is adding new record manually into this collection, which works fine, but I'd like to know this this is the way it's supposed to be or is it some kind of bug (my code or RadGrid doing something wrong).
  4. I'm using binding validation (based on IDataErrorInfo implemented in business objects). I have problems marking cells that have validation errors. Setting Validation.ErrorTemplate has more or less unpredictable results. So I use code like this:
        <Style TargetType="{x:Type telerik:GridViewCell}"
            <Style.Triggers> 
                <Trigger Property="Validation.HasError" Value="true"
                    <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" /> 
                    <Setter Property="Background" Value="Red" /> 
                </Trigger> 
            </Style.Triggers> 
        </Style> 
  • This leaves misaligned red borders (where inserted cells were marked red for validation errors) in first row even after row has been commited and moved. This remains in place event when scrolling grid. It works fine for row's that were already in database or were only modified, but not for new rows.
  • Red background does not show for fields containging date.

Thanks.
Branko

3 Answers, 1 is accepted

Sort by
0
Nedyalko Nikolov
Telerik team
answered on 16 May 2009, 02:41 PM
Hi branko,

Thank you for your feedback.

1. This is clearly a bug, so I've updated your Telerik points accordingly. The issue is already resolved so you can get it with the next release or service pack.

2. I'm afraid that I cannot understand what you mean. Can you provide me with more detailed info about your scenario? Is this toolbar placed in the GridViewCell? We do not set OriginalSource property explicitly it's done by the Framework.

3. Adding new data item to the source works automatically only for data sources which implement INotifyCollectionChanged and IBindingList. For other kind of collection you have to add data manually and call RadGridView.Rebind() if necessary.

4. The RadGridView provides its own validation logic and you can use CellValidating and RowValidating Event to validate your data. We will consider this as improvement to our validation logic, but I cannot commit with any specific date or release.

Best wishes,
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.
0
branko
Top achievements
Rank 1
answered on 18 May 2009, 08:52 AM
2) It's simple. Button is in toolbar, not in grid. If cell is selected in a grid, that cell is passed as OriginalSource (e.OriginalSource) to event handler routine (like this one):
private void CommandBinding_DeleteRecord_Executed(object sender, ExecutedRoutedEventArgs e) 
... 
If row is selected inside grid, nothing (button itself) is passed as OriginalSource to this handler. Even if framework sets this, it not really logical... But it's only an annoyance. I'll work around it.
3) Ok. It's fine if it works this way. I have a slight problem with Rebind() collapsing all open child grids... 
4) It's more presentation than validation problem. If the same change was triggered by something else, would that not cause the same problem?
0
Accepted
Nedyalko Nikolov
Telerik team
answered on 21 May 2009, 07:05 AM
Hello branko,

2. Thank you for the additional info, I will research this annoyance.
3. Probably you call Rebind() to the Master RadGridView, try call DetailGrid.Rebind()
4. As this validation handling is set on the Binding, certainly this will be the behavior. As I said in previous post we will consider how to handle this kind of validation properly.

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