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

Data doesn't show in the dataform

5 Answers 166 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.
Kamal Mostofi
Top achievements
Rank 1
Kamal Mostofi asked on 29 Mar 2011, 11:56 PM
Hi,

I created a page to find out more about telerik dataform. Below is the code
<telerik:RadDomainDataSource x:Name="dsbijslogans" QueryName="GetSlogans"  AutoLoad="True" >
           <telerik:RadDomainDataSource.DataContext>
               <ds:SloganServices></ds:SloganServices>
           </telerik:RadDomainDataSource.DataContext>
       </telerik:RadDomainDataSource>
       <Border x:Name="ContentBorder"  Style="{StaticResource ContentBorderStyle}">
           <telerik:RadDataForm telerik:Theming.Theme="Office_Blue" AutoGenerateFields="False" ItemsSource="{Binding dsbijslogans}" Background="Transparent" Header="Home Page Slogans" Margin="50"  >
               <telerik:RadDataForm.ReadOnlyTemplate>
                   <DataTemplate>
<telerik:DataFormDataField DataMemberBinding="{Binding slogans, Mode=TwoWay}" Label="Slogans" Foreground="SlateGray"></telerik:DataFormDataField>
                   </DataTemplate>
               </telerik:RadDataForm.ReadOnlyTemplate>
           </telerik:RadDataForm>
       </Border>

When I run the application, the form is blank. If I set AutoGenerateFields to true and remove ReadOnlyTemplate, the form is still blank. The data source query is fine.
Have I missing anything in my xamle code?
Do I have to load the datasource in the Load Page in code behind?

Thanks for your help.
Kam

5 Answers, 1 is accepted

Sort by
0
Accepted
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
answered on 30 Mar 2011, 12:08 AM
It seems to me that your Itemssource is not corectly bound

when you are binding to another element in the page you need to us "elementname="
like so:

ItemsSource="{Binding DataView, ElementName=dsbijslogans}"

thanks
dco
0
Kamal Mostofi
Top achievements
Rank 1
answered on 30 Mar 2011, 09:57 PM
Hello dco,

thanks for your reply.
I changed telerik domain datasource with ria domain datasource, and it worked. I don't know what i missed in telerik domain data source that it didn't run.

<Border x:Name="ContentBorder"  Style="{StaticResource ContentBorderStyle}">
  
            <telerik:RadDataForm telerik:Theming.Theme="Office_Blue" AutoGenerateFields="False" ItemsSource="{Binding Data, ElementName=sloganDomainDataSource}" Background="Transparent" Header="Home Page Slogans" Margin="50"  >
                <telerik:RadDataForm.ReadOnlyTemplate>
                    <DataTemplate>
                        <telerik:DataFormDataField DataMemberBinding="{Binding slogans, Mode=TwoWay}" Label="Slogans" Foreground="SlateGray"></telerik:DataFormDataField>
                    </DataTemplate>
                </telerik:RadDataForm.ReadOnlyTemplate>
            </telerik:RadDataForm>
              
        </Border>
        <riaControls:DomainDataSource AutoLoad="True" d:DesignData="{d:DesignInstance my:Slogan, CreateList=true}" Height="0" LoadedData="sloganDomainDataSource_LoadedData" Name="sloganDomainDataSource" QueryName="GetSlogans" Width="0">
            <riaControls:DomainDataSource.DomainContext>
                <ds:SloganServices />
            </riaControls:DomainDataSource.DomainContext>
        </riaControls:DomainDataSource>

Thanks,
Kam
0
Accepted
Milan
Telerik team
answered on 31 Mar 2011, 09:44 AM
Hi Kamal Mostofi,

Using ElementName in this scenario is required since the DomainService is not DataContext of the DataForm.  Using "{Binding dsbijslogans}" means that the binding will  use the DataContext as a source of the binding but in the snippet that you have posted the DataContext property is set.

This is the standard behavior of Bindings that we do not control. More information about Silverlight Binding can be found here


Regards,
Milan
the Telerik team
0
Kamal Mostofi
Top achievements
Rank 1
answered on 31 Mar 2011, 12:27 PM
Hello Milan,

Thanks for your reply. I fixed it as you suggested and I posted preivously. but I am still wondering why it didn't work with Telerik DomainData Services. If I use Ria domaindataservices, I can see the data in Telerik data form but not with Telerik domain control.
Regards,
Kam
0
Pavel Pavlov
Telerik team
answered on 05 Apr 2011, 10:18 AM
Hello Kamal Mostofi,

Can you please paste me the fixed code that is working with the MS DataSource and not working with RadDomainDataSource. I am going to check what went wrong and I will do my best to provide a fix or solution for you .

All the best,
Pavel Pavlov
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
DataForm
Asked by
Kamal Mostofi
Top achievements
Rank 1
Answers by
David Ocasio
Top achievements
Rank 2
Iron
Veteran
Iron
Kamal Mostofi
Top achievements
Rank 1
Milan
Telerik team
Pavel Pavlov
Telerik team
Share this question
or