<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>One .Net Way</title>
	
	<link>http://www.onedotnetway.com</link>
	<description>Everything .Net</description>
	<lastBuildDate>Mon, 15 Feb 2010 03:07:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/OneDotNetWay" /><feedburner:info uri="onedotnetway" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><creativeCommons:license>http://creativecommons.org/licenses/by-nc-nd/2.0/</creativeCommons:license><image><link>http://creativecommons.org/licenses/by-nc-nd/2.0/</link><url>http://creativecommons.org/images/public/somerights20.gif</url><title>Some Rights Reserved</title></image><feedburner:emailServiceId>OneDotNetWay</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item>
		<title>One .NET Way Is Alive!</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/xUqseCyuWt4/</link>
		<comments>http://www.onedotnetway.com/one-net-way-is-alive/#comments</comments>
		<pubDate>Mon, 15 Feb 2010 03:07:44 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Blogging]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/?p=730</guid>
		<description><![CDATA[This site went into hibernation in October and since then I have not pushed the resume button. Why such a delay? There are reasons which you are not interested in reading and I’m not interested in writing. So I will skip all the oooh I couldn’t blog because I was sooo busy yada yada yada [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/one-net-way-is-alive/">One .NET Way Is Alive!</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This site went into hibernation in October and since then I have not pushed the resume button. Why such a delay? There are reasons which you are not interested in reading and I’m not interested in writing. So I will skip all the oooh I couldn’t blog because I was sooo busy yada yada yada and get on with it.</p>
<p>One .NET Way shall resume normal programming (no pun intended) immediately.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/one-net-way-is-alive/">One .NET Way Is Alive!</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/xUqseCyuWt4" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/one-net-way-is-alive/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/one-net-way-is-alive/</feedburner:origLink></item>
		<item>
		<title>Working With Client ID In ASP.NET 4</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/FIFaEgtyP-U/</link>
		<comments>http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/#comments</comments>
		<pubDate>Fri, 30 Oct 2009 03:54:25 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/</guid>
		<description><![CDATA[ASP.NET 4 allows developers to customize Client Id which gets generated by ASP.NET. Up until now Client Id generated by ASP.NET has been ummm just plain ugly. Other than aesthetics they are also hard to work with in client side scripts. ASP.NET solves this issue to a degree by providing ClientIDMode property. In this post [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/">Working With Client ID In ASP.NET 4</a></p>
]]></description>
			<content:encoded><![CDATA[<p>ASP.NET 4 allows developers to customize Client Id which gets generated by ASP.NET. Up until now Client Id generated by ASP.NET has been ummm just plain ugly. Other than aesthetics they are also hard to work with in client side scripts. ASP.NET solves this issue to a degree by providing ClientIDMode property. In this post we will look at different ways to work with this new feature of ASP.NET 4.</p>
<p>ClientIDMode can be set at Page level or at Control level. Let’s follow with an example of a GridView control. We will set it’s ClientIdMode property to all available options and view the markup. We will bind our GridView to a collection of cities. A city class looks like this.</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">City
</span>{
<span style="color: blue">  public string </span>Name { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
<span style="color: blue">  public string </span>Country { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
}</pre>
<p>&#160;</p>
<p>The collection itself can be initialized using this code.</p>
<pre class="code"><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">City</span>&gt; cities =
        <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">City</span>&gt;
        {
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Sydney&quot;</span>, Country = <span style="color: #a31515">&quot;Australia&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;New York&quot;</span>, Country = <span style="color: #a31515">&quot;USA&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Paris&quot;</span>, Country = <span style="color: #a31515">&quot;France&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Milan&quot;</span>, Country = <span style="color: #a31515">&quot;Spain&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Melbourne&quot;</span>, Country = <span style="color: #a31515">&quot;Australia&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Auckland&quot;</span>, Country = <span style="color: #a31515">&quot;New Zealand&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Tokyo&quot;</span>, Country = <span style="color: #a31515">&quot;Japan&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;New Delhi&quot;</span>, Country = <span style="color: #a31515">&quot;India&quot; </span>},
            <span style="color: blue">new </span><span style="color: #2b91af">City</span>{ Name = <span style="color: #a31515">&quot;Hobart&quot;</span>, Country = <span style="color: #a31515">&quot;Australia&quot; </span>}
        };</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>&#160;</p>
<p>Source for our GridView looks like this.</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;gridViewCities&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;&gt;
  &lt;</span><span style="color: maroon">Columns</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
      &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;Label1&quot; </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Bind(&quot;Name&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">' /&gt;
      &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
      &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;Label2&quot; </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Bind(&quot;Country&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">' /&gt;
      &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: maroon">Columns</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView</span><span style="color: blue">&gt;
</span></pre>
<p>&#160;</p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h4>ClientIDMode = “AutoID”</h4>
<p>Using this mode will generate the IDs as it has in earlier versions of ASP.NET.</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView
        </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
        </span><span style="color: red">ID</span><span style="color: blue">=&quot;gridViewCities&quot;
        </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;
        </span><span style="color: red">ClientIDMode</span><span style="color: blue">=&quot;AutoID&quot;&gt;
</span></pre>
<p>&#160;</p>
<p>HTML generated by AutoID (showing only relevant part).</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image4.png" width="501" height="310" /> </p>
<p>&#160;</p>
<h4>ClientIDMode = “Static”</h4>
<p>Static mode outputs the same ID in HTML as specified in ASP.NET source. </p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView
        </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
        </span><span style="color: red">ID</span><span style="color: blue">=&quot;gridViewCities&quot;
        </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;
        </span><span style="color: red">ClientIDMode</span><span style="color: blue">=&quot;Static&quot;&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image5.png" width="342" height="304" /> </p>
<p>Static Mode is not the best for controls such as GridView or any other data control which displays lists of data. As you can see above that all span tags have same IDs. Static Mode is best to be used with other common controls or User Controls.</p>
<p>&#160;</p>
<h4>ClientIDMode = “Predictable”</h4>
<p>Predictable mode concatenates the ID of parent control with the bound value supplied by assigning ClientIDRowSuffix property.</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView
        </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;
        </span><span style="color: red">ID</span><span style="color: blue">=&quot;gridViewCities&quot;
        </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot;
        </span><span style="color: red">ClientIDMode</span><span style="color: blue">=&quot;Predictable&quot;
        </span><span style="color: red">ClientIDRowSuffix</span><span style="color: blue">=&quot;Name&quot;&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>&#160;</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image6.png" width="527" height="307" /> </p>
<p>Here we see that our span elements have been named by concatenating the name of GridView + value of Name property. Rather than setting ClientIDRowSuffix to Name property a better candidate would have been an ID property which could be some sort of unique field. But you get the idea, right?</p>
<p>&#160;</p>
<h4>ClientIDMode = “Inherit”</h4>
<p>Inherit is the default mode for all controls. Assigning this mode a control will use the same setting as its parent control. This gives us an idea that we can have different settings for parent and children. Here we are setting ClientIDMode for our first label to be static while the GridView is using AutoID.</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;gridViewCities&quot; </span><span style="color: red">AutoGenerateColumns</span><span style="color: blue">=&quot;False&quot; </span></pre>
<pre class="code"><span style="color: blue">  </span><span style="color: red">ClientIDMode</span><span style="color: blue">=&quot;AutoID&quot;&gt;
  &lt;</span><span style="color: maroon">Columns</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
      &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;Label1&quot; </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Bind(&quot;Name&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">' </span></pre>
<pre class="code"><span style="color: blue">          </span><span style="color: red">ClientIDMode</span><span style="color: blue">=&quot;Static&quot; /&gt;
      &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
    &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
      &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
        &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;Label2&quot; </span><span style="color: red">Text</span><span style="color: blue">='</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Bind(&quot;Country&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">' /&gt;
      &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">TemplateField</span><span style="color: blue">&gt;
  &lt;/</span><span style="color: maroon">Columns</span><span style="color: blue">&gt;
&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">GridView</span><span style="color: blue">&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image7.png" width="510" height="302" /> </p>
<p>We see that our first span uses static client ID but the second span uses inherited scheme for client ID.</p>
<p>&#160;</p>
<h4>Conclusion</h4>
<p>In this post we saw a new feature of ASP.NET 4 which let’s you customize IDs generated in HTML elements. This feature is useful when we need to access controls from client scripts. ASP.NET has been lacking such a feature. Not any more.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/">Working With Client ID In ASP.NET 4</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/FIFaEgtyP-U" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/feed/</wfw:commentRss>
		<slash:comments>13</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/working-with-client-id-in-asp-net-4/</feedburner:origLink></item>
		<item>
		<title>Learn .NET 4.0 And Visual Studio 2010 On Channel 9</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/rtLqeKTk2Gs/</link>
		<comments>http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 01:07:14 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[.Net]]></category>
		<category><![CDATA[Training]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/</guid>
		<description><![CDATA[Channel 9 which happens to be my favourite media station now has a section for courses. And if you have downloaded Visual Studio 2010 then this is the place to get yourself some VS 2010 training. Topics covered in this online course are:

Managed Languages
ASP.NET 4.0
Data Platform
WCF &#38; WF
Parallel Computing
ALM

Link to Visual Studio 2010 and .NET [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/">Learn .NET 4.0 And Visual Studio 2010 On Channel 9</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Channel 9 which happens to be my favourite media station now has a section for courses. And if you have downloaded Visual Studio 2010 then this is the place to get yourself some VS 2010 training. Topics covered in this online course are:</p>
<ol>
<li>Managed Languages</li>
<li>ASP.NET 4.0</li>
<li>Data Platform</li>
<li>WCF &amp; WF</li>
<li>Parallel Computing</li>
<li>ALM</li>
</ol>
<p>Link to <a href="http://channel9.msdn.com/learn/courses/vs2010/">Visual Studio 2010 and .NET Framework Training Course</a>.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/">Learn .NET 4.0 And Visual Studio 2010 On Channel 9</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/rtLqeKTk2Gs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/learn-net-4-0-and-visual-studio-2010-on-channel-9/</feedburner:origLink></item>
		<item>
		<title>Create Breakpoints With Hit Count In Visual Studio 2008</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/kbzMDL-45zI/</link>
		<comments>http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 05:40:26 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/</guid>
		<description><![CDATA[This post shows you how to use Breakpoints in Visual Studio with a hit count. Breakpoints can be described as bread and butter of debugging. They allow you to stop execution at any statement in your code. By doing this you can examine values in your variables, look at call stack, change values in variables [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/">Create Breakpoints With Hit Count In Visual Studio 2008</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This post shows you how to use Breakpoints in Visual Studio with a hit count. Breakpoints can be described as bread and butter of debugging. They allow you to stop execution at any statement in your code. By doing this you can examine values in your variables, look at call stack, change values in variables and much more.&#160; </p>
<p>Let’s follow this post with an example of a simple program which uses a loop to add a number to a List&lt;int&gt;.</p>
<pre class="code"><span style="color: blue">static void </span>Main(<span style="color: blue">string</span>[] args)
{
<span style="color: #2b91af">  List</span>&lt;<span style="color: blue">int</span>&gt; numbers = <span style="color: blue">new </span><span style="color: #2b91af">List</span>&lt;<span style="color: blue">int</span>&gt;();
<span style="color: blue">  for </span>(<span style="color: blue">int </span>i = 0; i &lt; 100; i++)
  {
    numbers.Add(i);
  }
}</pre>
<pre class="code">&#160;</pre>
<p>We will now add a breakpoint to numbers.Add(i) line. A breakpoint can be added by clicking on gray area on the left side of code editor or by pressing F9. </p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visual Studio Breakpoint" border="0" alt="Visual Studio Breakpoint" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image.png" width="403" height="146" /> </p>
<p>Here we have added a simple breakpoint. Our program will break when we hit the breakpoint for the first time. Let’s say that we want our breakpoint to hit at 50 iteration of our loop. To do this we can right click on the breakpoint circle on left hand side and click Hit Count.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visual Studio Breakpoint" border="0" alt="Visual Studio Breakpoint" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image1.png" width="413" height="259" />&#160; </p>
<p>When we click on Hit Count we get a dialog where we can set the conditions when our breakpoint should be hit.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visual Studio Breakpoint" border="0" alt="Visual Studio Breakpoint" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image2.png" width="516" height="253" /> </p>
<p>In our case we will select “break when the hit count is equal to” and enter 50.</p>
<p><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Visual Studio Breakpoint" border="0" alt="Visual Studio Breakpoint" src="http://www.onedotnetway.com/wp-content/uploads/2009/10/image3.png" width="508" height="247" /> </p>
<p>If we now run our program we will hit the breakpoint when value of i = 49. Remember that we started i at 0 so when i is equal to 49 we are on the 50th iteration.</p>
<p>This comes in handy when debugging large loops and we are only interested in breaking when we have processed X number of iterations.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/">Create Breakpoints With Hit Count In Visual Studio 2008</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/kbzMDL-45zI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/create-breakpoints-with-hit-count-in-visual-studio-2008/</feedburner:origLink></item>
		<item>
		<title>Windows 7 Commercial – More Happy Is Coming</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/NQFtwmyG38Q/</link>
		<comments>http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 05:19:45 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[Windows 7]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/</guid>
		<description><![CDATA[This is a very smart commercial for Windows 7. A clever way to praise a product without taking a dig on others. Maybe Apple will learn a thing or two from this. Enjoy.
 
Post from: One .Net Way
Windows 7 Commercial &#8211; More Happy Is Coming
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/">Windows 7 Commercial &ndash; More Happy Is Coming</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This is a very smart commercial for Windows 7. A clever way to praise a product without taking a dig on others. Maybe Apple will learn a thing or two from this. Enjoy.</p>
<p> <object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/ssOq02DTTMU&amp;hl=en&amp;fs=1&amp;"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/ssOq02DTTMU&amp;hl=en&amp;fs=1&amp;" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object></p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/">Windows 7 Commercial &ndash; More Happy Is Coming</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/NQFtwmyG38Q" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/windows-7-commercial-more-happy-is-coming/</feedburner:origLink></item>
		<item>
		<title>Output DOCTYPE In XSLT</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/u5ajWPwr4_s/</link>
		<comments>http://www.onedotnetway.com/output-doctype-in-xslt/#comments</comments>
		<pubDate>Wed, 16 Sep 2009 03:18:37 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[XSLT]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/output-doctype-in-xslt/</guid>
		<description><![CDATA[These days I am working on a personal project which I call “my precious”. This projects involves transforming XML documents into HTML using XSLT. Things were going smooth till I decided to output DOCTYPE from XSLT. This is what I did.
&#160;&#160; 
XSLT parser does not like the code above and gives me this error.
 
After [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/output-doctype-in-xslt/">Output DOCTYPE In XSLT</a></p>
]]></description>
			<content:encoded><![CDATA[<p>These days I am working on a personal project which I call “my precious”. This projects involves transforming XML documents into HTML using XSLT. Things were going smooth till I decided to output DOCTYPE from XSLT. This is what I did.</p>
<p>&#160;<img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="XSLT" border="0" alt="XSLT" src="http://www.onedotnetway.com/wp-content/uploads/2009/09/image2.png" width="457" height="80" />&#160; </p>
<p>XSLT parser does not like the code above and gives me this error.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="XSLT" border="0" alt="XSLT" src="http://www.onedotnetway.com/wp-content/uploads/2009/09/image3.png" width="404" height="56" /> </p>
<p>After scratching my head for a while and navigating through intellisense few times I found the right solution. The way to output DOCTYPE in XSLT is by placing in inside a CDATA. The following code works like a charm.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="XSLT" border="0" alt="XSLT" src="http://www.onedotnetway.com/wp-content/uploads/2009/09/image4.png" width="475" height="74" /> </p>
<p>This I thought was worth sharing.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/output-doctype-in-xslt/">Output DOCTYPE In XSLT</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/u5ajWPwr4_s" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/output-doctype-in-xslt/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/output-doctype-in-xslt/</feedburner:origLink></item>
		<item>
		<title>TechEd Australia Day 2</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/RvH0P4x7zdM/</link>
		<comments>http://www.onedotnetway.com/teched-australia-day-2/#comments</comments>
		<pubDate>Wed, 09 Sep 2009 10:58:27 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[TechEd]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/teched-australia-day-2/</guid>
		<description><![CDATA[Keynote for TechEd Australia started a bit slow with too much concentration on words such as innovation, excitement and productivity. Keynote was saved by awesome presentations by Sara Ford and Sarah Vaughan. Rest of the day was fantastic. A combination of excellent topics and superb presentation skills made it a worthy learning day. 
The best [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/teched-australia-day-2/">TechEd Australia Day 2</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Keynote for TechEd Australia started a bit slow with too much concentration on words such as innovation, excitement and productivity. Keynote was saved by awesome presentations by Sara Ford and Sarah Vaughan. Rest of the day was fantastic. A combination of excellent topics and superb presentation skills made it a worthy learning day. </p>
<p>The best presentation of the day which I attended was by <a href="http://damianedwards.wordpress.com/">Damian Edwards</a> on ASP.NET MVC. Well structured and full of useful information. ASP.NET MVC is my current focus and that made the presentation even more interesting for me . Well done Damian. </p>
<p>I also attended a talk on BizSpark by <a href="http://blog.rog42.net/">Rog42</a> and <a href="http://blogs.msdn.com/chlong/">Christian Longstaff</a>. Biz Spark is a great program for startups and if you are one then you should definitely look at it. Where else can you get a suite of world class software at $100 which is payable in third year. I’m thinking that I might consider it for my company.</p>
<p>I also enjoyed Sharepoint presentation by <a href="http://blogs.msdn.com/acoat/">Andrew Coates</a> and <a href="http://wss.made4the.net/default.aspx">Jeremy Thake</a>. Their presentation was well synchronised and full of Sharepoint goodness. I’m not too much into Sharepoint but even I picked up points which I could use if god forbid I have to do any Sharepoint work again.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/teched-australia-day-2/">TechEd Australia Day 2</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/RvH0P4x7zdM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/teched-australia-day-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/teched-australia-day-2/</feedburner:origLink></item>
		<item>
		<title>TechEd Australia Day 1</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/MMzWhIJ_8_g/</link>
		<comments>http://www.onedotnetway.com/teched-australia-day-1/#comments</comments>
		<pubDate>Tue, 08 Sep 2009 11:57:50 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[News]]></category>
		<category><![CDATA[TechEd]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/teched-australia-day-1/</guid>
		<description><![CDATA[Some of you may know that author of this site (that’s me in case you are thinking) is attending his first ever TechEd. TechEd to me is like woodstock for developers and other IT people who come in masses for this amazing and full of geek energy event. Over next few posts I will write [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/teched-australia-day-1/">TechEd Australia Day 1</a></p>
]]></description>
			<content:encoded><![CDATA[<p>Some of you may know that author of this site (that’s me in case you are thinking) is attending his first ever TechEd. TechEd to me is like woodstock for developers and other IT people who come in masses for this amazing and full of geek energy event. Over next few posts I will write about my experience of TechEd.</p>
<h3>Day 1</h3>
<p>Technically today was not the first day of TechEd but it was for me. I arrived at Gold Coast after a pleasant 1 point something hour flight. Meeting familiar people at Gold Coast airport who were also headed to TechEd got me into TechEd groove right away. I checked into my hotel which is in front of Convention Centre and the best part is that I can get a panoramic view of Convention Centre from my window. Wasting no time I went straight to Convention Centre for registration and picked up my Netbook, picked up my delegate bag (to be reviewed soon) and headed to exhibition hall where I caught up with <a href="http://www.lobsterpot.com.au">Rob Farley</a> and finally met Deeps. For those who have confused me with <a href="http://blogs.technet.com/user/Profile.aspx?UserID=5777">Deeps</a> I can now logically prove that we are two different people. Exhibition hall was buzzing with activity and you could feel geek vibes all over the place. </p>
<p>I took some pictures which you can view down below. But before you do that I have a WTF to report on. Drums please. WTF for today was found inside delegate bag within HP folder. There is a pamphlet which says HP recommends Vista Business. </p>
<p> Registration booths at TechEd Australia.</p>
<p><a title="IMG_0167 by deepakkapoor, on Flickr" href="http://www.flickr.com/photos/deepakkapoor/3899449713/"><img alt="IMG_0167" src="http://farm3.static.flickr.com/2448/3899449713_9bbc3d5fa2.jpg" width="500" height="375" /></a> </p>
<p> Me holding my HP Netbook. Still in the box.</p>
<p><a title="IMG_0170 by deepakkapoor, on Flickr" href="http://www.flickr.com/photos/deepakkapoor/3899449727/"><img alt="IMG_0170" src="http://farm4.static.flickr.com/3482/3899449727_531daf0111.jpg" width="500" height="375" /></a> </p>
<p> My friend Rob Farley holding my Netbook.</p>
<p> <a title="IMG_0168 by deepakkapoor, on Flickr" href="http://www.flickr.com/photos/deepakkapoor/3899449721/"><img alt="IMG_0168" src="http://farm4.static.flickr.com/3520/3899449721_74ce372b78.jpg" width="375" height="500" /></a>
<p> Netbook right out of the box. Not booted yet.</p>
<p> <a title="IMG_0172 by deepakkapoor, on Flickr" href="http://www.flickr.com/photos/deepakkapoor/3899449735/"><img alt="IMG_0172" src="http://farm3.static.flickr.com/2525/3899449735_9c5d8e2f1d.jpg" width="375" height="500" /></a>
<p>More tomorrow…</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/teched-australia-day-1/">TechEd Australia Day 1</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/MMzWhIJ_8_g" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/teched-australia-day-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/teched-australia-day-1/</feedburner:origLink></item>
		<item>
		<title>Output To Console In Windows Forms Application</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/4aAeKwUo3Hw/</link>
		<comments>http://www.onedotnetway.com/output-to-console-in-windows-forms-application/#comments</comments>
		<pubDate>Tue, 01 Sep 2009 01:25:27 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Win32]]></category>
		<category><![CDATA[Windows Forms]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/output-to-console-in-windows-forms-application/</guid>
		<description><![CDATA[This post shows you how to output data to a Console in a Windows Forms Application. I use this technique religiously when developing Windows Forms applications. Debugging is much simpler when you can see information on what your application is doing in a Console. Of course the onus is on you as developer to output [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/output-to-console-in-windows-forms-application/">Output To Console In Windows Forms Application</a></p>
]]></description>
			<content:encoded><![CDATA[<p>This post shows you how to output data to a Console in a Windows Forms Application. I use this technique religiously when developing Windows Forms applications. Debugging is much simpler when you can see information on what your application is doing in a Console. Of course the onus is on you as developer to output data which will help you.</p>
<p>In this post I will use a simple Windows Forms application which adds two numbers.</p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Windows Forms" src="http://www.onedotnetway.com/wp-content/uploads/2009/09/image.png" border="0" alt="Windows Forms" width="300" height="188" /></p>
<p>By default a Windows Forms application does not output to a Console even if you write a Console.Write() or Console.WriteLine(). This shortcoming can be addressed by using Win32 API. In your Windows Forms application you can declare a class which provides a wrapper around Win32 functions.</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">Win32
</span>{
<span style="color: gray">  /// &lt;summary&gt;
  /// </span><span style="color: green">Allocates a new console for current process.
</span><span style="color: gray">  /// &lt;/summary&gt;
  </span>[<span style="color: #2b91af">DllImport</span>(<span style="color: #a31515">"kernel32.dll"</span>)]
<span style="color: blue">  public static extern </span><span style="color: #2b91af">Boolean </span>AllocConsole();

<span style="color: gray">  /// &lt;summary&gt;
  /// </span><span style="color: green">Frees the console.
</span><span style="color: gray">  /// &lt;/summary&gt;
  </span>[<span style="color: #2b91af">DllImport</span>(<span style="color: #a31515">"kernel32.dll"</span>)]
<span style="color: blue">  public static extern </span><span style="color: #2b91af">Boolean </span>FreeConsole();
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>A Console must be started to accept input and display our messages. This can be done by calling Win32.AllocConsole() function. For my example I will start the console in my form’s constructor.</p>
<pre class="code"><span style="color: blue">public </span>Form1()
{
  InitializeComponent();

<span style="color: #2b91af">  Win32</span>.AllocConsole();
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Now when I write to Console, I will see data appear in the console window which was started in my constructor.</p>
<pre class="code"><span style="color: blue">private void </span>Add(<span style="color: blue">int </span>num1, <span style="color: blue">int </span>num2)
{
<span style="color: blue">  int </span>result = num1 + num2;

<span style="color: #2b91af">  Console</span>.WriteLine(
<span style="color: blue">    string</span>.Format(<span style="color: #a31515">"{0} + {1} = {2}"</span>, num1, num2, result));
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Console" src="http://www.onedotnetway.com/wp-content/uploads/2009/09/image1.png" border="0" alt="Console" width="419" height="189" /></p>
<p>As a good practice you should also close the console window by calling Win32.FreeConsole() method before your application exits.</p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/output-to-console-in-windows-forms-application/">Output To Console In Windows Forms Application</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/4aAeKwUo3Hw" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/output-to-console-in-windows-forms-application/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/output-to-console-in-windows-forms-application/</feedburner:origLink></item>
		<item>
		<title>ADO.NET Data Services Logical Operators</title>
		<link>http://feedproxy.google.com/~r/OneDotNetWay/~3/oZ32EVJfI4I/</link>
		<comments>http://www.onedotnetway.com/adonet-data-services-logical-operators/#comments</comments>
		<pubDate>Wed, 26 Aug 2009 07:52:54 +0000</pubDate>
		<dc:creator>Deepak</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[Data Services]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[REST]]></category>

		<guid isPermaLink="false">http://www.onedotnetway.com/adonet-data-services-logical-operators/</guid>
		<description><![CDATA[In this post we will look at Logical Operators in ADO.NET Data Services. These operators can be used as filter expressions in our requests and ADO.NET Data Services applies the filter before results are returned. We will use Data Services generated over Adventureworks Lite database. If you are new to ADO.NET Data Services and would [...]<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/adonet-data-services-logical-operators/">ADO.NET Data Services Logical Operators</a></p>
]]></description>
			<content:encoded><![CDATA[<p>In this post we will look at Logical Operators in ADO.NET Data Services. These operators can be used as filter expressions in our requests and ADO.NET Data Services applies the filter before results are returned. We will use Data Services generated over Adventureworks Lite database. If you are new to ADO.NET Data Services and would like to know how to generate ADO.NET Data Service then please see this <a href="http://www.onedotnetway.com/adonet-data-services-tutorial-with-aspnet/">article</a>.</p>
<p>One thing to keep in mind is that filter expressions are case sensitive. And the syntax of applying filters in ADO.NET Data Services is</p>
<p><font color="#008000">&lt;url&gt;?$filter=&lt;your filter&gt;</font></p>
<p>Let’s now look at all logical operators</p>
<h3>Equal To</h3>
<p><font color="#008000">Parameter: eq</font></p>
<p>Equal To evaluates true when both operands have the same value. Here I am retrieving products where the value of Color matches “Yellow”.</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=Color eq &#8216;Yellow&#8217;</font></p>
<p>Logical operator can also be applied in code through a LINQ query. </p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>p.Color == <span style="color: #a31515">&quot;Yellow&quot;
</span><span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.Color);
}</pre>
<p>&#160;</p>
<h3>Not Equal To</h3>
<p><font color="#008000"></font></p>
<p><font color="#008000">Parameter: ne</font></p>
<p>Not equal is opposite of equal to and evaluates true when both operands do not have the same value. Here I am retrieving products where the value of Color is NOT “Yellow”.</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=Color ne &#8216;Yellow&#8217;</font></p>
<p>Following code will also achieve the same result through a LINQ query.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>p.Color != <span style="color: #a31515">&quot;Yellow&quot;
</span><span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.Color);
}</pre>
<p>&#160;</p>
<h3>Less than</h3>
<p><font color="#008000">Parameter: lt</font></p>
<p>Less than evaluates true when first operand is less than second. In this example I get all products where ListPrice is less than 20.</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=ListPrice lt 20</font></p>
<p>Here is the C# version of Less than operator.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>p.ListPrice &lt; 20
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>Less than or equal to</h3>
<p><font color="#008000">Parameter: le</font></p>
<p>Less than or equal to evaluates true when first operand is either less than or equal to second operand. In this example I am retrieving all products where ListPrice is less than or equal to 9.5</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=ListPrice le 9.5</font></p>
<p>And C# equivalent will look like this.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>p.ListPrice &lt;= 9.5m
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>Greater than</h3>
<p><font color="#008000">Parameter: gt</font></p>
<p>Greater than evaluates true if the first operand is greater than the second. In this example I am retrieving all products where ListPrice is greater than 9.5</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=ListPrice gt 9.5</font></p>
<p>Greater than is a no brainer with a LINQ query.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  here </span>p.ListPrice &gt; 9.5m
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<h3>Greater than or equal to</h3>
<p><font color="#008000">Parameter: ge</font></p>
<p>Greater than or equal to evaluates true if the first operand is greater than or equal to second. Here is&#160; an example. I am retrieving all products where ListPrice is greater than or equal to 9.5</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=ListPrice ge 9.5</font></p>
<p>C# example</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>p.ListPrice &gt;= 9.5m
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.ProductID + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>&#160;</p>
<h3>And</h3>
<p><font color="#008000">Parameter: and</font></p>
<p>“And” evaluates true when both operands are true. In this example I am retrieving all products where the Color is Black and ListPrice is greater than 1000.</p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=(Color eq &#8216;Black&#8217;) and (ListPrice gt 1000)</font></p>
<p>Same results can be retrieved in C# with this code.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>(p.Color == <span style="color: #a31515">&quot;Black&quot;</span>)
    &amp;&amp; (p.ListPrice &gt; 1000)
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.Color + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p>&#160;</p>
<h3>Or</h3>
<p><font color="#008000">Parameter: or</font></p>
<p>“Or” evaluates true when either operand is true. In this example I am retrieving all products where either the Color is Black or ListPrice is greater than 1000.</p>
<p><a href="http://localhost:6803/DataService.svc/Product?"><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?</font></a><font color="#800000" size="3">$filter=(Color eq &#8216;Black&#8217;) or (ListPrice gt 1000)</font></p>
<p>Now with C#.</p>
<pre class="code"><span style="color: #2b91af">AdventureWorksEntities </span>context = <span style="color: blue">new </span><span style="color: #2b91af">AdventureWorksEntities</span>(uri);
<span style="color: #2b91af">DataServiceQuery</span>&lt;<span style="color: #2b91af">Product</span>&gt; products = context.CreateQuery&lt;<span style="color: #2b91af">Product</span>&gt;(<span style="color: #a31515">@&quot;/Product&quot;</span>);

<span style="color: blue">var </span>query = <span style="color: blue">from </span>p <span style="color: blue">in </span>products
<span style="color: blue">  where </span>(p.Color == <span style="color: #a31515">&quot;Black&quot;</span>)
    || (p.ListPrice &gt; 1000)
<span style="color: blue">  select </span>p;

<span style="color: blue">foreach </span>(<span style="color: blue">var </span>item <span style="color: blue">in </span>query)
{
<span style="color: #2b91af">  Console</span>.WriteLine(item.Color + <span style="color: #a31515">&quot;\t&quot; </span>+ item.ListPrice);
}</pre>
<p>&#160;</p>
<h3>Not</h3>
<p><font color="#008000">Parameter: not</font></p>
<p>“Not” evaluates true if operand is false. An example can be retrieving all products where the Color is not Black. </p>
<p><font color="#800000" size="3">http://localhost:6803/DataService.svc/Product?$filter=not (Color eq &#8216;Black&#8217;)</font></p>
<p>While this can be achieved using not equal to operator they are not the same. I’ll leave C# code for this one for you :)</p>
<p>&#160;</p>
<h3>Conclusion</h3>
<p>This article demonstrated all logical operators available for ADO.NET Data Services. In a future post I will cover other types of operators for ADO.NET Data Services. </p>
<p>Post from: <a href="http://www.onedotnetway.com">One .Net Way</a></p>
<p><a href="http://www.onedotnetway.com/adonet-data-services-logical-operators/">ADO.NET Data Services Logical Operators</a></p>
<img src="http://feeds.feedburner.com/~r/OneDotNetWay/~4/oZ32EVJfI4I" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://www.onedotnetway.com/adonet-data-services-logical-operators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://www.onedotnetway.com/adonet-data-services-logical-operators/</feedburner:origLink></item>
	</channel>
</rss>
