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

Details column problem on 2nd click?

2 Answers 64 Views
GridView
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Rob Ainscough
Top achievements
Rank 1
Rob Ainscough asked on 17 May 2012, 01:34 AM
I'm getting a strange "Webpage Error" (never seen this dialog box before) when I click on a detail (+ button) on a GridView row the 2nd time (1st time I click on a detail row, no error):

Error: Unhandled Error in Silverlight Application 
Code: 2028    
Category: ParserError       
Message: The name already exists in the tree: SetupDiscountDetails.     
File:      
Line: 0     
Position: 0     

It then prompts me if I want to launch VS 2010 or debug with IE ... the bizarre part is that I'm already in VS 2010 and running the IDE/debugger??

It gets even stranger, it appears the Mouse movement across any part of the Grid will keep triggering the error??  Very confused.

Here is the XAML in my page/usercontrol:

<DataTemplate x:Key="DiscountDetailDataTemplate">
 
    <local:DCDiscountDetails x:Name="SetupDiscountDetails" />
     
</DataTemplate>
 
           <telerik:RadGridView x:Name="DiscountsGridView" Margin="4" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="7" Grid.RowSpan="2"
                                 AreRowDetailsFrozen="True"
                                 AutoGenerateColumns="False"
                                 CanUserFreezeColumns="False"
                                 CanUserReorderColumns="False"
                                 CanUserResizeColumns="False"
                                 CanUserSortColumns="False"
                                 RowIndicatorVisibility="Collapsed"
                                 DataContext="{Binding Source={StaticResource DiscountData}}"
                                 ItemsSource="{Binding Collection}"
                                 RowDetailsTemplate="{StaticResource DiscountDetailDataTemplate}"
                                 ShowGroupPanel="False">
                <telerik:RadGridView.Columns>
                    <telerik:GridViewToggleRowDetailsColumn />
                    <telerik:GridViewDataColumn Header="DiscountID" IsVisible="False" DataMemberBinding="{Binding DiscountID}" />
                    <telerik:GridViewDataColumn Header="Name" MaxWidth="300" MinWidth="300" Width="300" DataMemberBinding="{Binding DiscountName}" />
                    <telerik:GridViewDataColumn Header="Method" MaxWidth="150" MinWidth="150" Width="150" DataMemberBinding="{Binding DiscountMethod}" />
                    <telerik:GridViewColumn CellTemplate="{StaticResource DomicoDeleteMiniButton}" FooterTextAlignment="Center" IsResizable="False" IsGroupable="False" IsFilterable="False" MaxWidth="30" MinWidth="30" TextAlignment="Center" Width="30" Background="Transparent" HeaderTextAlignment="Center" IsSortable="False" IsReorderable="False" ShowDistinctFilters="False" />
                </telerik:RadGridView.Columns>
            </telerik:RadGridView>

Here is the kicker, if I don't use my UserControl DCDiscountDetails and just copy paste the DCDiscountDetails XAML into the DataTemplate section, I don't get the error??

Any suggestions?  It looks like I can't specify a "UserControl" inside of a DataTemplate -- but that can't be true, can it?

Rob

2 Answers, 1 is accepted

Sort by
0
Rob Ainscough
Top achievements
Rank 1
answered on 17 May 2012, 08:46 PM
I solved this problem by changing:

<local:DCDiscountDetails x:Name="SetupDiscountDetails" />

to this:

<local:DCDiscountDetails />
0
Dimitrina
Telerik team
answered on 18 May 2012, 08:23 AM
Hello,

 I am glad to hear that. The error occurred because the RowDetails are created for more than one row. You cannot have all of them with the same name.

Regards,
Didie
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

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