<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Beckh@m&#039;s Blog &#187; Java Script</title>
	<atom:link href="http://beckh0m.wordpress.com/category/java-script/feed/" rel="self" type="application/rss+xml" />
	<link>http://beckh0m.wordpress.com</link>
	<description></description>
	<lastBuildDate>Wed, 04 Apr 2012 23:47:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='beckh0m.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Beckh@m&#039;s Blog &#187; Java Script</title>
		<link>http://beckh0m.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://beckh0m.wordpress.com/osd.xml" title="Beckh@m&#039;s Blog" />
	<atom:link rel='hub' href='http://beckh0m.wordpress.com/?pushpress=hub'/>
		<item>
		<title>JavaScript &#8211; Flash Communication</title>
		<link>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/</link>
		<comments>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/#comments</comments>
		<pubDate>Sat, 29 Aug 2009 04:28:34 +0000</pubDate>
		<dc:creator>beckh0m</dc:creator>
				<category><![CDATA[Flash]]></category>
		<category><![CDATA[Java Script]]></category>
		<category><![CDATA[Flash Java Script]]></category>

		<guid isPermaLink="false">http://beckh0m.wordpress.com/?p=36</guid>
		<description><![CDATA[I used to work with flash all the times, in fact we used it in almost every project through college. You can do amazing things with flash very easily and honestly I love action script[:D]. Whenever you work with flash you will find yourself need to make flash communicate with other applications. In action script [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=36&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I used to work with flash all the times, in fact we used it in almost every project through college. You can do amazing things with flash very easily and honestly I love action script[:D].<br />
Whenever you work with flash you will find yourself need to make flash communicate with other applications.<br />
In action script you can communicate with a host application (in my case the Browser)<br />
through <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html">External Interface</a>.</p>
<p><strong>To do that you to write a little JavaScript Code:</strong></p>
<p>First you need to get the name of the flash movie and as usual this name differs along with the browser you are using so here is a method that I found here to get you the name of the flash movie whatever the browser is:</p>
<pre class="csharpcode"><span style="color:#0000ff;"><span class="kwrd">function</span> </span>getFlashMovieObject(movieName) {
    <span style="color:#0000ff;"><span class="kwrd">if</span> </span>(window.document[movieName]) {
             <span style="color:#0000ff;"><span class="kwrd">return</span> </span>window.document[movieName];
        }
    <span style="color:#0000ff;"><span class="kwrd">if</span> </span>(navigator.appName.indexOf(<span style="color:#800080;"><span class="str">"Microsoft Internet"</span></span>) == -1) {
                <span class="kwrd">if</span> (document.embeds &amp;&amp; document.embeds[movieName])
                    <span style="color:#0000ff;"><span class="kwrd">return</span> </span>document.embeds[movieName];
            }
    <span style="color:#0000ff;"><span class="kwrd">else</span> </span><span style="color:#008000;">// <span class="kwrd">if</span> (navigator.appName.indexOf(<span class="str">"Microsoft Internet"</span>)!=-1)</span>
            {
                <span class="kwrd">return</span> document.getElementById(movieName);
            }
        }

<span style="color:#008000;">// Now Call the function on your flash movie.</span>

      <span style="color:#0000ff;"><span class="kwrd">function</span> </span>SendDataToFlashMovie(data) {
       <span style="color:#0000ff;">var </span>flashMovie = getFlashMovieObject(<span style="color:#800080;"><span class="str">"myFlashMovie"</span></span>);
       flashMovie.<span style="color:#0000ff;">JStoAS</span>(data);}


<strong>then you have to write alittel Action Script code:</strong>
Now you have to register a callback method to respond to your method call from javascript.



<pre class="csharpcode"><span style="color:#0000ff;"><span class="kwrd">import flash.external.ExternalInterface;</span><span class="kwrd">
ExternalInterface.addCallback</span></span>(<span style="color:#800080;"><span class="str">"JStoAS"</span></span>, getDataFromJavaScript);
<span style="color:#0000ff;"><span class="kwrd">function</span> </span>getDataFromJavaScript(data:<span style="color:#0000ff;"><span class="kwrd">String</span></span>):<span style="color:#0000ff;">void </span>{
<span style="color:#008000;">// Dod whatever you want <span class="kwrd">with</span> data here</span>
}

and that's how it's done [;)]

<span style="color:#000000;"><strong>Beckham</strong></span>
</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/beckh0m.wordpress.com/36/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/beckh0m.wordpress.com/36/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/beckh0m.wordpress.com/36/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=36&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beckh0m.wordpress.com/2009/08/29/javascript-flash-communication/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f1cb642e3bf0857c937c48cab52bcd3d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beckh0m</media:title>
		</media:content>
	</item>
		<item>
		<title>Print support for Facebox and lightbox v1.0</title>
		<link>http://beckh0m.wordpress.com/2009/06/09/print-support-for-facebox-and-lightbox-v1-0/</link>
		<comments>http://beckh0m.wordpress.com/2009/06/09/print-support-for-facebox-and-lightbox-v1-0/#comments</comments>
		<pubDate>Tue, 09 Jun 2009 18:07:28 +0000</pubDate>
		<dc:creator>beckh0m</dc:creator>
				<category><![CDATA[Java Script]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[Facebox lightbox Print]]></category>

		<guid isPermaLink="false">http://beckh0m.wordpress.com/?p=33</guid>
		<description><![CDATA[Hey, Its been a long time i was pretty busy in some work along with preparing to come back to Egypt for a small vacation isA . Anyway, you all know  facebox and Lightbox. I wanted to allow the user to print the content of the facebox and lightbox and sadly this wasn&#8217;t available in [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=33&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Hey, Its been a long time <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  i was pretty busy in some work <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  along with preparing to come back to Egypt for a small vacation isA .</p>
<p>Anyway, you all know  <a href="http://famspam.com/facebox">facebox </a>and <a href="http://www.huddletogether.com/projects/lightbox2/">Lightbox</a>. I wanted to allow the user to print the content of the <a href="http://famspam.com/facebox">facebox </a>and <a href="http://www.huddletogether.com/projects/lightbox2/">lightbox </a>and sadly this wasn&#8217;t available in <a href="http://famspam.com/facebox">facebox </a>and <a href="http://www.huddletogether.com/projects/lightbox/">lightbox </a><a href="http://www.huddletogether.com/projects/lightbox/">v1.0</a> but it&#8217;s available in <a href="http://www.huddletogether.com/projects/lightbox2/">lightbox</a><a href="http://www.huddletogether.com/projects/lightbox2/"> v2.0</a> but sadly i did some modification to my <a href="http://www.huddletogether.com/projects/lightbox/">lightbox </a><a href="http://www.huddletogether.com/projects/lightbox/">v1.0 </a>file and i really was to lazy to redo it in <a href="http://www.huddletogether.com/projects/lightbox2/">lightbox </a><a href="http://www.huddletogether.com/projects/lightbox2/">v2.0</a> <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> .<br />
anyway attached is the <a href="http://famspam.com/facebox">facebox </a>and <a href="http://www.huddletogether.com/projects/lightbox/">lightbox </a><a href="http://www.huddletogether.com/projects/lightbox/">v1.0</a> with print support.</p>
<p>the final output will be like that</p>
<p><img src="http://img25.imageshack.us/img25/7927/facebox.jpg" alt="facebox" /></p>
<p><img src="http://img26.imageshack.us/img26/4982/lightboxg.jpg" alt="lightbox" /></p>
<p>Beckham</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/beckh0m.wordpress.com/33/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/beckh0m.wordpress.com/33/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/beckh0m.wordpress.com/33/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=33&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beckh0m.wordpress.com/2009/06/09/print-support-for-facebox-and-lightbox-v1-0/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f1cb642e3bf0857c937c48cab52bcd3d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beckh0m</media:title>
		</media:content>

		<media:content url="http://img25.imageshack.us/img25/7927/facebox.jpg" medium="image">
			<media:title type="html">facebox</media:title>
		</media:content>

		<media:content url="http://img26.imageshack.us/img26/4982/lightboxg.jpg" medium="image">
			<media:title type="html">lightbox</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.NET MVC Preview 2</title>
		<link>http://beckh0m.wordpress.com/2008/03/15/9/</link>
		<comments>http://beckh0m.wordpress.com/2008/03/15/9/#comments</comments>
		<pubDate>Sat, 15 Mar 2008 07:12:53 +0000</pubDate>
		<dc:creator>beckh0m</dc:creator>
				<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[Java Script]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://beckh0m.wordpress.com/?p=9</guid>
		<description><![CDATA[ASP.NET MVC Preview 2 is released and you can download it from here. In this CTP, A lot of changes happened in the MVC framework such as: 1- When you define a controller action method you don&#8217;t have to put the [ControllerAction] all you have to do is to define the method as public and [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=9&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h2 style="margin:auto 0;">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr">
<p><span style="font-size:medium;">ASP.NET MVC Preview 2 is released and you can download it from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=38CC4CF1-773A-47E1-8125-BA3369BF54A3&amp;displaylang=en">here.</a></span></h2>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr">In this CTP, A lot of changes happened in the MVC framework such as:</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;" dir="ltr">1-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> W</span>hen you define a controller action method you don&#8217;t have to put the <span style="font-size:10pt;font-family:'Courier New';">[<span style="color:#2b91af;">ControllerAction</span>]</span> all you have to do is to define the method as public and it will be part of the contract, Okay but what if I wanted to define a non action method, well now you have to put an attribute <span style="font-family:Wingdings;">J</span> <span style="font-size:10pt;font-family:'Courier New';">[<span style="color:#2b91af;">NonAction</span>]. </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;" dir="ltr">2-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span><span style="font-size:10pt;font-family:'Courier New';">Another thing is the {*catchall} The new * which allows you pass anything from the * to the end of the URL as a parameter for the action. And this is actually what I&#8217;m going to talk about in this post. But you can find a lot of stuff about the ASP.NET MVC Framework Preview 2 in <a href="http://www.hanselman.com/blog/">Scott Hanselman</a> Videos <a href="http://asp.net/mvc/">here</a>.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';">In my <a href="http://beckh0m.wordpress.com/2008/03/14/asp-net-mvc-jquery-magic/" target="_blank">previous post</a> I bloged about ASP.NET MVC &amp; JQuery,</span> I was calling an action method which takes as a parameter the name of the category (In the Northwind database) to get the products for that category.</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">Well, the thing is some of the categories name contains &#8220;/&#8221; which as you already know is used in the URL, so it didn&#8217;t work. I overcome this issue by using Query String to pass in the parameter to the action method like that:</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;color:blue;font-family:'Courier New';"> var</span><span style="font-size:10pt;font-family:'Courier New';"> url = <span style="color:#a31515;">&#8216;/Products/GetProducts?category=&#8217;</span>+ categoryName;</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">But now with the new <span style="font-size:10pt;font-family:'Courier New';">{*catchall}</span> route rule it can be done.</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';">routes.Add(<span style="color:blue;">new</span> <span style="color:#2b91af;">Route</span>( <span style="color:#a31515;">&#8220;Products/GetProducts/ {*category}&#8221;</span>,<span style="color:blue;">new</span> <span style="color:#2b91af;">MvcRouteHandler</span>())</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> {<br />
</span><span style="font-size:10pt;font-family:'Courier New';"> Defaults = <span style="color:blue;">new</span> <span style="color:#2b91af;">RouteValueDictionary</span> (<span style="color:blue;">new</span> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> {</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> controller = <span style="color:#a31515;">&#8220;Products&#8221;</span>,</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> action = <span style="color:#a31515;">&#8220;GetProducts&#8221;</span> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> }),</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> });</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">As you can see I used the {*category} not {*catchall} so catchall is not a keyword the * is the important part. But the important thing is whatever name you put after the {*} you must use the same name for the action method parameter.</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">For example, in the previous snippet I used:</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;color:#a31515;font-family:'Courier New';">&#8220;Products/GetProducts/{*category}</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">So in my Get Products action method I must pass in a category parameter like that:</p>
<p class="MsoNormal" style="direction:ltr;text-indent:18pt;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;color:blue;font-family:'Courier New';"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:18pt;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr"><span style="font-size:10pt;color:blue;font-family:'Courier New';"> public</span><span style="font-size:10pt;font-family:'Courier New';"> <span style="color:blue;">void</span> GetProducts(<span style="color:blue;">string</span> category)</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr"><span style="font-size:10pt;font-family:'Courier New';"> {</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">}</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">The full source is attached.</p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">P.S: To convert an MVC Application from Preview 1 to Preview 2 there is a lot of stuff and I mean &#8220;a lot&#8221; that you will have to change to get your application up and running and most of the changes will not be in your code. So if your application is a small one my advice is that create  a new application and just copy &amp; paste your code in to it and now the changes that you will have to make is in your code <span style="font-family:Wingdings;">J</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-family:Times New Roman;">But if your application big and hard to just copy &amp; paste just follow the steps the release notes <a href="http://www.asp.net/downloads/3.5-extensions/readme/Preview2.aspx">here</a>.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><strong><span style="font-family:Times New Roman;">Beckham</span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-family:Times New Roman;"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;" dir="ltr">
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/beckh0m.wordpress.com/9/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/beckh0m.wordpress.com/9/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/beckh0m.wordpress.com/9/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/beckh0m.wordpress.com/9/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/beckh0m.wordpress.com/9/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=9&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beckh0m.wordpress.com/2008/03/15/9/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f1cb642e3bf0857c937c48cab52bcd3d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beckh0m</media:title>
		</media:content>
	</item>
		<item>
		<title>ASP.Net MVC &amp; JQuery Magic</title>
		<link>http://beckh0m.wordpress.com/2008/03/14/asp-net-mvc-jquery-magic/</link>
		<comments>http://beckh0m.wordpress.com/2008/03/14/asp-net-mvc-jquery-magic/#comments</comments>
		<pubDate>Fri, 14 Mar 2008 08:36:38 +0000</pubDate>
		<dc:creator>beckh0m</dc:creator>
				<category><![CDATA[ASP.Net MVC]]></category>
		<category><![CDATA[Java Script]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Tips & Tricks]]></category>
		<category><![CDATA[MVC jQuery ASP.NETMVC]]></category>

		<guid isPermaLink="false">http://beckh0m.wordpress.com/?p=4</guid>
		<description><![CDATA[A simple jQuery way to simulate update panel in ASP.NET MVC CTP1<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=4&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;">Before we talk about JQuery and ASP.Net MVC let&#8217;s take an overview about both of them.</span><strong><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Here we go,</span></strong><strong><span style="font-size:11pt;"> </span></strong></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><strong><span style="font-family:'Comic Sans MS';">1-</span></strong><strong><span style="font-family:'Comic Sans MS';"> </span></strong><strong><span style="font-family:'Comic Sans MS';">What is MVC Framework? </span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;"> Model View Controller Model is a design pattern that allows separation of concerns. As the framework consists of 3 components:</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><img title="MVC" src="http://img265.imageshack.us/img265/6352/mvcyg8.jpg" alt="MVC" height="173" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;">
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">a.</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Model:</span></strong><span style="font-size:11pt;"> .is the component responsible for maintaining data.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">b.</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">View:</span></strong><span style="font-size:11pt;"> is the component responsible for displaying the user interface.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 72pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">c.</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Controller</span></strong><span style="font-size:11pt;font-family:'Comic Sans MS';">: is the component responsible for handling all the user interaction and all the manipulation of the model and passing the data to the view to display it.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><strong><span style="font-size:11pt;">For more information there is a lot of resources out </span></strong><strong><span style="font-size:11pt;"><a href="http://www.google.com/search?hl=en&amp;q=model%20view%20controller">there</a><a href="http://www.google.com/search?hl=en&amp;q=model%20view%20controller"></a></span></strong><strong><span style="font-family:'Comic Sans MS';">.</span></strong><strong><span style="font-size:11pt;"> </span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;"><strong> </strong></span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;"><strong> </strong></span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-family:'Comic Sans MS';"><span style="font-size:small;"><strong>2-      What is ASP.Net MVC? </strong></span></span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;"> ASP.Net now supports the MVC Framework, as part of the CTP Preview </span><span style="font-size:11pt;">of an &#8220;ASP.NET 3.5 Extensions&#8221;</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> for more information about what&#8217;s in that extension refer to  <a href="http://weblogs.asp.net/scottgu/archive/2007/12/09/asp-net-3-5-extensions-ctp-preview-released.aspx">Scott Gu&#8217;s blog</a> .</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> In ASP.Net MVC the controller handles all the interaction with user collects the information and manipulates the model data and then renders the appropriate view. So it allows a great deal of separation of concerns and it makes it a lot easier to test your application without even building the user interface. And it also gives you the control over the URL in a neat way.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">For more information about ASP.Net MVC <a href="http://weblogs.asp.net/scottgu/default.aspx">Scott Gu</a> has made a pretty cool series of tutorial in his blog, Check it out </span><span style="font-size:11pt;font-family:'Comic Sans MS';"><a href="http://weblogs.asp.net/scottgu/archive/2008/02/12/asp-net-mvc-framework-road-map-update.aspx">here</a></span><span style="font-size:11pt;font-family:'Comic Sans MS';">.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-family:'Comic Sans MS';"><strong><span style="font-size:small;">3-      What is JQuery? </span></strong></span></p>
<p><span style="font-size:11pt;">jQuery is an amazing JavaScript library that makes it easy to create wonderful web effects in just a few lines of code. As the website says:”</span></p>
<p><span style="font-size:11pt;">“jQuery is a JavaScript library that takes this motto to heart: Writing JavaScript code should be fun. jQuery achieves this goal by taking common, repetitive, tasks, stripping out all the unnecessary markup, and leaving them short, smart and understandable.” </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:small;"><strong>4- How JQuery works with Asp.net MVC???<br />
</strong></span> Okay, as you already know there is no post back in ASP.Net MVC. And so there is no server controls J What about ASP.NET AJAX UpdatePanels? <a href="http://weblogs.asp.net/scottgu/default.aspx">Scott Gu</a> mentions this in his comments:<br />
UpdatePanel does use post back, so you won&#8217;t use that control directly within a MVC based view.  But there will be a control (and optional helper method) with capabilities very similar to it.  It will invoke an action on a controller and allow you to incrementally update a portion of HTML really easily.  It will enable you to use the ASP.NET AJAX libraries really easily.<span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">Well why don&#8217;t we try to do that with Jquery and ASP.Net MVC .,</span><span style="font-size:11pt;"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">Okay lets start by downloading</span><span style="font-size:11pt;font-family:'Comic Sans MS';"><a href="http://asp.net/downloads/3.5-extensions/"> CTP Preview </a></span><a href="http://asp.net/downloads/3.5-extensions/">of an &#8220;ASP.NET 3.5 Extensions&#8221;</a><br />
And the latest<span style="font-size:11pt;font-family:'Comic Sans MS';"><a href="http://jquery.com/"> JQuery</a></span><span style="font-size:11pt;font-family:'Comic Sans MS';">, In this tutorial I&#8217;ll be using the northwind database you can download it from <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=06616212-0356-46A0-8DA2-EEBC53A68034&amp;displaylang=en">here</a>, Now let&#8217;s try to create an update panel with jquery.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"><strong>Okay so here is what we want to do:</strong></span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1- List all the categories in the categories table.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2- When we click on any category we want to go to the server and bring back all the products inside that category without post back ofcourse.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">So let&#8217;s see how we can do that,</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1- After you installed the CTP Preview, Create a new project and you will have a new project type called &#8220;ASP.NET MVC Web Application&#8221; Choose it and name the project &#8220;MVCJQueryMagic&#8221;.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;">
<p><img style="width:600px;height:600px;" title="MVC Project" src="http://img139.imageshack.us/img139/4713/mvcprojectes4.jpg" alt="MVC Project" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2- Now let&#8217;s add our model, Right Click the model folder and add a new item and choose &#8220;Linq To SQL&#8221;, and then we will use the server explorer and drag the categories &amp; Products tables and the ORM designer will infer the relations between the tables. And name it &#8220;Northwind.dbml&#8221;.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img style="width:600px;height:600px;" title="New Item - Linq2Sql" src="http://img265.imageshack.us/img265/5540/newitemlinq2sqlwk6.jpg" alt="MVC" /></p>
<p><img style="width:500px;height:500px;" title="ORM" src="http://img265.imageshack.us/img265/305/ormci8.jpg" alt="MVC" /></p>
<p><!-- CENTER--></p>
<p><span style="font-size:11pt;font-family:'Comic Sans MS';">3</span><span style="font-size:11pt;font-family:'Comic Sans MS';">- Now after creating our model as we all know our controller is the only thing that is allowed to manipulate the model&#8217;s data and it&#8217;s good practice and recommended that you keep your controller code short, So now we will create some helper methods in our &#8220;DataContext&#8221; that was created by our ORM Designer that will help us in both keeping our controller code short and in retrieving data from our model.</span> <span style="font-size:11pt;font-family:'Comic Sans MS';"><br />
a- First create a partial class and name it &#8220;NorthwindDataContext&#8221;:</span></p>
<p><img title="PartialDataContextClass" src="http://img139.imageshack.us/img139/9900/partialdatacontextclasshe5.jpg" alt="MVC" /></p>
<p><span style="font-size:11pt;font-family:'Comic Sans MS';">b- We will create two methods the first one to get all the categories from the categories table.</span><br />
<span style="font-size:11pt;font-family:'Comic Sans MS';">The second one will take a category id as a parameter and return a list of products for that category.</span><br />
<span style="font-size:11pt;font-family:'Comic Sans MS';">In this code I use LINQ to retrieve a list of categories in the &#8220;GetCategories&#8221; method and used lambda expressions in the &#8220;GetProducts&#8221; method to get a list of products for a specific category.</span><br />
<span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><br />
<span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><br />
<img title="PartialDataContextClass" src="http://img265.imageshack.us/img265/1457/partialdatacontextclasstc8.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">In this code I use LINQ to retrieve a list of categories in the &#8220;GetCategories&#8221; method and used lambda expressions in the &#8220;GetProducts&#8221; method to get a list of products for a specific category.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">At this point we are done with our model. Let&#8217;s move on to the controller.</span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1- Right Click On the controller folder and add a new item and choose &#8220;MVC Controller&#8221; and name it &#8220;ProductsController&#8221;.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="controller" src="http://img404.imageshack.us/img404/2706/controllerhirarchykp8.jpg" alt="MVC " /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2- In our case we will have two action methods the first one is to handles the requests asking for the categories, and the second one is to handle our AJAX request to get all products for a specific category.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img404.imageshack.us/img404/2972/productscontrollerui0.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">In the previous screen</span></strong><span style="font-size:11pt;font-family:'Comic Sans MS';">:<br />
All I do here is using our helper methods to get the data required to call our Renderview Method. I also created a class named &#8220;ProductsViewData&#8221; to send the list of products along with the category&#8217;s name. For more information about passing view data to views refer to <a href="http://weblogs.asp.net/scottgu/default.aspx">Scott Gu&#8217;s</a> Blog <a href="http://weblogs.asp.net/scottgu/archive/2007/12/06/asp-net-mvc-framework-part-3-passing-viewdata-from-controllers-to-views.aspx">here</a>.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;">
<p><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Now, Our UI is ready to be created, let&#8217;s dig in. </span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">If you looked at the controller class you will see that we need to create two views but again if you remember at first we said that what we are going to do is a page with a list of categories and once you click any category all the products inside that category will appear in the same page &#8221; AJAX Call &#8220;, That&#8217;s a little bit confusing, Isn&#8217;t it?!!!!</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">Well nooooo, it&#8217;s not. Here is what&#8217;s going to happen:</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 39pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">Our Ajax call will call an action method &#8220;GetProducts&#8221; asking it to get all the products for the category specified by the id. </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 39pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">The &#8220;GetProducts&#8221; Action method will get the products data and pass it to the view responsible for rendering these data.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 39pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">3-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';"> Then it passes the rendered page back as a response for our Ajax call.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 39pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">4-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">We then take this page and by using JQuery we can attach it to our Category List Page.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 21pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">So if you think about it the second view is considered <strong>a partial view</strong>.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;">
<p><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Now let&#8217;s create our views:</span></strong></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">Let&#8217;s create our &#8220;Products&#8221; Folder inside our Views Folder (That&#8217;s the default place which the mvc framework will be looking for the views in the products controller).</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img139.imageshack.us/img139/3735/productsfoldersc8.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">Let&#8217;s add our partial view, Right Click on the &#8220;Products&#8221; folder that we just created and add new item and choose &#8220;MVC View Page&#8221; and name it &#8220;Partial_Products&#8221;.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img265.imageshack.us/img265/7277/partialproductscreatefh4.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">3-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">Remove everything from the page and leave the page tag only because as we mentioned this is a partial view page all it does is rendering the products list.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">4-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">Add this code to the page.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img404.imageshack.us/img404/3114/partialproductscodezq5.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">This code first writes the Category name as a title and then creates an unordered list with the products for that category.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">Now lets move on to the fun part, creating the view which will contain our Ajax call.</span></strong></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><span style="font-size:11pt;font-family:'Comic Sans MS';">1-  Let&#8217;s add our view, Right Click on the &#8220;Products&#8221; folder that we just created and add new item and choose &#8220;MVC View Content Page&#8221; just use our master page (you can create a &#8220;MVC View Page &#8221; without using the master page it&#8217;s up to you)and name it &#8220;CategoriesView&#8221;.</span></p>
<p><img title="PartialDataContextClass" src="http://img139.imageshack.us/img139/3848/categoriesviewcreategt5.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2- Let&#8217;s create the code to render our list of categories as links which when clicked will invoke a java script function.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img260.imageshack.us/img260/1653/categoriesviewcodera4.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">At the bottom in the previous screen:</span></strong><span style="font-size:11pt;font-family:'Comic Sans MS';"><br />
we&#8217;ve created an empty div and set its display to none to be invisible, we will be using this div to show our products retrieved from the Ajax call.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">3- Now let&#8217;s write our java script function which will make the ajax call to the server to get our products back and make sure you have included the jQuery Library.</span></p>
<p><img title="PartialDataContextClass" src="http://img139.imageshack.us/img139/9559/ajaxcallbackmethodqs3.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">In the above screen: </span></strong></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">We created a function with the same name that we call from our links.</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;color:blue;font-family:'Comic Sans MS';">var</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> productsContainer = $(<span style="color:#a31515;">&#8220;#divProducts&#8221;</span>);<br />
we get a refrence to our div we created earlier using<br />
JQuery Syntax ( $ -&gt; is shortcut for &#8220;jQuery&#8221; and # is used to select element by id).</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">3-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;color:blue;font-family:'Comic Sans MS';">var</span><span style="font-size:11pt;font-family:'Comic Sans MS';"> url = <span style="color:#a31515;">&#8216;/Products/GetProducts?category=&#8217;</span>+ categoryName;</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">Here I compose the url to which we are going to make our ajax call to get our products.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;color:blue;font-family:'Comic Sans MS';"> 4- </span><span style="font-size:11pt;font-family:'Comic Sans MS';">$.<span style="color:blue;">get</span>(url,<span style="color:blue;">function</span>(data)</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> { </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"><br />
productsContainer.fadeIn(<span style="color:#a31515;">&#8216;slow&#8217;</span>);</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> productsContainer.html(data);</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> })</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:18pt;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;color:blue;font-family:'Comic Sans MS';"> </span><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> The ($.get ) JQuery syntax is used to make a jax call to the server and as you can see it takes to parameter </span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">1-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">The url that it&#8217;s going to make the call to</span></p>
<p class="MsoNormal" style="direction:ltr;text-indent:-18pt;unicode-bidi:embed;text-align:left;margin:0 0 0 36pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">2-<span style="font-family:'Times New Roman';font-style:normal;font-variant:normal;font-weight:normal;font-size:7pt;line-height:normal;"> </span></span><span style="font-size:11pt;font-family:'Comic Sans MS';">The function to pass the data returned from the call.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">In the function we show the div (the fadIn() function does a littel fad in animation just to give a good look) and set the inner html of our empty div to display the returned data from the server.<br />
.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><strong><span style="font-size:11pt;font-family:'Comic Sans MS';">For our final step</span></strong><span style="font-size:11pt;font-family:'Comic Sans MS';"> to let the mvc framework where to go when our generated url is requested we need to define A Route in the &#8220;Global.asax&#8221; File.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p><img title="PartialDataContextClass" src="http://img139.imageshack.us/img139/4137/routefc9.jpg" alt="MVC" /></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">Well that&#8217;s it we have our update panel up and  working. You can download the source code from attachment.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';">P.S: an updated version with MVC Preview 2 available<a href="http://beckh0m.wordpress.com/2008/03/15/9/" target="_blank"> here</a>.</span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> </span></p>
<p class="MsoNormal" style="direction:ltr;unicode-bidi:embed;text-align:left;margin:0 0 0 18pt;"><span style="font-size:11pt;font-family:'Comic Sans MS';"> <span style="font-size:11pt;font-family:'Comic Sans MS';"><strong>Beckham</strong></span></span></p>
<br /><img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/beckh0m.wordpress.com/4/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/beckh0m.wordpress.com/4/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/beckh0m.wordpress.com/4/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/beckh0m.wordpress.com/4/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/beckh0m.wordpress.com/4/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=beckh0m.wordpress.com&#038;blog=11025696&#038;post=4&#038;subd=beckh0m&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://beckh0m.wordpress.com/2008/03/14/asp-net-mvc-jquery-magic/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f1cb642e3bf0857c937c48cab52bcd3d?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">beckh0m</media:title>
		</media:content>

		<media:content url="http://img265.imageshack.us/img265/6352/mvcyg8.jpg" medium="image">
			<media:title type="html">MVC</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/4713/mvcprojectes4.jpg" medium="image">
			<media:title type="html">MVC Project</media:title>
		</media:content>

		<media:content url="http://img265.imageshack.us/img265/5540/newitemlinq2sqlwk6.jpg" medium="image">
			<media:title type="html">New Item - Linq2Sql</media:title>
		</media:content>

		<media:content url="http://img265.imageshack.us/img265/305/ormci8.jpg" medium="image">
			<media:title type="html">ORM</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/9900/partialdatacontextclasshe5.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img265.imageshack.us/img265/1457/partialdatacontextclasstc8.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img404.imageshack.us/img404/2706/controllerhirarchykp8.jpg" medium="image">
			<media:title type="html">controller</media:title>
		</media:content>

		<media:content url="http://img404.imageshack.us/img404/2972/productscontrollerui0.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/3735/productsfoldersc8.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img265.imageshack.us/img265/7277/partialproductscreatefh4.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img404.imageshack.us/img404/3114/partialproductscodezq5.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/3848/categoriesviewcreategt5.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img260.imageshack.us/img260/1653/categoriesviewcodera4.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/9559/ajaxcallbackmethodqs3.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>

		<media:content url="http://img139.imageshack.us/img139/4137/routefc9.jpg" medium="image">
			<media:title type="html">PartialDataContextClass</media:title>
		</media:content>
	</item>
	</channel>
</rss>
