<?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>Don Kitchen &#187; .net</title>
	<atom:link href="http://www.donkitchen.com/category/programming/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.donkitchen.com</link>
	<description>programming, technology, fatherhood and life</description>
	<lastBuildDate>Wed, 31 Mar 2010 11:56:44 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Forcing a user to read (or scroll through) all text before accepting terms</title>
		<link>http://www.donkitchen.com/2009/12/10/forcing-a-user-to-read-or-scroll-through-all-text-before-accepting-terms/</link>
		<comments>http://www.donkitchen.com/2009/12/10/forcing-a-user-to-read-or-scroll-through-all-text-before-accepting-terms/#comments</comments>
		<pubDate>Thu, 10 Dec 2009 23:39:58 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=329</guid>
		<description><![CDATA[If you&#8217;ve used a computer before you&#8217;ve undoubtedly scrolled through and agreed to some sort of agreement.  Most likely it was some sort of software license agreement that you didn&#8217;t read about some website you were signing up on or an application that you were installing. Maybe, if you&#8217;ve installed enough software or been on [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve used a computer before you&#8217;ve undoubtedly scrolled through and agreed to some sort of agreement.  Most likely it was some sort of <a href="http://en.wikipedia.org/wiki/Software_license_agreement" target="_blank">software license agreement</a> that you didn&#8217;t read about some website you were signing up on or an application that you were installing.</p>
<p>Maybe, if you&#8217;ve installed enough software or been on enough websites you&#8217;ve come across an instance where they actually forced you to scroll all the way down to the bottom of the text before you were able to click &#8220;I Agree&#8221; or whatever acknowledgment they wanted you to use.</p>
<p>Well I was recently faced with creating this exact situation in a web application and ended up using <a href="http://jquery.com/" target="_blank">jQuery </a>to accomplish this in my ASP.NET application.  For my particular situation I ended up putting my content inside a scrollable div.  This can easily be done by using a textbox if you wanted without much effort.</p>
<p>Basically, here&#8217;s what you&#8217;ll need.</p>
<ol>
<li>Reference jQuery (I&#8217;m not going to go into that, you can easily find that out <a href="http://jquery.com/" target="_blank">here</a>)</li>
<li>Put a DIV on your page containing your text that needs to scroll (obviously you&#8217;re putting more than a few sentences or you wouldn&#8217;t be in this boat)</li>
<li>Put a button on your page that, once enabled, will log the user&#8217;s acceptance and redirect them accordingly</li>
<li>Some simple JavaScript to tie the DIV&#8217;s scrolling event to your button</li>
</ol>
<p><strong>Here&#8217;s our DIV:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div style=&quot;width: 400px; height: 400px; overflow: auto; id=&quot;Terms&quot;&gt;
&lt;p&gt;Lots of text to read.&lt;/p&gt;
&lt;p&gt;Lots more text to read&lt;/p&gt;
&lt;/div&gt;</pre></div></div>

<p><strong>Here&#8217;s our button:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;asp:Button ID=&quot;ContinueButton&quot; runat=&quot;server&quot; Text=&quot;Continue&quot; /&gt;</pre></div></div>

<p><strong>Here&#8217;s our JavaScript:</strong></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;head runat=&quot;server&quot;&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/jquery-1.3.1.min.js&quot;&gt;&lt;/script&gt;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
     $<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
          <span style="color: #006600; font-style: italic;">// Initially disable the button</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#ContinueButton&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
          <span style="color: #006600; font-style: italic;">// Map the function below to the scroll event of our Terms DIV</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#Terms&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">scroll</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#Terms&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">AtEnd</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #006600; font-style: italic;">// Enable the button once we reach the end of the DIV</span>
                    $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#ContinueButton&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeAttr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
               <span style="color: #009900;">&#125;</span>
           <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
     $.<span style="color: #660066;">fn</span>.<span style="color: #660066;">AtEnd</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
         <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">scrollTop</span> <span style="color: #339933;">+</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">height</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;=</span> <span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#91;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#93;</span>.<span style="color: #660066;">scrollHeight</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span> 
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;</pre></div></div>

<p>And that&#8217;s it.  This code is light weight and works in IE, Firefox, Chrome and Safari.  Have any feedback or suggestions on how to make it better?  <a href="http://www.donkitchen.com/contact-me/">Let me know</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/12/10/forcing-a-user-to-read-or-scroll-through-all-text-before-accepting-terms/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>CMD HTTP Request &#8211; command line HTTP request utility</title>
		<link>http://www.donkitchen.com/2009/12/09/cmd-http-request-command-line-http-request-utility/</link>
		<comments>http://www.donkitchen.com/2009/12/09/cmd-http-request-command-line-http-request-utility/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 22:50:01 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[CMD HTTP Request]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=319</guid>
		<description><![CDATA[More and more I find that I need to setup some kind of job or scheduled task to accomplish something in .NET on a reoccurring basis.  Typically in the past I&#8217;ve written Windows Services to accomplish this.  While effective, these definitely take longer to write and are harder to debug than say a simple ASP.NET [...]]]></description>
			<content:encoded><![CDATA[<p>More and more I find that I need to setup some kind of job or scheduled task to accomplish something in .NET on a reoccurring basis.  Typically in the past I&#8217;ve written Windows Services to accomplish this.  While effective, these definitely take longer to write and are harder to debug than say a simple ASP.NET page.  What I&#8217;ve done lately is started to move these non-critical, non-security sensitive processes into ASP.NET pages that can be called on a specific schedule via Windows Task Scheduler.</p>
<p>When I started moving this way I realized that I wanted to find a small utility that I could run from a command line to initial a web page request.  It had to be something I could run from a scheduled task and something that I could use to save or log the results.  After doing my due diligence Googling I realized there wasn&#8217;t such a utility that I could easily run from within Windows without installing all kinds of libraries and non-Windows based tools.  So, like any good programmer, I made my own.  Enter <a href="http://cmdhttprequest.codeplex.com/" target="_blank">CMD HTTP Request</a>.</p>
<p>As I said, this utility is small, light weight and runs on Windows via the .NET Framework.  You don&#8217;t need any special commercial programs to run it and it will even check your pages for keywords you specify and save the request&#8217;s results to disk as a HTML file.  This, essentially, is your log of what happened during that request on that date and time.</p>
<p>I won&#8217;t go into too much more detail here.  I think you get the main idea.  You can  download the source code or executable from the <a title="CMD HTTP Request project page" href="http://cmdhttprequest.codeplex.com/" target="_blank">project page on Codeplex</a> and learn more about it.  As always, feel free to leave me any feedback or suggestions either here or via the project page on Codeplex.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/12/09/cmd-http-request-command-line-http-request-utility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CMD Email v2.0 released</title>
		<link>http://www.donkitchen.com/2009/11/14/cmd-email-v2-0-released/</link>
		<comments>http://www.donkitchen.com/2009/11/14/cmd-email-v2-0-released/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 14:25:00 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[CMD Email]]></category>
		<category><![CDATA[cmd email]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[software]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=315</guid>
		<description><![CDATA[CMD Email, the email command line utility I developed (originally discussed here) has been updated to version 2.0. Here are new features for v2.0: Updated to target .NET 3.5 Framework Added support for message body being loaded from a file Added support for multiple file attachments Added support for logging to the Windows Application Event [...]]]></description>
			<content:encoded><![CDATA[<p>CMD Email, the email command line utility I developed (originally discussed <a href="http://www.donkitchen.com/2007/10/26/cmd-email-command-line-email-utility/">here</a>) has been updated to version 2.0.</p>
<p>Here are new features for v2.0:</p>
<ul>
<li>Updated to target .NET 3.5 Framework</li>
<li>Added support for message body being loaded from a file</li>
<li>Added support for multiple file attachments</li>
<li>Added support for logging to the Windows Application Event Log</li>
</ul>
<p>You can download the latest runtime or source from the <a href="http://cmdemail.codeplex.com/" target="_blank">project page on CodePlex</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/11/14/cmd-email-v2-0-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Going for MCTS certification on Visual Studio 2008</title>
		<link>http://www.donkitchen.com/2009/04/23/going-for-mcts-certification-on-visual-studio-2008/</link>
		<comments>http://www.donkitchen.com/2009/04/23/going-for-mcts-certification-on-visual-studio-2008/#comments</comments>
		<pubDate>Thu, 23 Apr 2009 14:05:09 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[Certification]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=242</guid>
		<description><![CDATA[I have been dragging my feet for the past few years in regards to finishing up my Microsoft development certification.  Actually, the last test I took was 70-229 Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition back on Dec 08, 2003.  WOW, I had no idea it was that long until I [...]]]></description>
			<content:encoded><![CDATA[<p>I have been dragging my feet for the past few years in regards to finishing up my Microsoft development certification.  Actually, the last test I took was 70-229 Designing and Implementing Databases with Microsoft SQL Server 2000 Enterprise Edition back on Dec 08, 2003.  WOW, I had no idea it was that long until I just looked it up.</p>
<p>Anyway, what finally got me to get moving was a great voucer/coupon I got via email from Prometric, the testing company I used last time.  Not sure if it&#8217;s specific to me because I&#8217;m already a MCP (yes, I passed that test from years ago) or not but I&#8217;ll share it just in case it does work for others&#8230;</p>
<blockquote><p><strong>&#8230;Improving and validating your technical skills can help.</strong></p>
<p>That is why Prometric is providing a limited offer to the first 4,000 individuals to help get your Microsoft Certified Professional status current or achieve an additional certification.</p>
<p><strong>Offer available for customers who have taken their last certification exam prior to January 1, 2007.</strong></p>
<p>Use this promo code <strong>&#8216;MCPBACK&#8217;</strong> and get a $25 USD Certification (Normally priced at $125 USD). This offer is valid for any exam in the <a href="http://click.bsftransmit1.com/ClickThru.aspx?pubids=R5usqIyLMOgC3whW15JHLLRZW5%2f0kBg6ef8MAQ7%2fOT8%3d&amp;digest=lvih%2fz1vs6megSpLoo%2f63g" target="_blank">MCTS/MCPD/MCITP track.</a> Does not include Microsoft Office or Windows end-user (non-IT) focused exams.</p>
<p>Go to: <a href="http://click.bsftransmit1.com/ClickThru.aspx?pubids=eJ6QdXCYIPlbEdeTste7jKiJ9lQVnCJMmWSBlw%2bvHxs%3d&amp;digest=AU2%2f13%2fhdc3E81cM5Xbllw" target="_blank">www.Prometric.com/microsoft</a> to sign-up for your next exam.</p>
<p><strong>But you better hurry!</strong><br />
<strong>You must take your exam by June 30, 2009.</strong></p>
<p>Offer valid in  US and Canada only.</p></blockquote>
<p>My plan is to obtain the <a href="http://www.microsoft.com/learning/mcp/mcts/vstudio/2008/default.mspx" target="_blank">MCTS: .NET Framework 3.5, ASP.NET Applications </a>certification related to Visual Studio 2008.  What I&#8217;m going to do is take the C# test rather than VB.NET, which is what I mainly use here at work.  I can work in C# and have written a <a href="http://www.donkitchen.com/category/software/cmd-email-software/">few things</a> in it, but my main language since I&#8217;ve been working in .NET has been VB.NET.</p>
<p>I figure this will be a good way to become more familiar with C# and will force me to learn the language.  Once you&#8217;ve been working with .NET for a while and looking through code samples on Google you&#8217;ll quickly realize that the majority of the code samples out there are done in C#.  So, as you can imagine, converting those to VB.NET can be frustrating after a while.</p>
<p>So, we&#8217;ll see how it goes.  I only spent $25 to book the test and another $44 to upgrade my copy of <a href="http://www.amazon.com/gp/product/0735626197?ie=UTF8&amp;tag=donkitchencom-20&amp;linkCode=as2&amp;camp=1789&amp;creative=390957&amp;creativeASIN=0735626197">MCTS Self-Paced Training Kit (Exam 70-536): Microsoft® .NET Framework Application Development Foundation</a><img style="border:none !important; margin:0px !important;" src="http://www.assoc-amazon.com/e/ir?t=donkitchencom-20&amp;l=as2&amp;o=1&amp;a=0735626197" border="0" alt="" width="1" height="1" /> to the second edition.  I picked up the first edition a year or two ago when I first decided I wanted to get the MCTS and only got about 1/2 way through it.</p>
<p>My test is set for June 17, wish me luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/04/23/going-for-mcts-certification-on-visual-studio-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FredNUG tonight</title>
		<link>http://www.donkitchen.com/2009/04/22/frednug-tonight/</link>
		<comments>http://www.donkitchen.com/2009/04/22/frednug-tonight/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 12:28:46 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[FredNug]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[user group]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/2009/04/22/frednug-tonight/</guid>
		<description><![CDATA[I’ll be attending the Frederick .NET user group tonight.&#160; Tonight’s topics will be SQL Server Performance and Coding for Fun and Profit.&#160; More information can be found here.]]></description>
			<content:encoded><![CDATA[<p>I’ll be attending the Frederick .NET user group tonight.&#160; Tonight’s topics will be <em>SQL Server Performance</em> and <em>Coding for Fun and Profit</em>.&#160; More information can be found <a href="http://frednug.org/?page_id=62" target="_blank">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/04/22/frednug-tonight/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ways to optimize your ASP.NET applications</title>
		<link>http://www.donkitchen.com/2009/02/02/ways-to-optimize-your-aspnet-applications/</link>
		<comments>http://www.donkitchen.com/2009/02/02/ways-to-optimize-your-aspnet-applications/#comments</comments>
		<pubDate>Mon, 02 Feb 2009 20:09:15 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[mac]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[weight loss]]></category>
		<category><![CDATA[windows]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[caching]]></category>
		<category><![CDATA[compression]]></category>
		<category><![CDATA[iis]]></category>
		<category><![CDATA[performance]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=200</guid>
		<description><![CDATA[I&#8217;ve spent quite a bit of time recently optimizing our ASP.NET application to help improve performance.  After spending time analyzing the code and the database for inefficiencies, it was clear that something needed to be done to minimize the data (reduce the request size) that was being delivered to each user for each page request. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve spent quite a bit of time recently optimizing our ASP.NET application to help improve performance.  After spending time analyzing the code and the database for inefficiencies, it was clear that something needed to be done to minimize the data (reduce the request size) that was being delivered to each user for each page request.</p>
<p>After lots of reading and testing, I ended up reducing the size of most of our page requests by as much as 95% in some instances. In the next few posts I will go over, in detail, how you can use the following steps to optimize your ASP.NET (and non-ASP.NET) web applications with only a little bit of work:</p>
<ul>
<li><a href="http://www.donkitchen.com/2009/02/05/enabling-and-configuring-http-compression-in-iis6/" target="_self">Enabling and configuring HTTP compression in IIS6</a></li>
<li>Enabling content expiration for static content (graphics, css files, JavaScript files, etc) in IIS6</li>
<li>Changing your application to store ViewState in the session rather than in each page</li>
<li>Configuring Telerik&#8217;s Radcontrols to work as efficiently as possible</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2009/02/02/ways-to-optimize-your-aspnet-applications/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>JavaScript Reporting Services ReportViewer control error fix</title>
		<link>http://www.donkitchen.com/2008/12/08/javascript-reporting-services-reportviewer-control-error-fix/</link>
		<comments>http://www.donkitchen.com/2008/12/08/javascript-reporting-services-reportviewer-control-error-fix/#comments</comments>
		<pubDate>Tue, 09 Dec 2008 03:04:07 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[sql server]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[report viewer]]></category>
		<category><![CDATA[visual studio]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=68</guid>
		<description><![CDATA[I have been going back and forth banging my head against a wall trying to fix a JavaScript error that was happening on my Reporting Services ReportViewer control when the View Report button is clicked.  The error was a JavaScript error and seemed to be related to using something AJAX related on the same page [...]]]></description>
			<content:encoded><![CDATA[<p>I have been going back and forth banging my head against a wall trying to fix a JavaScript error that was happening on my Reporting Services ReportViewer control when the View Report button is clicked.  The error was a JavaScript error and seemed to be related to using something AJAX related on the same page as the ReportViewer control, but it took me a while to figure out what it was and fix it.  All of the problems I saw on the web related to using either an AJAX update panel or one of the extenders in the <a href="http://www.codeplex.com/AjaxControlToolkit" target="_blank">AJAX Control Toolkit</a>.  Unfortunately for me I wasn&#8217;t using either one of them so trying to figure this one out was tricky.</p>
<p>The specific JavaScript error was:</p>
<p><span style="color: #ff0000;">Microsoft JScript runtime error: ‘this._postBackSettings.async’ is null or not an object</span></p>
<p>My page was setup where I had a master page with an AJAX menu on it (Radmenu to be specific).  In order to use the Radmenu you need a ScriptManager object.  Other than the menu, I didn&#8217;t have any AJAX related controls on either the master page or the content page.</p>
<p>What I eventually figured out was that my report pages (which use a base class) needed to disable <a href="http://asp.net/ajax/documentation/live/mref/P_System_Web_UI_ScriptManager_EnablePartialRendering.aspx" target="_blank">partial rendering</a>.  To do this, you must do it in your page&#8217;s init event.  If you do it after the init you&#8217;ll get an <a href="http://msdn2.microsoft.com/en-us/2asft85a" target="_blank">invalid operation exception</a>.  Here&#8217;s the code in the base class (you can put this in your code behind if you&#8217;re not using a base class):</p>

<div class="wp_syntax"><div class="code"><pre class="vbnet" style="font-family:monospace;">    <span style="color: #FF8000;">Private</span> <span style="color: #0600FF;">Sub</span> Page_Init1<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">ByVal</span> sender <span style="color: #FF8000;">As</span> <span style="color: #FF0000;">Object</span>, <span style="color: #FF8000;">ByVal</span> e <span style="color: #FF8000;">As</span> System.<span style="color: #0000FF;">EventArgs</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Handles</span> <span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">Init</span>
&nbsp;
        <span style="color: #008080; font-style: italic;">' Make sure this page has a master page</span>
        <span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> IsNothing<span style="color: #000000;">&#40;</span><span style="color: #FF8000;">Me</span>.<span style="color: #0000FF;">Master</span><span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
&nbsp;
            <span style="color: #0600FF;">Dim</span> masterScriptManager <span style="color: #FF8000;">As</span> ScriptManager
            masterScriptManager <span style="color: #008000;">=</span> <span style="color: #0600FF;">CType</span><span style="color: #000000;">&#40;</span>Master.<span style="color: #0000FF;">FindControl</span><span style="color: #000000;">&#40;</span><span style="color: #808080;">&quot;MasterScriptManager&quot;</span><span style="color: #000000;">&#41;</span>, ScriptManager<span style="color: #000000;">&#41;</span>
&nbsp;
            <span style="color: #008080; font-style: italic;">' Make sure our master page has the script manager we're looking for</span>
            <span style="color: #0600FF;">If</span> <span style="color: #804040;">Not</span> IsNothing<span style="color: #000000;">&#40;</span>masterScriptManager<span style="color: #000000;">&#41;</span> <span style="color: #FF8000;">Then</span>
&nbsp;
                <span style="color: #008080; font-style: italic;">' Turn off partial page postbacks for this page</span>
                masterScriptManager.<span style="color: #0000FF;">EnablePartialRendering</span> <span style="color: #008000;">=</span> <span style="color: #0600FF;">False</span>
            <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
        <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">If</span>
&nbsp;
    <span style="color: #0600FF;">End</span> <span style="color: #0600FF;">Sub</span></pre></div></div>

<p>Just in case others stumble across this and are trying to solve their problem, here are some of the links I landed on when trying to solve the problem:</p>
<ul>
<li><a href="http://forums.asp.net/t/1326775.aspx" target="_blank">ASP.NET Forum Post 1</a></li>
<li><a href="http://forums.asp.net/p/1345083/2732044.aspx" target="_blank">ASP.NET Forum Post 2</a></li>
<li><a href="http://www.kerrywong.com/2008/01/21/jscript-exception-in-ajax-control-toolkit/" target="_blank">Blog Post 1</a></li>
<li><a href="http://stackoverflow.com/questions/57586/aspnet-updatepanel-thispostbacksettingsasync-is-null-or-not-an-object" target="_blank">StackOverflow question</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2008/12/08/javascript-reporting-services-reportviewer-control-error-fix/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
		<item>
		<title>What&#8217;s wrong with my Linqdatasource? &#8211; Method not found!</title>
		<link>http://www.donkitchen.com/2008/08/08/whats-wrong-with-my-linqdatasource-method-not-found/</link>
		<comments>http://www.donkitchen.com/2008/08/08/whats-wrong-with-my-linqdatasource-method-not-found/#comments</comments>
		<pubDate>Fri, 08 Aug 2008 13:15:23 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=56</guid>
		<description><![CDATA[I&#8217;ve been having a very weird problem in Visual Studio 2008 when trying to use the automatic operations for the Linqdatasource (insert, update or delete).  It seems that no matter what I try I get this weird &#8220;Method not found&#8221; problem.  Unfortunately there doesn&#8217;t seem to be a lot of help out on the web [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been having a very weird problem in Visual Studio 2008 when trying to use the automatic operations for the Linqdatasource (insert, update or delete).  It seems that no matter what I try I get this weird &#8220;Method not found&#8221; problem.  Unfortunately there doesn&#8217;t seem to be a lot of help out on the web about why this may be happening.  I&#8217;m starting to think that there may be something goofed up with my 3.5 Framework or Visual Studio 2008.</p>
<p>Here&#8217;s the error and a <a href="http://forums.asp.net/p/1300205/2545504.aspx#2545504" target="_blank">link</a> to the problem I posted out on the ASP.NET forums.  If anybody has come across this weird problem let me know. Unfortunately the 1 person that has replied on the discussion forums hasn&#8217;t been much help and offers up only basic suggestions as to why it may not be working, all of which were things that I had already known or tried right off the bat.</p>
<p>System.MissingMethodException: Method not found: &#8216;System.Object System.Web.UI.WebControls.Parameter.GetValue(System.Object, Boolean)&#8217;.</p>
<pre>Generated: Mon, 04 Aug 2008 12:40:10 GMT
System.Web.HttpUnhandledException: Exception of type 'System.Web.HttpUnhandledException' was thrown. ---&gt; System.MissingMethodException: Method not found: 'System.Object System.Web.UI.WebControls.Parameter.GetValue(System.Object, Boolean)'.
at System.Web.UI.WebControls.LinqDataSourceView.MergeDictionaries(Object dataObjectType, ParameterCollection reference, IDictionary source, IDictionary destination, IDictionary destinationCopy)
at System.Web.UI.WebControls.LinqDataSourceView.BuildInsertDataObject(Object table, IDictionary values)
at System.Web.UI.WebControls.LinqDataSourceView.ExecuteInsert(IDictionary values)
at System.Web.UI.DataSourceView.Insert(IDictionary values, DataSourceViewOperationCallback callback)
at System.Web.UI.WebControls.FormView.HandleInsert(String commandArg, Boolean causesValidation)
at System.Web.UI.WebControls.FormView.HandleEvent(EventArgs e, Boolean causesValidation, String validationGroup)
at System.Web.UI.WebControls.FormView.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.FormViewRow.OnBubbleEvent(Object source, EventArgs e)
at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args)
at System.Web.UI.WebControls.LinkButton.OnCommand(CommandEventArgs e)
at System.Web.UI.WebControls.LinkButton.RaisePostBackEvent(String eventArgument)
at System.Web.UI.WebControls.LinkButton.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument)
at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
--- End of inner exception stack trace ---
at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context)
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at ASP.sellyourhome_aspx.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)</pre>
<p><span style="color: #333399;"><strong>Comments (from previous blog):</strong></span></p>
<p><span style="color: #333399;">Have you installed the beta for Visual Studio 2008 / .NET Framework 3.5</span></p>
<p><span style="color: #333399;">SP 1?? I had the exact same issue on my development box until I</span></p>
<p><span style="color: #333399;">uninstalled the beta and installed the official release at <a rel="nofollow" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;">http://www.microsoft.com/downloads/details.aspx?FamilyId=FBEE1648-7106-44A7-9649-6D9F6D58056E&amp;</a>;displaylang=en .  Make sure you first run the beta removal tool: <a rel="nofollow" href="http://www.microsoft.com/downloads/details.aspx?FamilyId=A494B0E0-EB07-4FF1-A21C-A4663E456D9D&amp;">http://www.microsoft.com/downloads/details.aspx?FamilyId=A494B0E0-EB07-4FF1-A21C-A4663E456D9D&amp;</a>;displaylang=en</span></p>
<pre></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2008/08/08/whats-wrong-with-my-linqdatasource-method-not-found/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>VB.NET RC4 Encryption for database storage</title>
		<link>http://www.donkitchen.com/2007/11/28/vbnet-rc4-encryption-for-database-storage/</link>
		<comments>http://www.donkitchen.com/2007/11/28/vbnet-rc4-encryption-for-database-storage/#comments</comments>
		<pubDate>Wed, 28 Nov 2007 13:10:07 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[rc4]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[vb.net]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=48</guid>
		<description><![CDATA[I recently had to upgrade some Classic ASP code to .NET for some data encryption.  The routines use RC4 encryption and make the result database friendly.  The following class can easily be dropped into your project for use with little effort.  The sample code shows the encryption and decryption methods.  You just provide the message [...]]]></description>
			<content:encoded><![CDATA[<div class="postText">
<p>I recently had to upgrade some Classic ASP code to .NET for some data encryption.  The routines use RC4 encryption and make the result database friendly.  The following class can easily be dropped into your project for use with little effort.  The sample code shows the encryption and decryption methods.  You just provide the message and the key for either instance.  From there you can drop it in your database or do whatever you want!</p>
<p>Sample Usage:</p>
<p>Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load</p>
<p>Dim plainText As String = &#8220;I&#8217;m exposed!&#8221;<br />
Dim passkey As String = &#8220;keep me safe&#8221;</p>
<p>Dim safeText As String<br />
safeText = Common.Encryption.Encrypt(plainText, passkey)</p>
<p>Response.Write(safeText)</p>
<p>Dim decrypted As String<br />
decrypted = Common.Encryption.Decrypt(safeText, passkey)</p>
<p>Response.Write(decrypted)</p>
<p>End Sub</p>
<p>You can view the entire class <a href="http://www.donkitchen.com/code/Encryption.vb.txt" target="_blank">here</a>.  If you&#8217;re looking for some quick and easy encryption this will do the trick.</div>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2007/11/28/vbnet-rc4-encryption-for-database-storage/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FormView and ObjectDataSource with nullable types</title>
		<link>http://www.donkitchen.com/2007/07/15/formview-and-objectdatasource-with-nullable-types/</link>
		<comments>http://www.donkitchen.com/2007/07/15/formview-and-objectdatasource-with-nullable-types/#comments</comments>
		<pubDate>Mon, 16 Jul 2007 02:09:20 +0000</pubDate>
		<dc:creator>Don</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[formview]]></category>

		<guid isPermaLink="false">http://www.donkitchen.com/?p=20</guid>
		<description><![CDATA[I recently ran into this problem when using a FormView and and ObjectDataSource where the FormView was binding to nullable data types&#8230; Here is a challenging question, as I have not found any suitable information on this after two days of searching: Background: I have a custom Business Class library that includes custom objects with [...]]]></description>
			<content:encoded><![CDATA[<div class="postText">
<p>I recently ran into this problem when using a FormView and and ObjectDataSource where the FormView was binding to nullable data types&#8230;</p>
<p><em>Here is a challenging question, as I have not found any suitable information on this after two days of searching:<br />
</em></p>
<blockquote><p><em>Background:</em></p>
<p><em>I have a custom Business Class library that includes custom objects with nullable int and DateTime properties. In order to update this data, I have created a FormView control bound to an ObjectDataSource that retrieves a generic List collection of my business objects. The reflection that is intrinsically called by the FormView/ObjectDataSource combination dutifully builds my basic Select, Update, and Insert templates. Now, when you edit the various (TextBoxes by default) input fields and then call the Update method referenced in the ODS (ObjectDataSource), the ODS attempts to convert the data contained in the input fields to the corresponding Type of the property bound to said input field. This is where we run into our little problem&#8230;</em></p>
<p><em>Even though I have a nullable Integer property type (let&#8217;s call it int? ClassNumber), if the corresponding TextBox is empty (since it&#8217;s not required), an exception is thrown by the ODS since it tries to convert an empty string value to an integer value before trying to set the object&#8217;s Property. Hah! If ODS was able to determine that the integer is in fact nullable, it should pass in a null value instead! But alas, it throws a System.IndexOutOfRangeException: &#8220;Index was outside the bounds of the array&#8221; error. And further down the stack: &#8220;Exception: is not a valid value for Int32&#8243;. Hmmm. Since this is a FormView control, we don&#8217;t have the ability to use a BoundField control with 2 very useful properties: NullDisplayText and ConvertEmptyStringToNull. It would be nice to tell ODS to enable sending null values from any control we want.</em></p></blockquote>
<p>The above was posted originally <a href="http://www.eggheadcafe.com/community/aspnet/2/81350/previous-community-conver.aspx" target="_blank">here</a>.  I used his clipping because it describes perfectly the problem I had, along with many, many others.</p>
<p>After hours and hours of Googling and trial and error I finally found the solution to this.  There was no way in hell I was going to accept the solution of manually re-populating each field I had bound in my edit and insert templates for my FormView.  The solution was much easier and left all of the heavy lifting to the FormView.</p>
<p>Basically, all you have to do is all insert and update parameters in your ObjectDataSource for each field you&#8217;re binding.  For these fields, you just need to supply the field name, the data type and set the ConvertEmptyStringToNull property to TRUE.  Also, you&#8217;ll need to be sure to set the ConvertNullToDBNul property to TRUE in the ObjectDataSource itself, like below.</p>
<pre>&lt;InsertParameters&gt;
&lt;asp:Parameter Name="TimeZoneOffset" Type="int32" ConvertEmptyStringToNull="true" /&gt;
&lt;/InsertParameters&gt;
&lt;UpdateParameters&gt;
&lt;asp:Parameter Name="TimeZoneOffset" Type="int32" ConvertEmptyStringToNull="true" /&gt;
&lt;/UpdateParameters&gt;</pre>
<p>So just by adding these parameters for the insert and update you can have your FormView&#8217;s databinding work with nullable types.  Not too bad, huh?</p>
<p><span style="color: #333399;"><strong>Comments (from previous blog):</strong></span></p>
<p><span style="color: #333399;">Don,</span></p>
<p><span style="color: #333399;">Great! I am so glad you&#8217;ve found a solution to this annoying issue. Your solution is both simple and elegant. Since my posting (from which this post was based), I have by and large moved on from the FormView control in most cases and have instead used a number of different input methods, particular to the types of applications I have been building. This finding of yours may have sparked a new interest, and now I&#8217;ll have to play around with it some more. Thanks for posting a reply to my original post: (<a rel="nofollow" href="http://www.eggheadcafe.com/community/aspnet/2/81350/previous-community-conver.aspx">http://www.eggheadcafe.com/community/aspnet/2/81350/previous-community-conver.aspx</a>).</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">I am having a problem like this one. However, I am using the Protected Sub GridView1_RowDataBound in order to control how the row will look like depending on the data. The problem is that when there is no data, I get this message:</span></p>
<p><span style="color: #333399;">Specified argument was out of the range of valid values.</span></p>
<p><span style="color: #333399;">It points to:  datasch = e.Row.Cells(1).Text</span></p>
<p><span style="color: #333399;">Obvisly, if there is no data, there is no Row(1)&#8230; I tried to make a condition with that idea but nothen so far&#8230; help!!</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Me again&#8230;</span></p>
<p><span style="color: #333399;">I foud this solution.</span></p>
<p><span style="color: #333399;">If e.Row.RowType = DataControlRowType.DataRow Then</span></p>
<p><span style="color: #333399;">&#8216;all the code&#8230;</span></p>
<p><span style="color: #333399;">end if</span></p>
<p><span style="color: #333399;">Thanks for being part of the solution.</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Gosh, thanks for your post. I hit into such problem and I was so puzzled for what was happening. For the reason that I had an ID field which supposed to be generated by the system. So, it was null during Insert. :-O</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">I ran into this issue as well and broke my head over it for a day or so. Then I discovered the FormView_OnItemInserting event and realized that I could validate the data there. I wrote code that changes empty strings to null for my decimal properties. Here&#8217;s the code:<br />
protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)<br />
{<br />
//do the check for empty strings instead of decimals here and make the value null if necessary<br />
// Iterate through the items in the Values collection<br />
// if key=FeesFirst or key=FeesSecond and value=&#8221;", change value to null<br />
foreach (DictionaryEntry entry in e.Values)<br />
{<br />
if (entry.Value.Equals(&#8220;&#8221;) &amp;&amp; (entry.Key.ToString() == &#8220;FeesFirst&#8221; || entry.Key.ToString() == &#8220;FeesSecond&#8221;))<br />
{<br />
e.Values[entry.Key] = null;<br />
}<br />
}<br />
}</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Don,</span></p>
<p><span style="color: #333399;">I am having the same problem. But in my case I have a custom object as my parameter. I am using a data entity class to transport data between the layers in my application. I have the same scenario whereby I have bound my formview with an objectdatasource.</span></p>
<p><span style="color: #333399;">My update method in my business object looks a bit like this</span></p>
<p><span style="color: #333399;">Public Function Update(ByVal NewEmployee As Employee, ByVal OldEmployee As Employee) As Boolean</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">JP,</span></p>
<p><span style="color: #333399;">What do the parameters for your datasource look like?</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Don,</span></p>
<p><span style="color: #333399;">The parameters for my datasource are the two objects that are being passed to my update function (NewEmployee and OldEmployee). The objectdatasource works with a list of individual parameters representing the individual fields in the database that you may want to update or it can also work with custom objects that holds these parameters as properties. In this case I have taken into consideration of optimistic concurrency. That is why I have two parameters which the objectdatasource picks up as objects. One passes in the new values and the other retains the old values. This works by setting the ConflictDetection property of the objectdatasource to CompareAllValues.</span></p>
<p><span style="color: #333399;">By the way for some reason the whole scenario works without a fuss with a details view. But I need the UI design flexibility of the formview</span></p>
<p><span style="color: #333399;">Thanks</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Don</span></p>
<p><span style="color: #333399;">Here is a cut down version of the Employee object being passed as new and old parameters in my business object</span></p>
<p><span style="color: #333399;">&#8221;&#8217; &lt;summary&gt;<br />
&#8221;&#8217; This is the class representing a single instance of Employee<br />
&#8221;&#8217; &lt;/summary&gt;<br />
&#8221;&#8217; &lt;remarks&gt;Primary key of this class is &lt;c&gt;EmployeeId&lt;/c&gt;&lt;/remarks&gt;<br />
&lt;Serializable()&gt; _<br />
Public Class Employee<br />
Inherits BaseDataEntity<br />
Implements IDataEntity</span></p>
<p><span style="color: #333399;">#Region &#8221; Private Declarations &#8221;<br />
Private _EmployeeId As Nullable(Of Int32)<br />
Private _OrgTreeId As Nullable(Of Int32)<br />
Private _PayNumber As String = String.Empty<br />
Private _FirstName As String = String.Empty<br />
Private _LastName As String = String.Empty<br />
#End Region</span></p>
<p><span style="color: #333399;">#Region &#8221; Constructor/Initialisation &#8221;<br />
Sub New()<br />
init()<br />
End Sub</span></p>
<p><span style="color: #333399;">Protected Overrides Sub init()<br />
&#8216; Initialization Implementation if needed<br />
End Sub<br />
#End Region</span></p>
<p><span style="color: #333399;">#Region &#8221; Entity Primary Keys &#8221;<br />
&lt;DataObjectField(True, True, False), Browsable(False), Description(&#8220;Employee Id&#8221;)&gt; _<br />
Public Property EmployeeId() As Int64 Implements IDataEntity.Id<br />
Get<br />
Return _EmployeeId.GetValueOrDefault(0)<br />
End Get<br />
Set(ByVal Value As Int64)<br />
_EmployeeId = Value<br />
End Set<br />
End Property<br />
#End Region</span></p>
<p><span style="color: #333399;">#Region &#8221; Public Properties &#8221;<br />
&lt;DataObjectField(False, False, False), Browsable(False), Description(&#8220;Org Tree Id&#8221;)&gt; _<br />
Public Property OrgTreeId() As Nullable(Of Int32)<br />
Get<br />
Return _OrgTreeId.GetValueOrDefault(0)<br />
End Get<br />
Set(ByVal Value As Nullable(Of Int32))<br />
_OrgTreeId = Value<br />
End Set<br />
End Property</span></p>
<p><span style="color: #333399;">&lt;DataObjectField(False, False, False, 50), Browsable(False), Description(&#8220;Pay Number&#8221;)&gt; _<br />
Public Property PayNumber() As String<br />
Get<br />
Return _PayNumber<br />
End Get<br />
Set(ByVal Value As String)<br />
_PayNumber = Value<br />
End Set<br />
End Property</span></p>
<p><span style="color: #333399;">&lt;DataObjectField(False, False, False, 50), Browsable(False), Description(&#8220;First Name&#8221;)&gt; _<br />
Public Property FirstName() As String<br />
Get<br />
Return _FirstName<br />
End Get<br />
Set(ByVal Value As String)<br />
_FirstName = Value<br />
End Set<br />
End Property</span></p>
<p><span style="color: #333399;">&lt;DataObjectField(False, False, False, 50), Browsable(False), Description(&#8220;Last Name&#8221;)&gt; _<br />
Public Property LastName() As String<br />
Get<br />
Return _LastName<br />
End Get<br />
Set(ByVal Value As String)<br />
_LastName = Value<br />
End Set<br />
End Property</span></p>
<p><span style="color: #333399;">#End Region</span></p>
<p><span style="color: #333399;">End Class</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Hi Don,</span></p>
<p><span style="color: #333399;">Have u managed to find a work around to my problem?</span></p>
<p><span style="color: #333399;">Regards</span></p>
<p><span style="color: #333399;">JP</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">JP,</span></p>
<p><span style="color: #333399;">I guess I didn&#8217;t understand completely what you were asking. In my example, the parameters were nullable database fields that I was trying to bind to in a formview. You indicated that your two parameters are custom objects. The two aren&#8217;t really the same thing.</span></p>
<p><span style="color: #333399;">Is your problem that you can&#8217;t bind to the properties of the custom objects or that your properties that the capability of being null aren&#8217;t retaining their null values?</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">JP, I had the same problem. I worked around the issue by using the Formview ItemUpdating event to see if the field value was String.Empty, if it was I set it to a null value. In my business object the fields are declared as Nullable&lt;int&gt;.</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">It is not working with DateTime data type. it is giving me following error<br />
Object of type &#8216;System.DBNull&#8217; cannot be converted to type &#8216;System.Nullable`1[System.DateTime]&#8216;.</span></p>
<p><span style="color: #333399;">I have scenario as you have i have connected my objectdatasource with my formview and sending data from BLL to DAL. Can you suggest me any idea</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Milind,</span></p>
<p><span style="color: #333399;">Based on the instructions in my original post, it should work fine with a datetime data type. You need to make sure that your insert and update parameters are correct. Here&#8217;s a snippet from an ObjectDataSource in one of my projects, which uses datetime datatypes. This works fine:</span></p>
<p><span style="color: #333399;">Keep in mind, I&#8217;ve removed some extra insert and update parameters to keep the comment shorter. They keys here to remember are to make sure you have ConvertNullToDbNull=&#8221;true&#8221; in the object datasource and to be sure to have your nullable field in the insert and/or update parameters collection with ConvertEmptyStringToNull=&#8221;true&#8221; set.</span></p>
<p><span style="color: #333399;">&lt;asp:ObjectDataSource ID=&#8221;EmployeeInfoDataSource&#8221; runat=&#8221;server&#8221; DataObjectTypeName=&#8221;HeeHawApp.Entities.EmployeeInfoView&#8221;<br />
InsertMethod=&#8221;InsertEmployeeInfo&#8221; SelectMethod=&#8221;GetEmployeeInfoByEmployeeId&#8221;<br />
TypeName=&#8221;HeeHawApp.Business.EmployeeManager&#8221; UpdateMethod=&#8221;UpdateEmployeeInfo&#8221;<br />
ConvertNullToDBNull=&#8221;true&#8221;&gt;<br />
&lt;SelectParameters&gt;<br />
&lt;asp:QueryStringParameter Name=&#8221;EmployeeId&#8221; QueryStringField=&#8221;EmployeeId&#8221; Type=&#8221;Int32&#8243;<br />
DefaultValue=&#8221;0&#8243; /&gt;<br />
&lt;/SelectParameters&gt;<br />
&lt;InsertParameters&gt;<br />
&lt;asp:Parameter Name=&#8221;EmployeeDOB&#8221; Type=&#8221;datetime&#8221; ConvertEmptyStringToNull=&#8221;true&#8221; /&gt;<br />
&lt;/InsertParameters&gt;<br />
&lt;UpdateParameters&gt;<br />
&lt;asp:Parameter Name=&#8221;EmployeeDOB&#8221; Type=&#8221;datetime&#8221; ConvertEmptyStringToNull=&#8221;true&#8221; /&gt;<br />
&lt;/UpdateParameters&gt;<br />
&lt;/asp:ObjectDataSource&gt;</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">I tried to use a FormView and there is a checkbox field to display boolean value. It causes exception when the database value is null. How to solve this?</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Thanks man, it solved my problem. I was just about to kick my computer <img src='http://www.donkitchen.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Can anyone help with this one? Similar problem, but I&#8217;m using a GridView. My Select method on the ObjectDataSource is taking it&#8217;s parameters from the QueryString.</span></p>
<p><span style="color: #333399;">Example Parameter:<br />
&lt;asp:QueryStringParameter DefaultValue=&#8221;Null&#8221; Name=&#8221;pItemNo&#8221; QueryStringField=&#8221;Item&#8221;<br />
Type=&#8221;Int32&#8243; ConvertEmptyStringToNull=&#8221;true&#8221; /&gt;</span></p>
<p><span style="color: #333399;">I also have ConvertNullToDBNull=&#8221;True&#8221; on the ObjectDataSource.</span></p>
<p><span style="color: #333399;">When I try to run it, I get the following:</span></p>
<p><span style="color: #333399;">[FormatException: Input string was not in a correct format.]<br />
System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer&amp; number, NumberFormatInfo info, Boolean parseDecimal) +2755599<br />
System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) +112<br />
System.String.System.IConvertible.ToInt32(IFormatProvider provider) +43<br />
System.Convert.ChangeType(Object value, TypeCode typeCode, IFormatProvider provider) +293<br />
System.Web.UI.WebControls.Parameter.GetValue(Object value, String defaultValue, TypeCode type, Boolean convertEmptyStringToNull, Boolean ignoreNullableTypeChanges) +264<br />
System.Web.UI.WebControls.Parameter.get_ParameterValue() +66<br />
System.Web.UI.WebControls.ParameterCollection.GetValues(HttpContext context, Control control) +254<br />
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +257<br />
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17<br />
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149<br />
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70<br />
System.Web.UI.WebControls.GridView.DataBind() +4<br />
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82<br />
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69<br />
System.Web.UI.Control.EnsureChildControls() +87<br />
System.Web.UI.Control.PreRenderRecursiveInternal() +50<br />
System.Web.UI.Control.PreRenderRecursiveInternal() +170<br />
System.Web.UI.Control.PreRenderRecursiveInternal() +170<br />
System.Web.UI.Control.PreRenderRecursiveInternal() +170<br />
System.Web.UI.Control.PreRenderRecursiveInternal() +170<br />
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041</span></p>
<p><span style="color: #333399;">Thanks!!</span></p>
<p><span style="color: #333399;">-Brice</span></p>
<p><span style="color: #333399;">&#8212;</span></p>
<p><span style="color: #333399;">Never mind! I found my problem. I removed DefaultValue=&#8221;Null&#8221; from each of my parameters. Also, in my case, I needed to set ConvertNullToDBNull=&#8221;false&#8221; on the ObjectDataSource.</span></p>
<p><span style="color: #333399;">Thanks!  Great Article!!  It really helped!</span></div>
]]></content:encoded>
			<wfw:commentRss>http://www.donkitchen.com/2007/07/15/formview-and-objectdatasource-with-nullable-types/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
