<?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>Learning to Code</title>
	<atom:link href="http://learningthecode.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://learningthecode.wordpress.com</link>
	<description>one small step at a time</description>
	<lastBuildDate>Tue, 02 Jun 2009 13:51:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='learningthecode.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Learning to Code</title>
		<link>http://learningthecode.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://learningthecode.wordpress.com/osd.xml" title="Learning to Code" />
	<atom:link rel='hub' href='http://learningthecode.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Binding multiple comboboxes to the same datasource</title>
		<link>http://learningthecode.wordpress.com/2009/06/02/binding-multiple-comboboxes-to-the-same-datasource/</link>
		<comments>http://learningthecode.wordpress.com/2009/06/02/binding-multiple-comboboxes-to-the-same-datasource/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 13:51:06 +0000</pubDate>
		<dc:creator>garfion</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Winforms]]></category>
		<category><![CDATA[BindingSource]]></category>
		<category><![CDATA[ComboBox]]></category>
		<category><![CDATA[DataBinding]]></category>

		<guid isPermaLink="false">http://learningthecode.wordpress.com/?p=14</guid>
		<description><![CDATA[Bind combo boxes to the same datasource yet have them act independantly.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=14&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Consider the following: You have multiple comboboxs that you want to contain the same data, you create your datatable and bind them to the combo boxes ie.</p>
<p><strong>comboBox1.DataSource = dt;<br />
comboBox1.DisplayMember = &#8220;Item&#8221;;</strong></p>
<p><strong>comboBox2.DataSource = dt;<br />
comboBox2.DisplayMember = &#8220;Item&#8221;;</strong></p>
<p>Then you run your app/webapp change the first combobox and bang&#8230;the second combobox changes to the same value. This is normal behaviour as they are bound the same source. Now the obvious route would be to create two separate DataTables but this isn&#8217;t ideal, especially if you have several boxes to bind. Come to the rescue <strong>&#8216;New BindingContext&#8217;</strong></p>
<p><strong>comboBox1.DataSource = dt<br />
comboBox1.DisplayMember = &#8220;Item&#8221;<br />
</strong><strong><br />
comboBox2.DataSource = dt<br />
comboBox2.DisplayMember = &#8220;Item&#8221;<br />
comboBox2.BindingContext = New BindingContext()</strong></p>
<p>Now when you change the combobox the other acts independantly. I won&#8217;t pretend to know exactly how it works &#8211; but it does and certainly saves a lot of time and resources creating serveral DataTables.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningthecode.wordpress.com/14/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningthecode.wordpress.com/14/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningthecode.wordpress.com/14/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=14&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningthecode.wordpress.com/2009/06/02/binding-multiple-comboboxes-to-the-same-datasource/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43ca5f0d6266b3e2597377a18088c5bf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">learningthecode</media:title>
		</media:content>
	</item>
		<item>
		<title>Adding attributes to html elements in your code behind</title>
		<link>http://learningthecode.wordpress.com/2009/04/19/adding-attributes-to-html-elements-in-your-code-behind/</link>
		<comments>http://learningthecode.wordpress.com/2009/04/19/adding-attributes-to-html-elements-in-your-code-behind/#comments</comments>
		<pubDate>Sun, 19 Apr 2009 14:35:37 +0000</pubDate>
		<dc:creator>garfion</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[attributes.add]]></category>
		<category><![CDATA[html attributes]]></category>

		<guid isPermaLink="false">http://learningthecode.wordpress.com/?p=10</guid>
		<description><![CDATA[Add attributes like "class" and "border" to your html elements from your code behind.<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=10&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>To make any html element availble in your code behind you need to add an ID and runat server like so:</p>
<p><strong>&lt;li ID=&#8221;FirstListItem&#8221; runat=&#8221;server&#8221;&gt;&lt;/li&gt;</strong></p>
<p>Now in your code behind you will be able to access the item by its ID. To add attributes to the element you use the code below:</p>
<p><strong>FirstListItem.Attributes.Add(&#8220;class&#8221;, &#8220;listitem1Class&#8221;</strong></p>
<p>If you run the page and look at the source you will see your &lt;li&gt; element has now changed to the below:</p>
<p><strong>&lt;li ID=&#8221;FirstListItem&#8221; runat=&#8221;server&#8221; class=&#8221;listitem1Class&#8221;&gt;&lt;/li&gt;</strong></p>
<p>You can add any attribute the element supports, some examples:</p>
<p><strong>YourElement.Attributes.Add(&#8220;class&#8221;, &#8220;myCssClass&#8221;)<br />
YourElement.Attributes.Add(&#8220;width&#8221;, &#8220;100px&#8221;)<br />
YourElement.Attributes.Add(&#8220;border&#8221;, &#8220;1px&#8221;)<br />
YourElement.Attributes.Add(&#8220;alt&#8221;, &#8220;Alternative Text for Images&#8221;)</strong><br />
To remove an attribute use the below:</p>
<p><strong>YourElement.Attributes.Remove(&#8220;class&#8221;)<br />
YourElement.Attributes.Remove(&#8220;border&#8221;)</strong></p>
<p>This is helpfull for changing an element after a post back or user interaction.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningthecode.wordpress.com/10/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningthecode.wordpress.com/10/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningthecode.wordpress.com/10/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=10&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningthecode.wordpress.com/2009/04/19/adding-attributes-to-html-elements-in-your-code-behind/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43ca5f0d6266b3e2597377a18088c5bf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">learningthecode</media:title>
		</media:content>
	</item>
		<item>
		<title>Stop returning to top of page on post back</title>
		<link>http://learningthecode.wordpress.com/2009/04/15/stop-returning-to-top-of-page-on-post-back/</link>
		<comments>http://learningthecode.wordpress.com/2009/04/15/stop-returning-to-top-of-page-on-post-back/#comments</comments>
		<pubDate>Wed, 15 Apr 2009 16:32:49 +0000</pubDate>
		<dc:creator>garfion</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[aspx]]></category>
		<category><![CDATA[MaintainScrollPosition]]></category>
		<category><![CDATA[post back]]></category>

		<guid isPermaLink="false">http://learningthecode.wordpress.com/?p=5</guid>
		<description><![CDATA[Maintain the postion of the page after a post back in aspx<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=5&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Can&#8217;t believe I went so long without finding this&#8230;</p>
<p>Problem: You have some sort of user input form half way down a page or a drop down select box or anything that needs to post back after the user has interacted with it and boom. Page flashes and they are taken to the top of the screen. I know whats happened but average we user Joe doesn&#8217;t and leaves <img src='http://s0.wp.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>The page has posted back to the server and information has been transferred back and fourth and so the page needs refreshed with the new data, which returns it to the top.</p>
<p>A really simple way of keeping the current location of the page when posting back has been available in .NET for quite some time now apparently (I&#8217;m slow on the up-take though&#8230;).</p>
<p>At the top of your aspx page you&#8217;ll have something like this:</p>
<p><em>&lt;%@ Page Language=&#8221;VB&#8221; AutoEventWireup=&#8221;false&#8221; CodeFile=&#8221;Default.aspx.vb&#8221; Inherits=&#8221;_Default&#8221; %&gt;</em></p>
<p>Simply add:</p>
<p><em>MaintainScrollPositionOnPostback=&#8221;true&#8221;</em></p>
<p>So that it looks like this:</p>
<p><em>&lt;%@ Page Language=&#8221;VB&#8221; AutoEventWireup=&#8221;false&#8221; CodeFile=&#8221;Default.aspx.vb&#8221; Inherits=&#8221;_Default&#8221; MaintainScrollPositionOnPostback=&#8221;true&#8221; %&gt;</em></p>
<p>Now when the page posts back the browser will flash (refresh) but it will return the user to the same position on the page.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/learningthecode.wordpress.com/5/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/learningthecode.wordpress.com/5/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/learningthecode.wordpress.com/5/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=learningthecode.wordpress.com&amp;blog=7277453&amp;post=5&amp;subd=learningthecode&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://learningthecode.wordpress.com/2009/04/15/stop-returning-to-top-of-page-on-post-back/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43ca5f0d6266b3e2597377a18088c5bf?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">learningthecode</media:title>
		</media:content>
	</item>
	</channel>
</rss>
