views:

33

answers:

2

I have an ASP.MVC application which has a silverlight app inside. I want to change the page when I click one of my buttons. Is there a way to make it?

+2  A: 

I think the HtmlPage.Navigate method is probably what you're looking for.

You'll need the following using statement: using System.Windows.Browser;

HtmlPage.Window.Navigate(new Uri("http://www.mypage.com/newPage.html"));

Just stick this guy in the click event of your button and it should do what you want.

Also, if you wish to navigate within your website, you can use a Relative URI, like so:

HtmlPage.Window.Navigate(new Uri("newPage.html", UriKind.Relative));
Overhed
My VS is complaining that this Navigate method doesnt exist.
Bruno
A: 

What should be done is to use the using System.Windows.Browser; statement, and the, in the click method, add the following code:

HtmlPage.Window.Navigate(new Uri("http://yourpagegoeshere.com"));

Thanks overhed!

Bruno
I was just about to edit my post. :)It looks like they changed this class a bit since the last time I used it.
Overhed