Updates for the Silverlight Training Kit

image We have had a good response to the free 8 module Silverlight Training Kit we released on Channel 9 back at MIX and that Scott Guthrie announced. We have since updated at the Silverlight 4 Launch with some new content and fixes. We’ve also found 2 issues since then that you might run across. I’ve corrected these in the source and will update them on the Channel 9 site in our next round (which I hope to include VB version of the courseware, too!)

In the meantime, here are the fixes to the 2 problems you likely will encounter if you have tried the courseware. These are easy fixes and should make your life much easier :)

Module 3, Exercise 2

When creating the feature to allow users to unregister for an event, the courseware left out a key line of code. You should remove the following line of code:

   1: attendee.AttendeeEvents.Remove(av);

And replace it with this line of code:

   1: this.ObjectContext.AttendeeEvents.DeleteObject(av);

Your UnregisterCurrentUserForEvent method should look like this when you are done:

   1: [Invoke]
   2: public void UnregisterCurrentUserForEvent(int eventId)
   3: {
   4:     Attendee attendee = GetOrCreateAttendeeForCurrentUser();
   5:     AttendeeEvent av = 
   6:         attendee.AttendeeEvents.SingleOrDefault(x => x.EventID == eventId);
   7:     if (av != null)
   8:     {
   9:         this.ObjectContext.AttendeeEvents.DeleteObject(av);
  10:     }
  11:     this.ObjectContext.SaveChanges();
  12: }

Module 3, Exercise 1

This step only needs to be done if you notice that when you try to register a user some of the TextBox controls are disabled in the RIA Services login form. If you are not seeing this behavior, you can skip this step. The problem with the username being disabled in the registration form is due to a change in how RIA Services worked between when we wrote the code and the RTW. If you write it from scratch you should not see this problem. However, if you do encounter this you can fix the problem in your code by adding the [Editable(true)] attribute to the Email and UserName properties in the RegistrationData.cs model class in the web application (not the Silverlight app). Then rebuild the solution so this change gets sent to the Silverlight client too.

   1: [Editable(true)]
   2: public string UserName { get; set; }
   4: [Editable(true)]
   5: public string Email { get; set; }

We are sorry for any inconvenience and are happy to see the training kit being used by so many of you!

Tweet Post Share Update RSS

Hi, I'm John Papa. I author this blog, create courses for Pluralsight and am a Google Developer Expert and Microsoft Regional Director. I travel speaking at events and train technology thought leaders