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

Combining RadDataForm & RadGridView leads to stack overflow

1 Answer 143 Views
DataForm
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
HDC
Top achievements
Rank 1
HDC asked on 10 Apr 2011, 09:04 AM

I have created a form with following:

RadGridView
RadPager
RadDataForm
RadDomainDatasource

Object is to create a master-details form. I know there is a way to define an edit template for a grid, but that is not a good solution if you have to edit a large number of fields. I therefore want the traditional master-detail form.

When i set AutoCommit to false, it will no longer lead to stack overflow, but calling .submitchanges() on the domaindatasource will return an error that you first need to end the edit. This problem can also not be solved either, since even if i call CommitEdit on the dataform and the grid, it will still say that you first need to end the edit.

<navigation:Page x:Class="RadControlsSilverlightApp1.OrganizationsView" 
           xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" 
           xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
           xmlns:my="clr-namespace:RadControlsSilverlightApp1"
           xmlns:my1="clr-namespace:RadControlsSilverlightApp1.Web" 
           mc:Ignorable="d"
           xmlns:navigation="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Navigation"
           d:DesignWidth="640" d:DesignHeight="480"
           Title="OrganizationsView Page" 
           xmlns:riaControls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.DomainServices" 
  
    <Grid x:Name="LayoutRoot">
        <riaControls:DomainDataSource AutoLoad="True" 
                                      Height="0" Width="0"
                                      LoadedData="organizationDomainDataSource_LoadedData" 
                                      x:Name="organizationDomainDataSource" 
                                      QueryName="GetOrganizationsQuery" 
                                      PageSize="20">
            <riaControls:DomainDataSource.DomainContext>
                <my1:ExqiOfficeDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
  
        <riaControls:DomainDataSource AutoLoad="True" 
                                      Height="0" Width="0"                                      
                                      x:Name="countriesDomainDataSource" 
                                      QueryName="GetCountriesQuery">
            <riaControls:DomainDataSource.DomainContext>
                <my1:ExqiOfficeDomainContext />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>
  
        <telerik:RadBusyIndicator 
            IsBusy="{Binding IsBusy, ElementName=OrganizationsGrid}">
              
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="300"></RowDefinition>
                    <RowDefinition Height="50"></RowDefinition>
                    <RowDefinition Height="400"></RowDefinition>
                </Grid.RowDefinitions>
                <telerik:RadGridView x:Name="OrganizationsGrid" 
                                     ItemsSource="{Binding ElementName=organizationDomainDataSource, Path=Data}" 
                                     AutoGenerateColumns="False" 
                                     IsReadOnly="False"
                                     IsBusy="{Binding IsBusy, ElementName=organizationDomainDataSource}" 
                                     Grid.Row="0"
                                     >
                      
                  
                    <telerik:RadGridView.Columns>
                        <telerik:GridViewDataColumn Header="Name" UniqueName="Name" Width="200"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn Header="Address" UniqueName="Address" Width="150"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn Header="Zip Code" UniqueName="Zipcode"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn Header="Place" UniqueName="Place" Width="150"></telerik:GridViewDataColumn>
                        <telerik:GridViewComboBoxColumn Header="Country" UniqueName="CountryId" 
                                                        ItemsSource="{Binding ElementName=countriesDomainDataSource, Path=Data}"
                                                        SelectedValueMemberPath="CountryId" 
                                                        DisplayMemberPath="Name">                        
                        </telerik:GridViewComboBoxColumn>
                        <telerik:GridViewDataColumn Header="VAT" UniqueName="VAT" Width="150"></telerik:GridViewDataColumn>
                        <telerik:GridViewDataColumn Header="Created On" UniqueName="DateCreated"></telerik:GridViewDataColumn>
                    </telerik:RadGridView.Columns>                
                </telerik:RadGridView>
                <telerik:RadDataPager Source="{Binding Data, ElementName=organizationDomainDataSource}" Grid.Row="1"/>
                <telerik:RadDataForm  x:Name="OrganizationsEditor"
                    ItemsSource="{Binding ElementName=organizationDomainDataSource, Path=Data}" AutoGenerateFields="False" 
                    AutoEdit="True" 
                    AutoCommit="True"
                    CommandButtonsVisibility="Delete,Add,Cancel,Commit" 
                    Grid.Row="2" EditEnded="RadDataForm_EditEnded">
                    <telerik:RadDataForm.ReadOnlyTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="180"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition></RowDefinition>
                                </Grid.RowDefinitions>
  
                                <telerik:Label Grid.Column="0" Grid.Row="0" IsTabStop="False">Name:</telerik:Label>
                                <telerik:DataFormDataField Grid.Column="1" Grid.Row="0">
                                    <TextBox Text="{Binding Name, Mode=TwoWay}" IsEnabled="True"></TextBox>
                                </telerik:DataFormDataField>
  
                                <telerik:Label Grid.Column="0" Grid.Row="4" IsTabStop="False">Country:</telerik:Label>
                                <telerik:DataFormComboBoxField Grid.Column="1" Grid.Row="1">
                                    <telerik:RadComboBox SelectedValue="{Binding CountryId, Mode=TwoWay}" 
                                                     SelectedValuePath="CountryId" 
                                                     DisplayMemberPath="Name" 
                                                     ItemsSource="{Binding ElementName=countriesDomainDataSource, Path=Data}"
                                                     IsEnabled="True"
                                                     >
  
                                    </telerik:RadComboBox>
                                </telerik:DataFormComboBoxField>
  
                            </Grid>
                        </DataTemplate>
                    </telerik:RadDataForm.ReadOnlyTemplate>
                    <telerik:RadDataForm.EditTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="180"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition></RowDefinition>
                                </Grid.RowDefinitions>
  
                                <telerik:Label Grid.Column="0" Grid.Row="0" IsTabStop="False">Name:</telerik:Label>
                                <telerik:DataFormDataField Grid.Column="1" Grid.Row="0">
                                    <TextBox Text="{Binding Name, Mode=TwoWay}" IsEnabled="True"></TextBox>
                                </telerik:DataFormDataField>
  
                                <telerik:Label Grid.Column="0" Grid.Row="4" IsTabStop="False">Country:</telerik:Label>
                                <telerik:DataFormComboBoxField Grid.Column="1" Grid.Row="1">
                                    <telerik:RadComboBox SelectedValue="{Binding CountryId, Mode=TwoWay}" 
                                                     SelectedValuePath="CountryId" 
                                                     DisplayMemberPath="Name" 
                                                     ItemsSource="{Binding ElementName=countriesDomainDataSource, Path=Data}"
                                                     IsEnabled="True"
                                                     >
  
                                    </telerik:RadComboBox>
                                </telerik:DataFormComboBoxField>
  
                            </Grid>
                        </DataTemplate>
                    </telerik:RadDataForm.EditTemplate>
                    <telerik:RadDataForm.NewItemTemplate>
                        <DataTemplate>
                            <Grid>
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="180"></ColumnDefinition>
                                    <ColumnDefinition></ColumnDefinition>
                                </Grid.ColumnDefinitions>
                                <Grid.RowDefinitions>
                                    <RowDefinition></RowDefinition>
                                    <RowDefinition></RowDefinition>
                                </Grid.RowDefinitions>
                                <telerik:Label Grid.Column="0" Grid.Row="0" IsTabStop="False">Name:</telerik:Label>
                                <telerik:DataFormDataField Grid.Column="1" Grid.Row="0">
                                    <TextBox Text="{Binding Name, Mode=TwoWay}" IsEnabled="True"></TextBox>
                                </telerik:DataFormDataField>
  
                                <telerik:Label Grid.Column="0" Grid.Row="4" IsTabStop="False">Country:</telerik:Label>
                                <telerik:DataFormComboBoxField Grid.Column="1" Grid.Row="1">
                                    <telerik:RadComboBox SelectedValue="{Binding CountryId, Mode=TwoWay}" 
                                                     SelectedValuePath="CountryId" 
                                                     DisplayMemberPath="Name" 
                                                     ItemsSource="{Binding ElementName=countriesDomainDataSource, Path=Data}"
                                                     IsEnabled="True"
                                                     >
  
                                    </telerik:RadComboBox>
                                </telerik:DataFormComboBoxField>
  
                            </Grid>
                        </DataTemplate>
                    </telerik:RadDataForm.NewItemTemplate>
  
                </telerik:RadDataForm>
                  
            </Grid>
        </telerik:RadBusyIndicator>
    </Grid>
</navigation:Page>

To experience stack overflow, run the form then try to change current row... this will block IE and eventually return stack overflow

1 Answer, 1 is accepted

Sort by
0
HDC
Top achievements
Rank 1
answered on 10 Apr 2011, 01:39 PM
My fault, i was using the microsoft DomainDataSource instead of the one from Telerik.
Tags
DataForm
Asked by
HDC
Top achievements
Rank 1
Answers by
HDC
Top achievements
Rank 1
Share this question
or