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

SL5 RadComboBox Fails to Load Data from RadDomainDataSource

2 Answers 124 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Brad
Top achievements
Rank 1
Brad asked on 13 Feb 2012, 11:16 PM
I have a view that has a RadDomainDataSource defined like so:

<telerik:RadDomainDataSource
          x:Name="surveyDomainDataSource"
          AutoLoad="True"
          QueryName="GetSurveyableUsersQuery">
 
     <telerik:RadDomainDataSource.DataContext>
         <webProject:SurveyContext />
     </telerik:RadDomainDataSource.DataContext>
 
</telerik:RadDomainDataSource>

Inside of the same view, I have a RadComboBox with the following declaration:

<telerik:RadComboBox
        x:Name="cboTechName"
        Height="23"
        HorizontalAlignment="Left"
        Margin="26,53,0,0"
        Width="240"
        VerticalAlignment="Top"
        ItemsSource="{Binding ElementName=surveyDomainDataSource, Path=Data}"
        SelectedValuePath="UserId"
        DisplayMemberPath="DisplayInfo" />

When I debug the view in a browser, I see the following error in the Output window of VS2010:

System.Windows.Data Error: BindingExpression path error: 'Data' property not found on 'Telerik.Windows.Controls.RadDomainDataSource' 'Telerik.Windows.Controls.RadDomainDataSource' (HashCode=18443210). BindingExpression: Path='Data' DataItem='Telerik.Windows.Controls.RadDomainDataSource' (HashCode=18443210); target element is 'Telerik.Windows.Controls.RadComboBox' (Name='cboTechName'); target property is 'ItemsSource' (type 'System.Collections.IEnumerable')..

Here is my DomainService code:

[EnableClientAccess()]
[RequiresAuthentication]
public class SurveyService : DomainService
{
    [Query()]
    [RequiresRole("Surveys_GenerateSurvey")]
    public IQueryable<SurveyableUser> GetSurveyableUsers()
    {
        SurveyRepository rep = new SurveyRepository();
        return rep.GetSurveyableEmployees();
    }
     
    .....
}

And here is the SurveyableUser POCO:

public partial class SurveyableUser
{
    public SurveyableUser() { }
 
    [Key()]
    public Guid UserId { get; set; }
    public string DisplayInfo { get; set; }
    public int TMSID { get; set; }
}

This code is very similar to another view where I'm doing the same thing, but populating a RadTreeView and it works fine.

Looking for any ideas here...  I've been messing with this for so long, that I'm afraid that i'm just overlooking something.  But I can't see it.

One interesting thing to note is that when I build the solution, I get the following warning in the Output window:

C:\Program Files (x86)\MSBuild\Microsoft\Silverlight\v5.0\Microsoft.Ria.Client.targets(303,5): warning : DomainService 'SurveyService' does not contain any public domain operations.

I'm concerned that that is the root of the problem.  But when I view the generated code in the Generated_Code folder of the Silverlight client app, I see the appropriate query as well as the client version of SurveyableUser.

Any thoughts?  Thanks in advance.

2 Answers, 1 is accepted

Sort by
0
Brad
Top achievements
Rank 1
answered on 14 Feb 2012, 02:29 AM
Something that I forgot to mention:  In the view where similar code is working, the view is in the main Silverlight Business Application, and the DomainService is in the Web Project of the same application.  In the View where this is NOT working, the View is in a WCF RIA Services Class Library, and the DomainService is in the Web Project of the same class library.  I do NOT get the 'no public domain operations' error when building the class Library.  I only get it when I build the Silverlight application that consumes the class library.  The class library is then consumed by the same Silverlight Business Application as mentioned before.  Hope that's not too confusing...
0
Brad
Top achievements
Rank 1
answered on 17 Feb 2012, 08:39 PM
This problem was not related to the RadDomainDataSource or the RadComboBox.  The problem is that if a RIA Services class library is being used, then there can't be a RIA link between the main Silverlight application and web project.  So I moved all RIA Services to class libraries and the Domain Services can be hit now.
Tags
ComboBox
Asked by
Brad
Top achievements
Rank 1
Answers by
Brad
Top achievements
Rank 1
Share this question
or