<?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/"
	>

<channel>
	<title>Shawson&#039;s Code Blog &#187; jQuery</title>
	<atom:link href="http://codeblog.shawson.co.uk/category/jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://codeblog.shawson.co.uk</link>
	<description>development notes for my failing memory</description>
	<lastBuildDate>Wed, 01 Feb 2012 11:00:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Quick &amp; Tiny jQuery Drop Down Menus</title>
		<link>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/</link>
		<comments>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/#comments</comments>
		<pubDate>Tue, 24 Jan 2012 12:25:16 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1311</guid>
		<description><![CDATA[The Code: $(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs! $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () { $(this).hide(); }); $(&#039;.drop-down-menu&#62;li&#62;a&#039;).mouseenter(function () { $(&#039;ul&#039;, $(this).parent().parent()).hide(); $(&#039;ul&#039;, $(this).parent()).show(); }).mouseleave(function (o) { if ($(this).parent().has($(o.relatedTarget)).length &#60; 1) { $(&#039;ul&#039;, $(this).parent()).hide(); } }); }); The Markup: &#60;ul class=&#34;drop-down-menu&#34;&#62; &#60;li&#62;Available Actions : &#60;/li&#62; &#60;li&#62;&#60;a href=&#34;&#34;&#62;Menu 1&#60;/a&#62; &#60;ul&#62; &#60;li&#62;&#60;a href=&#34;a.htm&#34;&#62;a&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;b.htm&#34;&#62;b&#60;/a&#62;&#60;/li&#62; &#60;li&#62;&#60;a href=&#34;c.htm&#34;&#62;c&#60;/a&#62;&#60;/li&#62; [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/processingjs-box2d-physics/' rel='bookmark' title='Processingjs &amp; Box2d Physics!'>Processingjs &#038; Box2d Physics!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>The Code:</p>
<pre class="brush: javascript">
$(document).ready(function () { // Shawsons&#039; Teeny-Tiny Drop Downs!
    $(&#039;.drop-down-menu li ul&#039;).hide().mouseleave(function () {
        $(this).hide();
    });
    $(&#039;.drop-down-menu&gt;li&gt;a&#039;).mouseenter(function () {
        $(&#039;ul&#039;, $(this).parent().parent()).hide();
        $(&#039;ul&#039;, $(this).parent()).show();
    }).mouseleave(function (o) {
        if ($(this).parent().has($(o.relatedTarget)).length &lt; 1) {
            $(&#039;ul&#039;, $(this).parent()).hide();
        }
    });
});
</pre>
<p>The Markup:</p>
<pre class="brush: html">
&lt;ul class=&quot;drop-down-menu&quot;&gt;
        &lt;li&gt;Available Actions : &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 1&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;a.htm&quot;&gt;a&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;b.htm&quot;&gt;b&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;c.htm&quot;&gt;c&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li&gt;&lt;a href=&quot;&quot;&gt;Menu 2&lt;/a&gt;
            &lt;ul&gt;
                &lt;li&gt;&lt;a href=&quot;d.htm&quot;&gt;d&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;e.htm&quot;&gt;e&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href=&quot;f.htm&quot;&gt;f&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
        &lt;/li&gt;
    &lt;/ul&gt;
</pre>
<p>Some CSS:</p>
<pre class="brush: css">
.drop-down-menu { display:block; }
.drop-down-menu li { float:left; padding: 8px; }
.drop-down-menu li a { padding:8px; }
.drop-down-menu li ul
{
    position:absolute;
    background-color:#fff;
    border: 1px solid #999;
    border-radius: 0px 7px 7px 7px; -moz-border-radius:0px 7px 7px 7px; -webkit-border-radius:0px 7px 7px 7px;
    padding:5px;
}
.drop-down-menu li ul li { float:none; }
.drop-down-menu li ul li a { color:#000; }
.drop-down-menu li ul li:hover { background-color:#F68833; }
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/oo-inheritance-with-javascript/' rel='bookmark' title='OO &amp; Inheritance with Javascript'>OO &#038; Inheritance with Javascript</a></li>
<li><a href='http://codeblog.shawson.co.uk/processingjs-box2d-physics/' rel='bookmark' title='Processingjs &amp; Box2d Physics!'>Processingjs &#038; Box2d Physics!</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/quick-tiny-jquery-drop-down-menus/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jqZoomage jQuery component</title>
		<link>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/</link>
		<comments>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 20:40:34 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=1210</guid>
		<description><![CDATA[I&#8217;ve built a simple jQuery plugin for use on a website I&#8217;m building and am in the process of submitting it to the jQuery plugins website. It&#8217;s a simple zoom panel, allowing your users to mouse over portions of your small image, to see a close up view. Ideal for use on product details page [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve built a simple jQuery plugin for use on a website I&#8217;m building and am in the process of submitting it to the jQuery plugins website.  It&#8217;s a simple zoom panel, allowing your users to mouse over portions of your small image, to see a close up view.  Ideal for use on product details page or similar.</p>
<h3>Screenshot</h3>
<p><a href="http://codeblog.shawson.co.uk/jqzoomage-jquery-component/jqzoomagedemo/" rel="attachment wp-att-1213"><img src="http://codeblog.shawson.co.uk/wp-content/uploads/2011/09/jqZoomageDemo.png" alt="" title="jqZoomageDemo" width="600" class="aligncenter size-full wp-image-1213" /></a></p>
<h3>Installation</h3>
<p>Just add a reference to the script at the bottom of your page (where all your js should be anyway!)- as shown in the demo, this is a basic example;</p>
<pre class="brush: javascript">
$(window).ready(function() {
	$(&quot;#dinky-img&quot;).zoomage({
		zoomedImageContainer: &quot;#big-img&quot;,
		zoomedImageUrl: &quot;big-image.gif&quot;,
		stayActiveOnMouseOut: false,
		zoomedImageStartsCentered: true
	});
});
</pre>
<p>There are a couple of styles which are required for the view finder, and the mask which goes over the image (allowing you to customise the look)- add these rules to your style sheet somewhere;</p>
<pre class="brush: css">
#zoomage-view-finder { border: 1px solid #fff; }
.zoomage-view-finder-surround { background-color:#fff; opacity:0.7; }
</pre>
<p>As a general point, it&#8217;s best to run the script in a $(window).load() rather than the standard $(document).load(), as this ensures that all the images are loaded before the script begins, otherwise the script runs and grabs the width() and height() of the image to work out ratios, but these get returned as 0&#8242;s!  More info on this can be found on the <a href="http://stackoverflow.com/questions/544993/official-way-to-ask-jquery-wait-for-all-images-to-load-before-executing-something" target="_blank">stack overflow issue about this</a></p>
<h3>Configuration</h3>
<p><strong>zoomedImageContainer</strong> * Required *<br />
Default Value : &#8220;#zoom-image-container&#8221;<br />
This is the jQuery selector for the div which will act as the close up view for your image.</p>
<p><strong>zoomedImageUrl</strong> * Required *<br />
Default Value : &#8220;&#8221;<br />
This is the URL of the zoomed image file.  I generally use images 3 times larger than the original, however there isn&#8217;t a limit.  The scale ratio is calculated on load.</p>
<p><strong>stayActiveOnMouseOut</strong><br />
Default Value : false<br />
If this is set to true, the view finder will continue to show in it&#8217;s last position even when the mouse pointer is moved off of the image.  If false, the view finder will disappear on mouse out.</p>
<p><strong>zoomedImageStartsCentered</strong><br />
Default Value : true<br />
Indicates that, on load, the zoomed image view shows the center of the image.</p>
<p><strong>centerOnMouseOut</strong><br />
Default Value : true<br />
If true, on mouse out, the zoomed view will return to the center of the zoomed image.</p>
<h3>Live Demo</h3>
<p><a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/demo.htm" title="jqZoomage demo page" target="_blank">You can check out a real life working version of it here!</a></p>
<p>Tested across all the major modern browsers (IE9/ FF4/ Chrome10)- give me a shout if you spot an issue.</p>
<h3>Download</h3>
<p>Current Version 1.2 &#8211; 2011-09-10<br />
<a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/jquery.zoomage-1.2.js" title="jqZoomage demo page" target="_blank">Unminified Development Version</a><br />
<a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/jquery.zoomage-1.2.min.js" title="jqZoomage demo page" target="_blank">Minified Production Version</a></p>
<h3>Licence</h3>
<p>This plugin is available for use under the MIT licence.  For more info see <a href="http://codeblog.shawson.co.uk/storage/jquery.zoomage/licence.txt">http://codeblog.shawson.co.uk/storage/jquery.zoomage/licence.txt</a></p>
<h3>jQuery Plugin Site Link</h3>
<p>The official jQuery Plugin catalogue link for this plugin is <a href="http://plugins.jquery.com/project/jqZoomage">http://plugins.jquery.com/project/jqZoomage</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-build-step-to-minify-and-obfuscate-your-sites-javascript-and-css/' rel='bookmark' title='Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor'>Adding minification and obfuscation of your Javascript and CSS to your ASP.net build process using Yahoo YUI Compressor</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/jqzoomage-jquery-component/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Random Band Generator!</title>
		<link>http://codeblog.shawson.co.uk/random-band-generator/</link>
		<comments>http://codeblog.shawson.co.uk/random-band-generator/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 10:13:25 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[C#.net]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://codeblog.shawson.co.uk/?p=946</guid>
		<description><![CDATA[Just a quick post to mention that I&#8217;ve uploaded the Random Band Generator- just a bit of fun I boshed together built for a mate&#8230; check it out here. Related posts:Classic ASP SQL Injection vulnerability analyser Machine Key Generator More Manic Spaceman (8weekgame) documentation done


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/classic-asp-sql-injection-vulnerability-analyser/' rel='bookmark' title='Classic ASP SQL Injection vulnerability analyser'>Classic ASP SQL Injection vulnerability analyser</a></li>
<li><a href='http://codeblog.shawson.co.uk/machine-key-generator/' rel='bookmark' title='Machine Key Generator'>Machine Key Generator</a></li>
<li><a href='http://codeblog.shawson.co.uk/more-manic-spaceman-8weekgame-documentation-done/' rel='bookmark' title='More Manic Spaceman (8weekgame) documentation done'>More Manic Spaceman (8weekgame) documentation done</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Just a quick post to mention that I&#8217;ve uploaded the Random Band Generator- just a bit of fun I boshed together built for a mate&#8230; <a href="http://randomband.shawson.co.uk/">check it out here</a>.</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/classic-asp-sql-injection-vulnerability-analyser/' rel='bookmark' title='Classic ASP SQL Injection vulnerability analyser'>Classic ASP SQL Injection vulnerability analyser</a></li>
<li><a href='http://codeblog.shawson.co.uk/machine-key-generator/' rel='bookmark' title='Machine Key Generator'>Machine Key Generator</a></li>
<li><a href='http://codeblog.shawson.co.uk/more-manic-spaceman-8weekgame-documentation-done/' rel='bookmark' title='More Manic Spaceman (8weekgame) documentation done'>More Manic Spaceman (8weekgame) documentation done</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/random-band-generator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More Manic Spaceman (8weekgame) documentation done</title>
		<link>http://codeblog.shawson.co.uk/more-manic-spaceman-8weekgame-documentation-done/</link>
		<comments>http://codeblog.shawson.co.uk/more-manic-spaceman-8weekgame-documentation-done/#comments</comments>
		<pubDate>Wed, 19 Jan 2011 13:21:49 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=924</guid>
		<description><![CDATA[I promised I would, and I&#8217;m finally getting round to documenting the rest of the classes I wrote for my javascript platformer I built for the 8weekgame competition, as well as putting up the sourcecode. There&#8217;s still a few more to do, which I shall bash out through the course of the rest of the [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/8weekgame-i-won/' rel='bookmark' title='8WeekGame &#8211; I Won!'>8WeekGame &#8211; I Won!</a></li>
<li><a href='http://codeblog.shawson.co.uk/8weekgame-competition-over-vote-now/' rel='bookmark' title='8WeekGame Competition Over &#8211; Vote Now!'>8WeekGame Competition Over &#8211; Vote Now!</a></li>
<li><a href='http://codeblog.shawson.co.uk/couple-of-interesting-news-items-today/' rel='bookmark' title='Couple of interesting news items today'>Couple of interesting news items today</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I promised I would, and I&#8217;m finally getting round to documenting the rest of the classes I wrote for my javascript platformer I built for the 8weekgame competition, as well as putting up the sourcecode.  There&#8217;s still a few more to do, which I shall bash out through the course of the rest of the week.  Check them out at <a href="8-week-game-competition/">www.shawson.co.uk/codeblog/8-week-game-competition/</a></p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/8weekgame-i-won/' rel='bookmark' title='8WeekGame &#8211; I Won!'>8WeekGame &#8211; I Won!</a></li>
<li><a href='http://codeblog.shawson.co.uk/8weekgame-competition-over-vote-now/' rel='bookmark' title='8WeekGame Competition Over &#8211; Vote Now!'>8WeekGame Competition Over &#8211; Vote Now!</a></li>
<li><a href='http://codeblog.shawson.co.uk/couple-of-interesting-news-items-today/' rel='bookmark' title='Couple of interesting news items today'>Couple of interesting news items today</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/more-manic-spaceman-8weekgame-documentation-done/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>KnockoutJS/ jQuery tmpl with jQuery Validate</title>
		<link>http://codeblog.shawson.co.uk/knockoutjs-jquery-tmpl-with-jquery-validate/</link>
		<comments>http://codeblog.shawson.co.uk/knockoutjs-jquery-tmpl-with-jquery-validate/#comments</comments>
		<pubDate>Sun, 16 Jan 2011 22:45:24 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[KnockoutJS]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=909</guid>
		<description><![CDATA[Quick post; I found tonight that my jquery validate was letting my knockoutjs viewModel.save() method run, even if the form wasn&#8217;t valid. This turned out to be because you need to set &#8220;uniqueName: true&#8221; on any form fields you want validated. Eg &#60;input data-bind=&#34;value: ChargedShipping, uniqueName: true&#34; class=&#34;required number&#34;/&#62; Related posts:KnockoutJS won&#8217;t bind to fields [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/knockoutjs-wont-bind-to-fields-with-numbers-at-the-end/' rel='bookmark' title='KnockoutJS won&#8217;t bind to fields with numbers at the end?'>KnockoutJS won&#8217;t bind to fields with numbers at the end?</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-validate-method-for-jqueryui-autocomplete-drop-down-boxes-while-using-knockoutjs/' rel='bookmark' title='JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS'>JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Quick post; I found tonight that my jquery validate was letting my knockoutjs viewModel.save() method run, even if the form wasn&#8217;t valid.  This turned out to be because you need to set &#8220;uniqueName: true&#8221; on any form fields you want validated.  Eg</p>
<pre class="brush: html">
&lt;input data-bind=&quot;value: ChargedShipping, uniqueName: true&quot; class=&quot;required number&quot;/&gt;
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/knockoutjs-wont-bind-to-fields-with-numbers-at-the-end/' rel='bookmark' title='KnockoutJS won&#8217;t bind to fields with numbers at the end?'>KnockoutJS won&#8217;t bind to fields with numbers at the end?</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-validate-method-for-jqueryui-autocomplete-drop-down-boxes-while-using-knockoutjs/' rel='bookmark' title='JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS'>JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/knockoutjs-jquery-tmpl-with-jquery-validate/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using JQueryUI combobox() with KnockoutJS</title>
		<link>http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/</link>
		<comments>http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 14:31:23 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[KnockoutJS]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=896</guid>
		<description><![CDATA[This is something I had a great deal of trouble with, but in the end the solution was simple. Basically when using the combobox() autocomplete drop down in jQueryUI (in prototype at time of writing) along side KnockoutJS I found changing your selection in the drop down list didn&#8217;t update the viewModel in knockout as [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/jquery-validate-method-for-jqueryui-autocomplete-drop-down-boxes-while-using-knockoutjs/' rel='bookmark' title='JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS'>JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqueryui/' rel='bookmark' title='JQueryUI'>JQueryUI</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>This is something I had a great deal of trouble with, but in the end the solution was simple.  Basically when using the <a href="http://jqueryui.com/demos/autocomplete/#combobox" target="_blank">combobox() autocomplete drop down in jQueryUI</a> (in prototype at time of writing) along side <a href="http://knockoutjs.com/" target="_blank">KnockoutJS</a> I found changing your selection in the drop down list didn&#8217;t update the viewModel in knockout as expected.  This is because knockoutjs attached itself to the change() event of the drop down, and jqueryUI wasn&#8217;t raising this event when it changed the drop down.  This is easily fixed by adding an event handler to thre jqueryUI combobox which forces the event to be called when the user selects a new option;</p>
<pre class="brush: javascript">
$(&quot;select&quot;).combobox({
            selected: function(event, ui) {
                $(ui.item.parentNode).change();
            }
        });
</pre>
<p>Thanks go out to the <a href="http://robertmarkbramprogrammer.blogspot.com/2010/09/event-handling-with-jquery-autocomplete.html" target="_blank">&#8220;Rob on programming&#8221; blog, which helped me get my head around what was going on in the events in combobox</a>.</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/jquery-validate-method-for-jqueryui-autocomplete-drop-down-boxes-while-using-knockoutjs/' rel='bookmark' title='JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS'>JQuery Validate() method for JQueryUI AutoComplete drop down boxes, while using KnockoutJS</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqueryui/' rel='bookmark' title='JQueryUI'>JQueryUI</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MVC with MVVM using Knockout.js</title>
		<link>http://codeblog.shawson.co.uk/mvc-with-mvvm-using-knockout-js/</link>
		<comments>http://codeblog.shawson.co.uk/mvc-with-mvvm-using-knockout-js/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 22:28:08 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[KnockoutJS]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=878</guid>
		<description><![CDATA[Previously, on Shawson.co.uk.. see &#8220;Creating an Order/ Order Details style view using ASP.net MVC2 &#38; Entity Framework 4&#8243; So following on from my last MVC post I posed my question to Scott Hanselman himself via email, and he took the time to write me a very helpful response; Interesting solution. Good job getting it working. [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/' rel='bookmark' title='Creating an Order/ Order Details style view using ASP.net MVC2 &amp; Entity Framework 4'>Creating an Order/ Order Details style view using ASP.net MVC2 &#038; Entity Framework 4</a></li>
<li><a href='http://codeblog.shawson.co.uk/knockoutjs-wont-bind-to-fields-with-numbers-at-the-end/' rel='bookmark' title='KnockoutJS won&#8217;t bind to fields with numbers at the end?'>KnockoutJS won&#8217;t bind to fields with numbers at the end?</a></li>
<li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Previously, on Shawson.co.uk..</p>
<p>see &#8220;<a title="Permanent Link: Creating an Order/ Order Details style view using ASP.net MVC2 &amp; Entity Framework 4" rel="bookmark" href="../creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/">Creating an Order/ Order Details style view using ASP.net MVC2 &amp; Entity Framework 4&#8243;</a></p>
<p>So following on from my last MVC post I posed my question to Scott Hanselman himself via email, and he took the time to write me a very helpful response;</p>
<blockquote>
<div>Interesting solution. Good job getting it working.</div>
<div>Take a look at maybe using some cleaner JS on the client&#8230;check out my last podcast on Knockout and check out this demo: <a href="http://knockoutjs.com/examples/contactsEditor.html" target="_blank">http://knockoutjs.com/examples/contactsEditor.html</a></div>
</blockquote>
<div>The <a href="http://www.hanselman.com/blog/HanselminutesPodcast243KnockoutJavaScriptWithSteveSanderson.aspx">pod cast he&#8217;s refering to is here</a>.  The contacts editor example he pointed me to is exactly what I&#8217;m trying to do here.  This implementation would totally resolve my issue as you are no longer binding directly to the entity framework objects- I could instead create simple cut down DTO&#8217;s for the sale and it&#8217;s associated sale lines and serialise it to JSON then use <a href="http://knockoutjs.com/">Knockout</a> (an open source javascript library which deals with clientside binding of UI elements to a data structure, like your ViewModel represented as JSON) to deal with all the client-side binding and editing before posting the data back as JSON.  I shall post again once I have something up and working.</div>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/' rel='bookmark' title='Creating an Order/ Order Details style view using ASP.net MVC2 &amp; Entity Framework 4'>Creating an Order/ Order Details style view using ASP.net MVC2 &#038; Entity Framework 4</a></li>
<li><a href='http://codeblog.shawson.co.uk/knockoutjs-wont-bind-to-fields-with-numbers-at-the-end/' rel='bookmark' title='KnockoutJS won&#8217;t bind to fields with numbers at the end?'>KnockoutJS won&#8217;t bind to fields with numbers at the end?</a></li>
<li><a href='http://codeblog.shawson.co.uk/using-jqueryui-combobox-with-knockoutjs/' rel='bookmark' title='Using JQueryUI combobox() with KnockoutJS'>Using JQueryUI combobox() with KnockoutJS</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/mvc-with-mvvm-using-knockout-js/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Creating an Order/ Order Details style view using ASP.net MVC2 &amp; Entity Framework 4</title>
		<link>http://codeblog.shawson.co.uk/creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/</link>
		<comments>http://codeblog.shawson.co.uk/creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 20:57:17 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=840</guid>
		<description><![CDATA[Before you start reading, beware!  I&#8217;m posting this because I&#8217;ve got a working solution, but I&#8217;m not convinced it&#8217;s the correct way to do this- I&#8217;m an MVC beginner myself so I&#8217;m hoping someone will post to either day &#8220;looks good&#8221; or say &#8220;this is ridiculous!&#8221; so don&#8217;t follow what i&#8217;ve written here as if [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/conditional-dataannotations-in-c/' rel='bookmark' title='Conditional DataAnnotations in c#'>Conditional DataAnnotations in c#</a></li>
<li><a href='http://codeblog.shawson.co.uk/mvc-strongly-typed-view-returns-a-null-model-on-post-back/' rel='bookmark' title='MVC strongly typed view returns a null model on post back'>MVC strongly typed view returns a null model on post back</a></li>
<li><a href='http://codeblog.shawson.co.uk/entity-framework-4-1-code-first-with-one-to-many-relationship-code-example/' rel='bookmark' title='Entity Framework 4.1 Code First (With One to Many relationship) Code Example'>Entity Framework 4.1 Code First (With One to Many relationship) Code Example</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>Before you start reading, beware!  I&#8217;m posting this because I&#8217;ve got a working solution, but I&#8217;m not convinced it&#8217;s the correct way to do this- I&#8217;m an MVC beginner myself so I&#8217;m hoping someone will post to either day &#8220;looks good&#8221; or say &#8220;this is ridiculous!&#8221; so don&#8217;t follow what i&#8217;ve written here as if it&#8217;s a tutorial!</p>
<p>I&#8217;ve just started my very first MVC2 project- it&#8217;s a pretty simple web based back office Warehouse/Order management system, tying into a frontend website.  I boshed out a whole bunch of simple list/edit screens for Parts/ Couriers/ Stock movements etc saving the Order entry form till last as I couldn;t immidiatly imagine how this would work.  What I wanted was the equivilant of an old school Access form with a sub form- like so;</p>
<p style="text-align: center;"><img class="size-full wp-image-841 aligncenter" title="edit_form" src="http://www.shawson.co.uk/codeblog/wp-content/uploads/2010/11/edit_form.jpg" alt="edit_form" width="614" height="626" /></p>
<p style="text-align: left;">(Obviously, once everything&#8217;s working I will substitute the crazy GUID fields for some kind of swanky jQuery lookup!)</p>
<p style="text-align: left;">I started MVC following through <a href="http://www.asp.net/mvc" target="_blank">Scott Hanselmans&#8217; tutorials over on the Microsoft MVC site</a> which shows building up a database, using Entity Framework 4 as an ORM, and extending those Model classes to set validation meta data- then building your simple controllers and a bunch of strongly typed views against these Entity Framework model classes (and some view models as required).</p>
<p style="text-align: left;">This all works fine when building one set of views per table- so I have a Parts database table, which I create a Parts controller for, then have a simple List, Create and Edit view which all works very well- the UpdateModel method happily updated my Model class from the form data on the strongly typed views.  It all becomes a little less clear though when you have a record which has a bunch of other associated records.  I need to not only Bind to a single records field, but also Bind to a List&lt;&gt; of associated records.</p>
<p style="text-align: left;">So I started googling and I found a bunch of links on google about binding to lists in MVC, including 3 quite pivotal ones all linked off of <a href="http://stackoverflow.com/questions/2900414/asp-net-mvc-2-mechanics-behind-an-order-order-line-in-a-edit-form">this StackOverFlow</a> article;</p>
<ul>
<li><a href="http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx">http://haacked.com/archive/2008/10/23/model-binding-to-a-list.aspx</a></li>
<li><a href="http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/">http://blog.stevensanderson.com/2010/01/28/editing-a-variable-length-list-aspnet-mvc-2-style/</a></li>
<li><a href="http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx">http://www.hanselman.com/blog/ASPNETWireFormatForModelBindingToArraysListsCollectionsDictionaries.aspx</a></li>
</ul>
<p>There&#8217;s also an additional article off the back of one of those articles;</p>
<ul>
<li><a href="http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/">http://blog.donnfelker.com/2010/02/27/editable-grid-list-binding-in-mvc2/</a></li>
</ul>
<p>These links are all great and give good working examples of Binding to an object with a property which is a List&lt;&gt; of another object&#8211; but none of these are tied to any kind of data persistance which seems contrary to most of the MVC tutorials which show how easily you can write your controllers and view straight against the EF objects.  I can understand that in a full blown enterprise system you&#8217;re not going to be tying yourself straight to the EF classes anyway and you&#8217;de probably have a ViewModel or some kind of DTO which you pass between your data layer and your controllers- but I wanted to see this done with the EF objects, as I don&#8217;t think its something which should be difficult.</p>
<p>So I tried following the various methods but using my Entity Framework objects and had a whole world of problems.  Using Donn felker&#8217;s method I recieved this error;</p>
<blockquote><p>&#8220;Templates can be used only with field access, property access,   single-dimension array index, or single-parameter custom indexer   expressions.&#8221;</p></blockquote>
<p>I think I did eventually get past this error, but then I was hit by the same erorr I got using Steve Sanderson&#8217;s original method which was</p>
<blockquote><p>&#8220;UpdateModel The EntityCollection has already been initialized. The InitializeRelatedCollection method should only be called to initialize a new EntityCollection during deserialization of an object graph&#8221;</p></blockquote>
<p>This caused a Model error and stopped the form going through &#8211; I read various forum posts about removing this error from the ModelState error stack, but the save still failed.  I also experienced a bunch of other problems with the html field&#8217;s not being given the correct ID&#8217;s to map back to the models when using the HtmlPrefixScopeExtensions class that was part of the solution in the above articles.  So I tried a whole bunch of variations of various articles I&#8217;d read and eventually gave up and decided to do something a bit different.</p>
<p><strong>My Approach</strong></p>
<p>In the model I have the entity model of my database, which gives me the Sale and SaleLine class- I create partial classes for these which hold the validation metadata.  I then created a ViewModel which will hold a single Sale and a List&lt;SaleLine&gt;, which are the lines which correspond to that sale.</p>
<p>If I bound the view straight to the Sale, then I would get SaleLines for free as a navigation item on the Sale class- i could dump the properties of the Sale to the form like normal, then just do a for loop going round Model.Salelines- when I post back then I have a single Sale object, with its attached records which can be automatically updated. But this seemed to be one of the issues I was having- when posting back, MVC was trying to rebuild my Sale object from the view data, which it did with no problems, but when it came to reattaching all the associated SaleLines, entity framework would start complaining that they already exist.  So splitting them out in the ViewModel breaks the SaleLines out of the EntityCollection and just creates a generic List of SaleLines which I can itterate through using an index and then process manually on the post back.</p>
<pre class="brush: c-sharp">
// Model Partial Classes

[MetadataType(typeof(SaleMetadata))]
public partial class Sale
{
public Sale() {
this.Id = Guid.NewGuid();
this.CreateDate = DateTime.Now;
}
class SaleMetadata
{
// TODO
}
}

[MetadataType(typeof(SaleLineMetadata))]
public partial class SaleLine
{
class SaleLineMetadata {
[Required(ErrorMessage = &quot;Please enter a quantity.&quot;)]
[Range(1,99999,ErrorMessage=&quot;Quantity must be at least 1!&quot;)]
public object Qty { get; set; }
}
}

// ViewModel

public class SaleViewModel
{
public Sale Sale { get; set; }
public List&lt;SaleLine&gt; SaleLines { get; set; }
}
</pre>
<p>On my SaleController&#8217;s Edit method, I setup the ViewModel and return it to the View.</p>
<pre class="brush: c-sharp">
public ActionResult Edit(Guid id)
{
SaleViewModel svm = new SaleViewModel()
{
Sale = db.Sales.Single(x =&gt; x.Id == id),
SaleLines = db.SaleLines.Where(x =&gt; x.SaleId == id).ToList()
};

return View(svm);
}
</pre>
<p>The View is a standard Edit view, with the for loop at the bottom to render out the Salelines;</p>
<pre class="brush: html">
&lt;fieldset&gt;&lt;legend&gt;Items&lt;/legend&gt;

&lt;table id=&quot;rows&quot;&gt;
&lt;tr&gt;
&lt;th&gt;Part Id&lt;/th&gt;
&lt;th&gt;Qty&lt;/th&gt;
&lt;th&gt;Sale Price&lt;/th&gt;
&lt;th&gt;&amp;nbsp;&lt;/th&gt;
&lt;/tr&gt;

&lt;% for (int i = 0; i &lt; Model.SaleLines.Count; i++ )
{ %&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;%: Html.HiddenFor(model =&gt; model.SaleLines[i].Id) %&gt;
&lt;%: Html.TextBoxFor(model =&gt; model.SaleLines[i].PartId)%&gt;
&lt;%: Html.ValidationMessageFor(model =&gt; model.SaleLines[i].PartId)%&gt;
&lt;/td&gt;

&lt;td&gt;
&lt;%: Html.TextBoxFor(model =&gt; model.SaleLines[i].Qty)%&gt;
&lt;%: Html.ValidationMessageFor(model =&gt; model.SaleLines[i].Qty)%&gt;
&lt;/td&gt;

&lt;td&gt;
&lt;%: Html.TextBoxFor(model =&gt; model.SaleLines[i].SalePrice)%&gt;
&lt;%: Html.ValidationMessageFor(model =&gt; model.SaleLines[i].SalePrice)%&gt;
&lt;/td&gt;

&lt;td&gt;
&lt;%= Html.ActionLink(&quot;Remove&quot;, &quot;DeleteRow&quot;, new { id = Model.SaleLines[i].Id }, new { Class = &quot;removeItem&quot; })%&gt;
&lt;/td&gt;

&lt;/tr&gt;
&lt;% } %&gt;

&lt;/table&gt;

&lt;a href=&quot;#&quot; id=&quot;addItem&quot;&gt;Add another...&lt;/a&gt;
</pre>
<p>To Handle the post back I can update the Sale as normal, then I grab a list of the SaleLines from the database, and itterate through them manually updating each one;</p>
<pre class="brush: c-sharp">
[HttpPost]
public ActionResult Edit(Guid id, SaleViewModel svm)
{
if (ModelState.IsValid)
{
Sale s = db.Sales.Single(x =&gt; x.Id == id);
UpdateModel(s, &quot;Sale&quot;);

List&lt;SaleLine&gt; db_lines = s.SaleLines.ToList();

for (int i = 0; i &lt; svm.SaleLines.Count; i++)
{
SaleLine form_line = svm.SaleLines[i];
SaleLine db_line = db_lines.FirstOrDefault(x =&gt; x.Id == form_line.Id);

if (db_line == null)
{
//create a new one
form_line.Id = Guid.NewGuid();
form_line.SaleId = id;
db.AddToSaleLines(form_line);
//db.SaveChanges();
}
else
{
UpdateModel(db_line, &quot;SaleLines[&quot; + i + &quot;]&quot;);
}
}

db.SaveChanges();

return RedirectToAction(&quot;Index&quot;);
}
else
{
return View(svm);
}
}
</pre>
<p>Adding an extra row, is all done entirly with jQuery&#8211; and this is one of the bits that doesn&#8217;t feel right.. I grabbed the html from an existing row, then modify it myself adjusting the ID&#8217;s so it&#8217;s a new row.  When the View gets posted back, MVC is clever enough to be able to pick up my new row along with the others, and I have some logic to check if this row has a corresponding row in the SaleLines list, and if not, to create a new one.</p>
<pre class="brush: javascript">
var current_count = &lt;%=Model.SaleLines.Count %&gt;;

$(&quot;#addItem&quot;).click(function () {
$(&quot;#rows&quot;).append(&#039;&lt;tr&gt;&lt;td&gt;&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;SaleLines[&#039; + current_count + &#039;].PartId&quot;&gt;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;SaleLines[&#039; + current_count + &#039;].Qty&quot; &gt;&lt;/td&gt;&lt;td&gt;&lt;input type=&quot;text&quot; value=&quot;&quot; name=&quot;SaleLines[&#039; + current_count + &#039;].SalePrice&quot;&gt;&lt;/td&gt;&lt;/tr&gt;&#039;);
current_count++;
return false;
});

$(&quot;a.removeItem&quot;).live(&quot;click&quot;, function () {
remove_row = $(this).parent().parent()
$.ajax({
url: this.href,
cache: false,
success: function(html) { $(remove_row).remove(); reNumber(); }
});
return false;
});

function reNumber() {
var i = -1;
$(&quot;#rows tr&quot;).each(function (element_id, element) {
$(&quot;input[id$=&#039;Id&#039;]&quot;, $(element)).attr(&#039;id&#039;, &#039;SaleLines_&#039; + i + &#039;__Id&#039;).attr(&#039;name&#039;, &#039;SaleLines[&#039; + i + &#039;].Id&#039;);
$(&quot;input[id$=&#039;PartId&#039;]&quot;, $(element)).attr(&#039;id&#039;, &#039;SaleLines_&#039; + i + &#039;__PartId&#039;).attr(&#039;name&#039;, &#039;SaleLines[&#039; + i + &#039;].PartId&#039;);
$(&quot;input[id$=&#039;Qty&#039;]&quot;, $(element)).attr(&#039;id&#039;, &#039;SaleLines_&#039; + i + &#039;__Qty&#039;).attr(&#039;name&#039;, &#039;SaleLines[&#039; + i + &#039;].Qty&#039;);
$(&quot;input[id$=&#039;SalePrice&#039;]&quot;, $(element)).attr(&#039;id&#039;, &#039;SaleLines_&#039; + i + &#039;__SalePrice&#039;).attr(&#039;name&#039;, &#039;SaleLines[&#039; + i + &#039;].SalePrice&#039;);

i++;
});
}
</pre>
<p>The above javascript also has a bit of code to remove rows- this calls a method on the controller (DeleteRow- see below) and then removes the table row from the html.</p>
<pre class="brush: javascript">
// AJAX GET : /Sales/DeleteRow/{RowId}
public bool DeleteRow(Guid id)
{
try
{
SaleLine line = db.SaleLines.Single(x =&gt; x.Id == id);
db.SaleLines.DeleteObject(line);
db.SaveChanges();
return true;
}
catch (Exception)
{
return false;
}
}
</pre>
<p>This broke the update method though as the indexes were no longer sequencial- the html which gets spat out by MVC puts an index number against each row, and putting gap in this numbering stops the full collectino of items being passed, so I have to renumber the remaining items (the reNumber function shown in the javascript listing above).  This feel&#8217;s like a total hack; I&#8217;ve read some articles about non-sequencial indexing, but I don&#8217;t have enough MVC XP&#8217;s to be able to apply this and the interweb is a bit thin on the ground for code examples which include the all important UpdateModel and persistance part of the code!</p>
<p>Anyway- comments would be appreciated!  Is this a completly mental way of doing things?  Have you read any other articles which implement differently?</p>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/conditional-dataannotations-in-c/' rel='bookmark' title='Conditional DataAnnotations in c#'>Conditional DataAnnotations in c#</a></li>
<li><a href='http://codeblog.shawson.co.uk/mvc-strongly-typed-view-returns-a-null-model-on-post-back/' rel='bookmark' title='MVC strongly typed view returns a null model on post back'>MVC strongly typed view returns a null model on post back</a></li>
<li><a href='http://codeblog.shawson.co.uk/entity-framework-4-1-code-first-with-one-to-many-relationship-code-example/' rel='bookmark' title='Entity Framework 4.1 Code First (With One to Many relationship) Code Example'>Entity Framework 4.1 Code First (With One to Many relationship) Code Example</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/creating-an-order-order-details-style-form-using-asp-net-mvc2-entity-framework/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>Grabbing mashed .net Control ID&#8217;s using jQuery</title>
		<link>http://codeblog.shawson.co.uk/grabbing-mashed-net-control-ids-using-jquery/</link>
		<comments>http://codeblog.shawson.co.uk/grabbing-mashed-net-control-ids-using-jquery/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 12:07:32 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[C#.net]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=837</guid>
		<description><![CDATA[I need to grab a bunch of controls from repeater items in .net &#8211; They are all prefixed with something like ctl00_Content_ctl00_rptLines_&#8230; and then the actual ID I set for the control- with dot net v4 you can set your own client Id&#8217;s so this isn&#8217;t a problem, but i&#8217;m using an older version. It&#8217;s [...]


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
<li><a href='http://codeblog.shawson.co.uk/globalization-using-aspnet/' rel='bookmark' title='Globalization &#8220;Current Culture&#8221; settings in the web.config (ASP.NET)'>Globalization &#8220;Current Culture&#8221; settings in the web.config (ASP.NET)</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>I need to grab a bunch of controls from repeater items in .net &#8211; They are all prefixed with something like ctl00_Content_ctl00_rptLines_&#8230; and then the actual ID I set for the control- with <a href="http://www.codeproject.com/KB/aspnet/ClientIdASPNET40.aspx">dot net v4 you can set your own client Id&#8217;s</a> so this isn&#8217;t a problem, but i&#8217;m using an older version.  It&#8217;s easy enough to do partial matches with jQuery;</p>
<pre class="brush: javascript">
$(&quot;span[id$=&#039;_txtName&#039;]&quot;) // match the section at the end

// you can also match text at the start, or in anywhere in the string using the following
$(&quot;span[id^=text]&quot;)
$(&quot;span[id*=text]&quot;)
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
<li><a href='http://codeblog.shawson.co.uk/globalization-using-aspnet/' rel='bookmark' title='Globalization &#8220;Current Culture&#8221; settings in the web.config (ASP.NET)'>Globalization &#8220;Current Culture&#8221; settings in the web.config (ASP.NET)</a></li>
<li><a href='http://codeblog.shawson.co.uk/jqzoomage-jquery-component/' rel='bookmark' title='jqZoomage jQuery component'>jqZoomage jQuery component</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/grabbing-mashed-net-control-ids-using-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ASP.net Jquery to fire on partial post back</title>
		<link>http://codeblog.shawson.co.uk/asp-net-jquery-to-fire-on-partial-post-back/</link>
		<comments>http://codeblog.shawson.co.uk/asp-net-jquery-to-fire-on-partial-post-back/#comments</comments>
		<pubDate>Wed, 10 Nov 2010 11:53:27 +0000</pubDate>
		<dc:creator>shawson</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.shawson.co.uk/codeblog/?p=834</guid>
		<description><![CDATA[use this; Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(){ // ... your code here! }); Related posts:URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) &#8211; ScottGu&#8217;s Blog ASP.net update panel&#8217;s and jQuery JQuery Accordion Control links not working


Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series-scottgus-blog/' rel='bookmark' title='URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) &#8211; ScottGu&#8217;s Blog'>URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) &#8211; ScottGu&#8217;s Blog</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
</ul>]]></description>
			<content:encoded><![CDATA[<p>use this;</p>
<pre class="brush: javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(function(){
      // ... your code here!
 });
</pre>


<p>Related posts:<ul><li><a href='http://codeblog.shawson.co.uk/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series-scottgus-blog/' rel='bookmark' title='URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) &#8211; ScottGu&#8217;s Blog'>URL Routing with ASP.NET 4 Web Forms (VS 2010 and .NET 4.0 Series) &#8211; ScottGu&#8217;s Blog</a></li>
<li><a href='http://codeblog.shawson.co.uk/asp-net-update-panels-and-jquery/' rel='bookmark' title='ASP.net update panel&#8217;s and jQuery'>ASP.net update panel&#8217;s and jQuery</a></li>
<li><a href='http://codeblog.shawson.co.uk/jquery-accordion-control-links-not-working/' rel='bookmark' title='JQuery Accordion Control links not working'>JQuery Accordion Control links not working</a></li>
</ul></p>]]></content:encoded>
			<wfw:commentRss>http://codeblog.shawson.co.uk/asp-net-jquery-to-fire-on-partial-post-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

