views:

44

answers:

1

Hi All,

I want to set navigateURI to the dynamically created hyperlink. I am using the following code but it is not navigation to the page if i pass parameter. showing the following error.

Code:

   Hyperlink hlProduct = new Hyperlink(new InlineUIContainer(img));
   hlProduct.NavigateUri = new Uri("Player.xaml?id=109", UriKind.Relative);

public partial class Player : Page
{        
    public Player(string id)
    {
        InitializeComponent();
     }
} 

Error:

Cannot create object of type 'ProductPlayer'. CreateInstance failed, which can be caused by not having a public default constructor for 'ProductPlayer'. Error in markup file 'Player.xaml' Line 1 Position 7.

Geetha.

A: 

Remove the id parameter from Player class, should be as below:

public Player() { InitializeComponent(); }

To extract the parameters use NavigationService.CurrentSource, which return uri object. Parse this object to get id value.

Ragunathan