<?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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Code Corner</title>
	
	<link>http://CodeCorner.galanter.net</link>
	<description>ASP.NET, XML, SQL and Javascript tips and tricks</description>
	<lastBuildDate>Tue, 22 May 2012 20:20:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/galanter/CodeCorner" /><feedburner:info uri="galanter/codecorner" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Regenerate JavaScript function code in ASP.NET partial postback after initial load</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/YVMzqKzChDc/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/22/regenerate-javascript-function-code-in-asp-net-partial-postback-after-initial-load/#comments</comments>
		<pubDate>Tue, 22 May 2012 20:20:28 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1902</guid>
		<description><![CDATA[ASP.NET has a handy way of generating client side JavaScript code, but using it can be sometimes unpredictable. For example your client-side script needs to call function MyAlert, but the function itself is generated server-side on page load: Function is generated, and in due time, when needed is called by the client and the message [...]]]></description>
			<content:encoded><![CDATA[<p>ASP.NET has a handy way of generating client side JavaScript code, but using it can be sometimes unpredictable. For example your client-side script needs to call function <code>MyAlert</code>, but the function itself is generated server-side on page load:</p>
<pre class="brush: vb; title: ; notranslate">ClientScript.RegisterStartupScript(Me.GetType, &quot;JSCode&quot;, _
                  &quot;function MyAlert() {alert('This is the FIRST call')}&quot;, True)</pre>
<p>Function is generated, and in due time, when needed is called by the client and the message &#8220;<em>This is the FIRST call</em>&#8221; is displayed. All is well.</p>
<p>Now, your page also has an UpdatePanel, and during a partial postback you need to modify that client-side function:</p>
<pre class="brush: vb; title: ; notranslate">ScriptManager.RegisterStartupScript(Me, Me.GetType, &quot;JSCode&quot;, _
                  &quot;function MyAlert() {alert('This is the SECOND call')}&quot;, True)</pre>
<p>In due time, when again needed by client code, function <code>MyAlert</code> is called and the message (wait for it, you&#8217;re in for a surprise) &#8220;<em>This is the FIRST call</em>&#8221; is displayed again. Originally generated function is called and second generation is ignored.<span id="more-1902"></span></p>
<p>To rectify the situation you need to declare function as a variable (empty initially) in your client code:</p>
<pre class="brush: jscript; title: ; notranslate">var MyAlert;</pre>
<p>And then modify server-side generation code to use assignment notation (instead of <code>function MyAlert</code> use <code>MyAlert = function</code>):</p>
<p>Initial load:</p>
<pre class="brush: vb; title: ; notranslate">ClientScript.RegisterStartupScript(Me.GetType, &quot;JSCode&quot;, _
                  &quot;MyAlert = function() {alert('This is the FIRST call')}&quot;, True)</pre>
<p>and partial postback</p>
<pre class="brush: vb; title: ; notranslate">ScriptManager.RegisterStartupScript(Me, Me.GetType, &quot;JSCode&quot;, _
                  &quot;MyAlert = function() {alert('This is the SECOND call')}&quot;, True)</pre>
<p>after these changes client-side code behaves as expected and freshly generated function is called every time.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/03/03/run-javascript-from-both-full-and-partial-asp-net-postback/" rel="bookmark" class="crp_title">Run JavaScript from both full and partial ASP.NET postback</a></li><li><a href="http://CodeCorner.galanter.net/2009/07/28/injecting-client-script-into-infragistics-async-postback/" rel="bookmark" class="crp_title">Injecting client script into Infragistics async postback</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/aK0pt4tsclohRS_0xMYe1d_cON4/0/da"><img src="http://feedads.g.doubleclick.net/~a/aK0pt4tsclohRS_0xMYe1d_cON4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/aK0pt4tsclohRS_0xMYe1d_cON4/1/da"><img src="http://feedads.g.doubleclick.net/~a/aK0pt4tsclohRS_0xMYe1d_cON4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/YVMzqKzChDc" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/22/regenerate-javascript-function-code-in-asp-net-partial-postback-after-initial-load/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/22/regenerate-javascript-function-code-in-asp-net-partial-postback-after-initial-load/</feedburner:origLink></item>
		<item>
		<title>TSQL: Mix column names and ordinals in ORDER BY</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/P_hr2t13IGQ/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/16/tsql-mix-column-names-and-ordinals-in-order-by/#comments</comments>
		<pubDate>Wed, 16 May 2012 15:52:46 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1895</guid>
		<description><![CDATA[It might be a weird scenario from a parallel universe, but in infinite dimensions it is bound to happen to someone else besides me. If you&#8217;re getting results from a query where you know some columns by name and others only by their ordinal position (e.g. if SQL is built dynamically and can change based [...]]]></description>
			<content:encoded><![CDATA[<p>It might be a weird scenario from a parallel universe, but in infinite dimensions it is bound to happen to someone else besides me. If you&#8217;re getting results from a query where you know some columns by name and others only by their ordinal position (e.g. if SQL is built dynamically and can change based on different condition) &#8211; you add sorting to that query by both ordinal position of a column and column name and even throw an expression into the mix. Allow me to illustrate:</p>
<p>Let&#8217;s get back to basics, namely Northwind database. If I ran a query like this:</p>
<pre class="brush: sql; title: ; notranslate">SELECT * FROM Customers</pre>
<p>I will get a result, similar to this:</p>
<p><img src="http://kitchen.galanter.net/sitepic/SelectUnsorted.png" alt="Unsorted SELECT" /></p>
<p>Now to the weird part. Let&#8217;s say I need to sort this query by by Contact&#8217;s title and Contact&#8217;s <em>last</em> name. I don&#8217;t know what the column name for the Contact&#8217;s title will be, but I know if will always be a static 4th column. I don&#8217;t know where in the resultset Contact&#8217;s <em>full</em> name be located (it could be 3rd, or 8th or whatever column) but I do know it will always be called <code>ContactName</code>.<span id="more-1895"></span></p>
<p>There query for this scenario would be:</p>
<pre class="brush: sql; title: ; notranslate">SELECT * FROM Customers
ORDER BY 4, RIGHT(ContactName, LEN(ContactName) - CHARINDEX(' ', ContactName))</pre>
<p>Here we first sort by the 4th column (ordinal position for column with Contact&#8217;s title and unknown name) and then by a string expression that extracts last name from ContactName column. The result:</p>
<p><img src="http://kitchen.galanter.net/sitepic/SelectSorted.png" alt="Sorted SELECT" /></p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/07/01/select-specific-groups-using-dense-rank/" rel="bookmark" class="crp_title">Select specific groups using DENSE_RANK</a></li><li><a href="http://CodeCorner.galanter.net/2011/03/15/individual-sorting-of-select-queries-in-the-union/" rel="bookmark" class="crp_title">Individual Sorting of SELECT queries in the UNION</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/CWuyB-Bt-9bqh5qzEjW4JFi7JyY/0/da"><img src="http://feedads.g.doubleclick.net/~a/CWuyB-Bt-9bqh5qzEjW4JFi7JyY/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/CWuyB-Bt-9bqh5qzEjW4JFi7JyY/1/da"><img src="http://feedads.g.doubleclick.net/~a/CWuyB-Bt-9bqh5qzEjW4JFi7JyY/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/P_hr2t13IGQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/16/tsql-mix-column-names-and-ordinals-in-order-by/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/16/tsql-mix-column-names-and-ordinals-in-order-by/</feedburner:origLink></item>
		<item>
		<title>UltraWebGridExcelExporter: Export more than 65536 rows</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/0AoztMbgxKM/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/14/ultrawebgridexcelexporter-export-more-than-65536-rows/#comments</comments>
		<pubDate>Mon, 14 May 2012 17:37:48 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[excel]]></category>
		<category><![CDATA[extending]]></category>
		<category><![CDATA[grid]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1887</guid>
		<description><![CDATA[When exporting data from Infragistics UltraWebGrid into Excel using UltraWebGridExcelExporter ordinary a very basic code similar to this is used: That&#8217;s it. But, if your data exceed 65536 rows you will get an error: System.InvalidOperationException: The maximum number of rows in an excel worksheet with the current format is: 65536 This is not Excel Exporter [...]]]></description>
			<content:encoded><![CDATA[<p>When exporting data from Infragistics UltraWebGrid into Excel using UltraWebGridExcelExporter ordinary a very basic code similar to this is used:</p>
<pre class="brush: vb; title: ; notranslate">'
' define Exporter &quot;xMyExporter&quot;
' define UltraWebGrid &quot;xMyGrid&quot; and load grid with data, then:
'
xMyExporter.ExportMode = UltraWebGrid.ExcelExport.ExportMode.Download
xMyExporter.Export(xMyGrid)</pre>
<p>That&#8217;s it. But, if your data exceed 65536 rows you will get an error:</p>
<p><span style="color:red"><em>System.InvalidOperationException: The maximum number of rows in an excel worksheet with the current format is: 65536</em></span></p>
<p>This is not Excel Exporter limitation.<span id="more-1887"></span> In fact this is a limitation of Excel 2003 XLS format, which is a default output format of the Excel Exporter. The good news &#8211; this can be easily changed. Consider the following code:</p>
<pre class="brush: vb; title: ; notranslate">'
' define Exporter &quot;xMyExporter&quot;
' define UltraWebGrid &quot;xMyGrid&quot; and load grid with data, then:
'
Dim oBook As New Excel.Workbook(Excel.WorkbookFormat.Excel2007)

xMyExporter.ExportMode = UltraWebGrid.ExcelExport.ExportMode.Download
xMyExporter.Export(xMyGrid, oBook)</pre>
<p>In this version we first defined an Excel Workbook (<em>Line 5</em>) and gave it Excel 2007 format. And then used that workbook in actual export (<em>Line 8</em>). Which produces an Excel 2007 XLSX format capable of storing over 1 million rows.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/03/10/ultrawebgrid-hiding-serveronly-columns-during-export-to-excel/" rel="bookmark" class="crp_title">UltraWebGrid: Hiding ServerOnly columns during export to Excel</a></li><li><a href="http://CodeCorner.galanter.net/2011/04/14/opening-spreadsheetml-2003-in-excel-2010/" rel="bookmark" class="crp_title">Opening SpreadsheetML 2003 in Excel 2010</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/LA_ggpa_HnPSpjn51IaEwxEpNys/0/da"><img src="http://feedads.g.doubleclick.net/~a/LA_ggpa_HnPSpjn51IaEwxEpNys/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/LA_ggpa_HnPSpjn51IaEwxEpNys/1/da"><img src="http://feedads.g.doubleclick.net/~a/LA_ggpa_HnPSpjn51IaEwxEpNys/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/0AoztMbgxKM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/14/ultrawebgridexcelexporter-export-more-than-65536-rows/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/14/ultrawebgridexcelexporter-export-more-than-65536-rows/</feedburner:origLink></item>
		<item>
		<title>(Possible) solution for MSChart ArgumentException The image is not found error</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/Xm8UTekwIWE/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/11/possible-solution-for-mschart-argumentexception-the-image-is-not-found-error/#comments</comments>
		<pubDate>Fri, 11 May 2012 21:59:10 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1876</guid>
		<description><![CDATA[If you&#8217;re using Microsoft&#8217;s .NET charting control on your ASP.NET pages you may receive an annoying error [ArgumentException]: The image is not found. at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.ProcessSavedChartImage(HttpContext context) at System.Web.UI.DataVisualization.Charting.ChartHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&#38; completedSynchronously) I could be intermittent, sometimes happen, sometimes not. In your web.config you already set your temp images to be [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using Microsoft&#8217;s .NET charting control on your ASP.NET pages you may receive an annoying error</p>
<p><span style="color: #ff0000">[ArgumentException]: The image is not found. at<br />
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.ProcessSavedChartImage(HttpContext context) at<br />
System.Web.UI.DataVisualization.Charting.ChartHttpHandler.System.Web.IHttpHandler.ProcessRequest(HttpContext context) at<br />
System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&amp; completedSynchronously)</span></p>
<p>I could be intermittent, sometimes happen, sometimes not. In your <code>web.config</code> you already set your temp images to be stored as files and not deleted after serving:</p>
<pre class="brush: xml; title: ; notranslate">&lt;add key=&quot;ChartImageHandler&quot; value=&quot;storage=file;timeout=20;url=~/temp/;deleteAfterServicing=false&quot; /&gt;</pre>
<p>as well as trying <a href="http://codecorner.galanter.net/2010/04/26/asp-net-chart-control-is-not-rendering-image/" title="ASP.NET Chart Control is not rendering image">other remedies</a> and nothing helps.</p>
<p>One possible solution is, while still using file temp storage, instead of indicating relative path via <code>url</code> property set it to absolute path via <code>dir</code> property:</p>
<pre class="brush: xml; title: ; notranslate">&lt;add key=&quot;ChartImageHandler&quot; value=&quot;storage=file;timeout=20;dir=C:\TEMP;deleteAfterServicing=false&quot; /&gt;</pre>
<p>In the example above <code>C:\TEMP</code> is an absolute path to the temp folder on the Web Server. In your case it could be different; in multi-server (WebFarm) environment it should be a network share, accessible by all servers.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/12/24/image-storage-location-chart35/" rel="bookmark" class="crp_title">Microsoft Chart for ASP.NET 3.5: Correctly setting image storage location</a></li><li><a href="http://CodeCorner.galanter.net/2011/08/24/solution-for-asp-net-access-to-temporary-folder-denied-error/" rel="bookmark" class="crp_title">Solution for ASP.NET access to temporary folder denied error</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/gc3NXROcSeF2HNjXSM2_b3f4RPA/0/da"><img src="http://feedads.g.doubleclick.net/~a/gc3NXROcSeF2HNjXSM2_b3f4RPA/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/gc3NXROcSeF2HNjXSM2_b3f4RPA/1/da"><img src="http://feedads.g.doubleclick.net/~a/gc3NXROcSeF2HNjXSM2_b3f4RPA/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/Xm8UTekwIWE" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/11/possible-solution-for-mschart-argumentexception-the-image-is-not-found-error/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/11/possible-solution-for-mschart-argumentexception-the-image-is-not-found-error/</feedburner:origLink></item>
		<item>
		<title>Select Distinct DataRows from ADO.NET DataTable using LINQ</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/X7OTjcKuEyg/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/11/select-distinct-datarows-from-ado-net-datatable-using-linq/#comments</comments>
		<pubDate>Fri, 11 May 2012 20:37:51 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[linq]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1872</guid>
		<description><![CDATA[If you&#8217;re trying to retrieve distinct rows from your ADO.NET data table using code like or You may find that rows that are being return are not unique. That&#8217;s because by default LINQ compares table rows by reference. If you need to compare by actual values &#8211; use DataRowComparer in Distinct method call: Related Posts:Group [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re trying to retrieve distinct rows from your ADO.NET data table using code like</p>
<pre class="brush: vb; title: ; notranslate">From oRow As DataRow In dtTable.Rows Select oRow Distinct</pre>
<p>or</p>
<pre class="brush: vb; title: ; notranslate">(From oRow As DataRow In dtTable.Rows Select oRow).Distinct()</pre>
<p>You may find that rows that are being return are not unique. That&#8217;s because by default LINQ compares table rows by reference. If you need to compare by actual values &#8211; use <code>DataRowComparer</code> in <code>Distinct</code> method call:</p>
<pre class="brush: vb; title: ; notranslate">(From oRow As DataRow In dtTable.Rows Select oRow).Distinct(DataRowComparer.Default)</pre>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/04/20/group-by-and-aggregates-in-net-datatable/" rel="bookmark" class="crp_title">Group By and Aggregates in .NET DataTable</a></li><li><a href="http://CodeCorner.galanter.net/2010/04/12/showing-all-filters-in-ultrawebgrid-with-paging/" rel="bookmark" class="crp_title">Showing ALL filters in UltraWebGrid with paging</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/VM4P1c0Aexk48Jvvb8Rl1QDPLCE/0/da"><img src="http://feedads.g.doubleclick.net/~a/VM4P1c0Aexk48Jvvb8Rl1QDPLCE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VM4P1c0Aexk48Jvvb8Rl1QDPLCE/1/da"><img src="http://feedads.g.doubleclick.net/~a/VM4P1c0Aexk48Jvvb8Rl1QDPLCE/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/X7OTjcKuEyg" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/11/select-distinct-datarows-from-ado-net-datatable-using-linq/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/11/select-distinct-datarows-from-ado-net-datatable-using-linq/</feedburner:origLink></item>
		<item>
		<title>GW BASIC in your browser!</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/FulsH50nlxQ/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/01/gw-basic-in-your-browser/#comments</comments>
		<pubDate>Tue, 01 May 2012 18:33:13 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[Humor]]></category>
		<category><![CDATA[New Stuff]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[leasure]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1869</guid>
		<description><![CDATA[Now this just bring a nostalgic tear to your eye. Cory Smith of AddressOf implemented Classic DOS GW BASIC entirely in Silverlight. It&#8217;s beautiful, give it a go! Related Posts:VB for AndroidVisual Basic FTW!]]></description>
			<content:encoded><![CDATA[<p><img src="http://kitchen.galanter.net/sitepic/GwBasicInBrowser.png" alt="Classic comes alive" /></p>
<p>Now this just bring a nostalgic tear to your eye. Cory Smith of AddressOf implemented Classic DOS GW BASIC entirely in Silverlight. It&#8217;s beautiful, give it a <a href="http://www.addressof.com/basic/" title="GW Basic, Silverlight 5 Edition" target="_blank">go</a>! </p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/11/29/vb-for-android/" rel="bookmark" class="crp_title">VB for Android</a></li><li><a href="http://CodeCorner.galanter.net/2012/01/23/visual-basic-ftw/" rel="bookmark" class="crp_title">Visual Basic FTW!</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/KBd4a4Jln48uFUK_yMQA0tkWi-4/0/da"><img src="http://feedads.g.doubleclick.net/~a/KBd4a4Jln48uFUK_yMQA0tkWi-4/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/KBd4a4Jln48uFUK_yMQA0tkWi-4/1/da"><img src="http://feedads.g.doubleclick.net/~a/KBd4a4Jln48uFUK_yMQA0tkWi-4/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/FulsH50nlxQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/01/gw-basic-in-your-browser/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/01/gw-basic-in-your-browser/</feedburner:origLink></item>
		<item>
		<title>‘this.Column.Band’ is null or not an object error in UltraWebGrid filtering</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/j7cN8jZMHbI/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/01/this-column-band-is-null-or-not-an-object-error-in-ultrawebgrid-filtering/#comments</comments>
		<pubDate>Tue, 01 May 2012 17:11:31 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Quick fix]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1864</guid>
		<description><![CDATA[When you filter Infragistics UltraWebGrid by clicking Filter icon in the column header &#8211; dropdown with filter values appears. Normally if you click elsewhere on the page &#8211; dropdown disappears. But sometimes it doesn&#8217;t, for example if you click an element that invokes a JavaScript function. Filter dropdown stays open and this could cause problems [...]]]></description>
			<content:encoded><![CDATA[<p>When you filter Infragistics UltraWebGrid by clicking Filter icon in the column header &#8211; dropdown with filter values appears. Normally if you click elsewhere on the page &#8211; dropdown disappears. But sometimes it doesn&#8217;t, for example if you click an element that invokes a JavaScript function. Filter dropdown stays open and this could cause problems &#8211; when grid refreshes (and possibly other actions are performed) error is thrown:</p>
<p><span style="color: #ff0000"><strong><em>&#8216;this.Column.Band&#8217; is null or not an object</em></strong></span></p>
<p>The solution to this is to close filter dropdown ourselves. Put these lines into your client-side code whenever clicking outside the filter doesn&#8217;t close it:</p>
<pre class="brush: jscript; title: ; notranslate">var aGridCols = igtbl_getGridById('xMyGrid').Bands[0].Columns
   for (var I = 0; I &lt; aGridCols.length; I++)
      aGridCols[I].showFilterDropDown(false);</pre>
<p>Here we&#8217;re looping thru grids column collection (This example assumes grid is in Flat or OutlookGroupBy mode, if your grid is hierarchical, you will have to loop thru band collection as well). For every column we pass <code>False</code> to <code>showFilterDropDown</code> method which (probably showing Infragistics cute sense of humor) hides filter dropdown if it is open. If dropdown is hidden for the column already &#8211; nothing happens. </p>
<p>As a result opened filter dropdown is now always closed prior to previously offending action and the error doesn&#8217;t happen.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/01/28/correcting-object-required-error-in-infragistics-getcontainer-function/" rel="bookmark" class="crp_title">Correcting &#8220;Object Required&#8221; error in Infragistics &#8220;this._getContainer=function()&#8221; internal code</a></li><li><a href="http://CodeCorner.galanter.net/2011/04/29/ssrs-how-to-implement-build-in-parameter-based-on-external-parameter-passed-from-reportviewer/" rel="bookmark" class="crp_title">SSRS: How to implement build-in parameter based on external parameter passed from ReportViewer</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/o1j_7T-pHUaQCqPsjabAPRuRv0o/0/da"><img src="http://feedads.g.doubleclick.net/~a/o1j_7T-pHUaQCqPsjabAPRuRv0o/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/o1j_7T-pHUaQCqPsjabAPRuRv0o/1/da"><img src="http://feedads.g.doubleclick.net/~a/o1j_7T-pHUaQCqPsjabAPRuRv0o/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/j7cN8jZMHbI" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/01/this-column-band-is-null-or-not-an-object-error-in-ultrawebgrid-filtering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/01/this-column-band-is-null-or-not-an-object-error-in-ultrawebgrid-filtering/</feedburner:origLink></item>
		<item>
		<title>Speed up UltraWebGrid rendering on rebind</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/_al3YeFrfmo/</link>
		<comments>http://CodeCorner.galanter.net/2012/05/01/speed-up-ultrawebgrid-rendering-on-rebind/#comments</comments>
		<pubDate>Tue, 01 May 2012 16:38:24 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[XML]]></category>
		<category><![CDATA[improve]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1860</guid>
		<description><![CDATA[If you&#8217;re using Infragistics UltraWebGrid with it&#8217;s property Browser="Xml", you may find yourself living in a shotgun shack in a strange situation: When grid is rebinding &#8211; it takes (comparatively) short time to do server-side processing and then a very long time to render grid in the browser. In my case it was most felt [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using Infragistics UltraWebGrid with it&#8217;s property <code>Browser="Xml"</code>, you may find yourself <del>living in a shotgun shack</del> in a strange situation: When grid is rebinding &#8211; it takes (comparatively) short time to do server-side processing and then a very long time to render grid in the browser.</p>
<p>In my case it was most felt when grid (which had <code>ViewType="OutlookGroupBy"</code>) was initially grouped with a lot of data in each group and then ungrouped back into flat view when user dragged last group column out. Using IE9 built-in developer tools I ran JavaScript profiler I found that culprit was Infragistics JS function &#8220;<code>disposeNode</code>&#8221; which was called numerous times and had worst both inclusive and exclusive execution time.<span id="more-1860"></span></p>
<p>Apparently what was happening &#8211; before bringing in fresh data grid was destroying all XML nodes of existing data, which &#8211; when grid is grouped with a lot of data in each group &#8211; is a lot of nodes. I decided to test what would happen if I destroy all top-level nodes in advance, so grid&#8217;s code won&#8217;t have to recursively loop through each one of them. I did this with just these 2 lines of JavaScript code:</p>
<pre class="brush: jscript; title: ; notranslate">var oGrid = igtbl_getGridById('xMyGrid');
if (oGrid) oGrid.Rows.SelectedNodes.removeAll();</pre>
<p>Basically here we get a reference to grid&#8217;s client-side object and clear all nodes associated with grid&#8217;s rows. My grid didn&#8217;t use it&#8217;s own AJAX &#8220;LoadOnDemand&#8221; features and was located inside of Infragistics WARP panel, so I put that code inside of WARP panel&#8217;s <code>RefreshRequest</code> event handler which is called before grid&#8217;s server-side rebind. Your setup may be different, but you just have to run these lines before grid gets new data.</p>
<p>Result: Rendering in the client almost 90% faster.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/07/27/solution-for-ultrawebgrid-missing-scrollbars/" rel="bookmark" class="crp_title">Solution for UltraWebGrid missing scrollbars</a></li><li><a href="http://CodeCorner.galanter.net/2012/02/21/speed-up-ultrawebgrid-with-direct-dom-access/" rel="bookmark" class="crp_title">Speed up UltraWebGrid with direct DOM access</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/TgMxgZmaM7jCl9qm0lZ1LhdBEzw/0/da"><img src="http://feedads.g.doubleclick.net/~a/TgMxgZmaM7jCl9qm0lZ1LhdBEzw/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/TgMxgZmaM7jCl9qm0lZ1LhdBEzw/1/da"><img src="http://feedads.g.doubleclick.net/~a/TgMxgZmaM7jCl9qm0lZ1LhdBEzw/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/_al3YeFrfmo" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/05/01/speed-up-ultrawebgrid-rendering-on-rebind/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/05/01/speed-up-ultrawebgrid-rendering-on-rebind/</feedburner:origLink></item>
		<item>
		<title>T-SQL String DeAggregate (Split, Ungroup) in SQL Server</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/d93q5AMHL3M/</link>
		<comments>http://CodeCorner.galanter.net/2012/04/25/t-sql-string-deaggregate-split-ungroup-in-sql-server/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 21:49:37 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[SQL]]></category>
		<category><![CDATA[cool]]></category>
		<category><![CDATA[Data]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1840</guid>
		<description><![CDATA[A while back I posted a simple way to aggregate strings in SQL Server, but what if your task is opposite &#8211; you have a character-separated string values in your fields and you need to slice them into separate rows? Consider following scenario, you have a table: That looks like this and now you need [...]]]></description>
			<content:encoded><![CDATA[<p>A while back I posted a simple way to <a href="http://codecorner.galanter.net/2009/06/25/t-sql-string-aggregate-in-sql-server/" title="T-SQL String Aggregate in SQL Server" target="_blank">aggregate strings in SQL Server</a>, but what if your task is opposite &#8211; you have a character-separated string values in your fields and you need to slice them into separate rows? Consider following scenario, you have a table:</p>
<pre class="brush: sql; title: ; notranslate">CREATE TABLE #Employees (Country varchar(50), FirstNames varchar(50))

INSERT INTO #Employees(Country,FirstNames)
	 VALUES ('UK','Anne,Michael,Robert,Steven')
INSERT INTO #Employees(Country,FirstNames)
     VALUES ('USA','Andrew,Janet,Laura,Margaret,Nancy')

SELECT Country, FirstNames FROM #Employees
</pre>
<p>That looks like this</p>
<pre class="brush: sql; title: ; notranslate">Country  FirstNames
UK       Anne,Michael,Robert,Steven
USA      Andrew,Janet,Laura,Margaret,Nancy</pre>
<p>and now you need to split <code>FirstNames</code> so that every <code>FirstName</code> is displayed on separate row.<span id="more-1840"></span><br />
First we need a function to split strings. There&#8217;re plenty solutions, for example you can use <a target="_blank" href="http://stackoverflow.com/questions/314824/t-sql-opposite-to-string-concatenation-how-to-split-string-into-multiple-reco#314917" title="TSQL Split String">one found by Cade Roux @ StackOverflow</a>:</p>
<pre class="brush: sql; title: ; notranslate">CREATE FUNCTION dbo.Split (@sep char(1), @s varchar(512))
RETURNS table
AS
RETURN (
    WITH Pieces(pn, start, stop) AS (
      SELECT 1, 1, CHARINDEX(@sep, @s)
      UNION ALL
      SELECT pn + 1, stop + 1, CHARINDEX(@sep, @s, stop + 1)
      FROM Pieces
      WHERE stop &gt; 0
    )
    SELECT pn,
      SUBSTRING(@s, start, CASE WHEN stop &gt; 0 THEN stop-start ELSE 512 END) AS s
    FROM Pieces
  )</pre>
<p>Once we have it, it&#8217;s only a matter of joining function results with remaining fields from the original table (Note <code>CROSS APPLY</code> statement &#8211; it will connect all split values to the original row):</p>
<pre class="brush: sql; title: ; notranslate">SELECT Country, S as FirstName FROM #Employees CROSS APPLY Split(',', FirstNames)</pre>
<p>The result is</p>
<pre class="brush: sql; title: ; notranslate">
Country FirstName
UK      Anne
UK      Michael
UK      Robert
UK      Steven
USA     Andrew
USA     Janet
USA     Laura
USA     Margaret
USA     Nancy</pre>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/06/25/t-sql-string-aggregate-in-sql-server/" rel="bookmark" class="crp_title">T-SQL String Aggregate in SQL Server</a></li><li><a href="http://CodeCorner.galanter.net/2011/06/02/string-aggregate-in-linq/" rel="bookmark" class="crp_title">String Aggregate in LINQ</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/0XEK_78gsrEU1Qeziu8OhRwj7Bs/0/da"><img src="http://feedads.g.doubleclick.net/~a/0XEK_78gsrEU1Qeziu8OhRwj7Bs/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/0XEK_78gsrEU1Qeziu8OhRwj7Bs/1/da"><img src="http://feedads.g.doubleclick.net/~a/0XEK_78gsrEU1Qeziu8OhRwj7Bs/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/d93q5AMHL3M" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/04/25/t-sql-string-deaggregate-split-ungroup-in-sql-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/04/25/t-sql-string-deaggregate-split-ungroup-in-sql-server/</feedburner:origLink></item>
		<item>
		<title>SSRS viewer doesn’t work on IIS7 64bit</title>
		<link>http://feedproxy.google.com/~r/galanter/CodeCorner/~3/QJFxdSlKRSQ/</link>
		<comments>http://CodeCorner.galanter.net/2012/04/19/ssrs-viewer-doesnt-work-on-iis7-64bit/#comments</comments>
		<pubDate>Thu, 19 Apr 2012 13:15:39 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[64bit]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[SSRS]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1838</guid>
		<description><![CDATA[If you&#8217;re developing an ASP.NET application that utilizes Microsoft&#8217;s SSRS ReportViewer control, you may experience a weird behavior while trying to use it on 64 bit version of IIS7 (Windows Server 2008 or Windows 7) &#8211; nothing is displayed in the main report area and even icons, such as Print, Export aren&#8217;t rendering. One possible [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re developing an ASP.NET application that utilizes Microsoft&#8217;s SSRS ReportViewer control, you may experience a weird behavior while trying to use it on 64 bit version of IIS7 (Windows Server 2008 or Windows 7) &#8211; nothing is displayed in the main report area and even icons, such as Print, Export aren&#8217;t rendering.</p>
<p>One possible cause for this &#8211; your application is using Application Pool with 32bit mode enabled. If so &#8211; disable it or switch to a different application pool. Chances are this will fix the above issue.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/08/13/error-using-crystal-reports-2008-in-asp-net-application-on-64bit-server/" rel="bookmark" class="crp_title">Error using Crystal Reports 2008 in ASP.NET application on 64bit server</a></li><li><a href="http://CodeCorner.galanter.net/2011/04/29/ssrs-how-to-implement-build-in-parameter-based-on-external-parameter-passed-from-reportviewer/" rel="bookmark" class="crp_title">SSRS: How to implement build-in parameter based on external parameter passed from ReportViewer</a></li></ul></div>
<p><a href="http://feedads.g.doubleclick.net/~a/XDF0AY6_I-f5NkPIsva0xL0ZnjI/0/da"><img src="http://feedads.g.doubleclick.net/~a/XDF0AY6_I-f5NkPIsva0xL0ZnjI/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/XDF0AY6_I-f5NkPIsva0xL0ZnjI/1/da"><img src="http://feedads.g.doubleclick.net/~a/XDF0AY6_I-f5NkPIsva0xL0ZnjI/1/di" border="0" ismap="true"></img></a></p><img src="http://feeds.feedburner.com/~r/galanter/CodeCorner/~4/QJFxdSlKRSQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/04/19/ssrs-viewer-doesnt-work-on-iis7-64bit/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://CodeCorner.galanter.net/2012/04/19/ssrs-viewer-doesnt-work-on-iis7-64bit/</feedburner:origLink></item>
	</channel>
</rss>

