Skip to content

Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2 (Article 6 of 7)

Updated: at 02:12 PM

 

  Title Of Each Article Video Included With Each Post
Part 1 Introduction To RIA Services In Silverlight (This Article) 7 Minutes
Part 2 Basic RIA Services And DataGrid With  VS 2010 Tooling 14 Minutes
Part 3 Adding A DataGrid With Connect The Dots DataBinding in VS 2010 13 Minutes
Part 4 Adding a Navigation Page to a Silverlight Business Application Template 11 Minutes
Part 5 Adding Speakers Page Template With Converters In Visual Studio 2010 Beta2 11 Minutes
Part 6 Adding A Sessions Page That Includes a Query Parameter In Silverlight VS2010 Beta2 10 Minutes
Part 7 Basic Authentication and Authorization In RIA Services 5 Minutes

[media id=7]

In this section, we will talk about what happens when the users presses the “Sessions” hyperlink from the speakers page.  If you remember from the last article, we used a special converter on the Speakers.xaml page and bound that to the hyperlink titled sessions as shown below.

 

image

 

When this link is clicked, the navigation created is as follows:

 
http://localhost:9951/Presentation1TestPage.aspx#/Sessions?SpeakerId=903

// Executes when the user navigates to this page.
protected override void OnNavigatedTo(NavigationEventArgs e)
{
    //Handle SpeakerId
    var qs = NavigationContext.QueryString;
    if (qs.ContainsKey("SpeakerId"))
    {
        this.sessionsOverviewDomainDataSource.FilterDescriptors =
            new FilterDescriptorCollection();
        this.sessionsOverviewDomainDataSource.FilterDescriptors.Add(
              new FilterDescriptor("AttendeeId",
                  FilterOperator.IsEqualTo, qs["SpeakerId"]));
    }
}

This simply adds a filter to the current DomainDataSource that filters the column AttendeeId with the passed in query parameter SpeakerId.

 

The resulting page looks as follows assuming Peter Kellner’s Session link was clicked.

 

image

 

The video referenced in this article goes into building this page in more details, but fundamentally, the major point is just the query parameter.

Check out the ORM (Object Relational Mapper) PRISMA. The database access method I use in all my projects