Download the full sample here
Note, you can grab the “Data\Media” dir from the original one if you all the cool videos for a demo.
1. Silverlight Support
We updated the old <asp:Media> control.. it is now called <asp:MediaPlayer> here is an example usage:
Oh, I didn’t use it in this demo, but we also renamed <asp:Xaml> to <asp:Silverlight>
Read more about these in the ASP.NET Silverlight quickstarts
2. AJAX Support
We updated the history support and integrated it more deeply into the product… This gives developers full control of the meaning of the browsers forward and back buttons within their applications. Rather than the <asp:History> syntax, there is now a simple property on ScriptManager called “EnableHistory. Notice I am also setting EnableStateHash to false as it makes debugging easier as it leaves the URL string human readable.. you may or may not want that in your site, so it is an option. Then I set a server side method HistoryNavigate that handles the pushing stuff into the property bag when navigating away and pulling it out of the property bag when navigating into the page.
Then, any time your app process a user action that represents a change it state, you can add a history point this creates a new “backbutton” state.
Then, each time the page is navigated, you get a chance to check out that state and initialize your controls based on it. Notice after I update the controls, I kick the UpdatePanel to update as well..
Read more in the Ajax quickstarts..
3. MVC within a Web Site project
There have been a ton of great MVC samples… This one I wanted to try what is not considered a best practice, but it does help you learn what is going on with MVC and web site projects. I wanted to quickly write an RSS feed of the video in my site. I used the data model I already had for this site, then added a very simple controller… Notice the nice clean URLs I get? Notice how i can pass in arguments so that folks can build up customer feeds? It is simple to build your just about anything you can do wit Linq..
But the best part? Check out the RSS feedcode.. I litterally just grabbed the feed from my blog and parameterized it based on the ViewData.. One tip, notice I had to start he Xml on the SAME LINE as the Page directives.. the ensures there is no leading whitespace (which the RSS spec does not allow)…
Read my full post on this… RSS Feed with the new ASP.NET MVC Framework
4. Dynamic Data…
Ok, ok.. I didn’t get a chance to add dynamic data to MySilverlightTV… but I still plan to. In the mean time, check out Scott Hunter’s new blog.. he introduces dynamic data and will be talking about it more in the future. Also, check out the quickstarts for a very good overview.