SL5 RadComboBox Fails to Load Data from RadDomainDataSource

3 posts, 0 answers
  1. Brad
    Brad avatar
    7 posts
    Member since:
    Sep 2011

    Posted 13 Feb 2012 Link to this post

    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. Brad
    Brad avatar
    7 posts
    Member since:
    Sep 2011

    Posted 13 Feb 2012 Link to this post

    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...
  3. DevCraft banner
  4. Brad
    Brad avatar
    7 posts
    Member since:
    Sep 2011

    Posted 17 Feb 2012 Link to this post

    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.
Back to Top