<?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>Code Corner &#187; 3rd party</title>
	<atom:link href="http://CodeCorner.galanter.net/category/vbnet/aspnet/3rd-party/feed/" rel="self" type="application/rss+xml" />
	<link>http://CodeCorner.galanter.net</link>
	<description>ASP.NET, XML, SQL and Javascript tips and tricks</description>
	<lastBuildDate>Sun, 19 Feb 2012 03:04:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Shorten URL in HelloTXT WordPress plugin</title>
		<link>http://CodeCorner.galanter.net/2011/12/28/shorten-url-in-hellotxt-wordpress-plugin/</link>
		<comments>http://CodeCorner.galanter.net/2011/12/28/shorten-url-in-hellotxt-wordpress-plugin/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 03:24:22 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1566</guid>
		<description><![CDATA[HelloTXT is a very cool service that can post your updates to multiple social networks with a single click. You can feed it data in multiple ways from RSS feeds to Android phones. One such way is a small neat WordPress plugin by Matthew Phillips. Once installed in your blog it will ping HelloTXT whenever [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hellotxt.com/" title="HelloTXT" target="_blank">HelloTXT</a> is a very cool service that can post your updates to multiple social networks with a single click. You can feed it data in multiple ways from RSS feeds to Android phones. One such way is a small neat <a href="http://wordpress.org/extend/plugins/hellotxt/" title="HelloTXT WordPress plugin" target="_blank">WordPress plugin</a> by Matthew Phillips. Once installed in your blog it will ping HelloTXT whenever you write a new post, notifying all your connected services from Facebook to Twitter. </p>
<p>One small drawback of v1.0.1 of this plugin (current as of this writing) &#8211; if permalink URL of your post is very long (pretty ones tend to be) &#8211; it gets cut off during HelloTXT notification, since status update has to be within 140 characters length. But there&#8217;s an easy solution. Open PHP source of the plugin in any text editor and in <em>function hellotxt_notification</em> locate line:</p>
<pre class="brush: php; title: ; notranslate">$link = get_permalink($post-&gt;ID);</pre>
<p>This is the line that gets permalink of your post. To replace it with shortened URL we can call API of <a href="http://tinyurl.com/" title="Tiny URL" target="_blank">TinyURL</a> service:</p>
<pre class="brush: php; title: ; notranslate">$link = file_get_contents(&quot;http://tinyurl.com/api-create.php?url=&quot;.get_permalink($post-&gt;ID));</pre>
<p>and Voila! short links are being sent to HelloTXT</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/03/23/posting-from-hellotxt-to-custom-url/" rel="bookmark" class="crp_title">Posting from HELLOTXT to Custom URL</a></li><li><a href="http://CodeCorner.galanter.net/2011/03/10/fix-for-first-release-of-unique-article-wizard-multisite-wordpress-plugin/" rel="bookmark" class="crp_title">Fix for first release of Unique Article Wizard multisite WordPress plugin</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/12/28/shorten-url-in-hellotxt-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebHierarchicalDataGrid: Extra Row after Update</title>
		<link>http://CodeCorner.galanter.net/2011/10/12/webhierarchicaldatagrid-extra-row-after-update/</link>
		<comments>http://CodeCorner.galanter.net/2011/10/12/webhierarchicaldatagrid-extra-row-after-update/#comments</comments>
		<pubDate>Wed, 12 Oct 2011 20:40:47 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[New Stuff]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1447</guid>
		<description><![CDATA[If after upgrading to a new version of Infragistics NetAdvantage you suddenly found your WHDG sprouting an extra blank row on top: most likely it&#8217;s because grid&#8217;s ItemCssClass property is used. In theory (at least according to ever so verbose documentation) it should define what grid&#8217;s cells look like. In practice it have no effect [...]]]></description>
			<content:encoded><![CDATA[<p>If after <a href="http://codecorner.galanter.net/?s=Upgrade+Infragistics+11.1">upgrading to a new version of Infragistics NetAdvantage</a> you suddenly found your WHDG sprouting an extra blank row on top:</p>
<p><img src="http://kitchen.galanter.net/sitepic/whdg_extra_row.png" alt="Extra Row in Aikido WHDG" /></p>
<p>most likely it&#8217;s because grid&#8217;s <strong>ItemCssClass</strong> property is used. In theory (at least according to ever so verbose documentation) it should define what grid&#8217;s cells look like. In practice it have no effect whatsoever. Or rather had no effect until upgrade (verified in version 2011.1, perhaps even earlier). Now if your CSS class used in this property contains <strong>HEIGHT</strong> attribute &#8211; a blank row of that height will be inserted on top of the grid.</p>
<p>Solution? Remove <strong>ItemCssClass</strong> property. It&#8217;s useless anyway.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/" rel="bookmark" class="crp_title">WebDataMenu: Incorrect displaying after upgrade</a></li><li><a href="http://CodeCorner.galanter.net/2011/10/05/webhierarchicaldatagrid-javascript-errors-after-upgrade/" rel="bookmark" class="crp_title">WebHierarchicalDataGrid: JavaScript errors after upgrade</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/10/12/webhierarchicaldatagrid-extra-row-after-update/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebDataMenu: Incorrect displaying after upgrade</title>
		<link>http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/</link>
		<comments>http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/#comments</comments>
		<pubDate>Mon, 10 Oct 2011 13:55:05 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[New Stuff]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1436</guid>
		<description><![CDATA[This is the second post in saga titled Upgrading Infragistics Controls to a new version. Chances are that your WebDataMenu looks weird after upgrade to 2010+ version. In my case the menu had following options/features: It was a context popup menu, called on right mouse click Text of menu items was assigned dynamically at runtime [...]]]></description>
			<content:encoded><![CDATA[<p>This is the second post in saga titled <a href="http://codecorner.galanter.net/?s=Upgrade+Infragistics+11.1">Upgrading Infragistics Controls to a new version</a>. Chances are that your WebDataMenu looks weird after upgrade to 2010+ version. In my case the menu had following options/features:</p>
<ul>
<li>It was a context popup menu, called on right mouse click</li>
<li>Text of menu items was assigned dynamically at runtime in JavaScript Client code</li>
</ul>
<p>After upgrading NetAdvantage from version 2009.2 to 2011.1 strange things started to happen. Text of the menu items was cut short, submenues appeared at wrong places it looked like something from a Dali&#8217;s painting.<br />
Numerous experiments later I found out that the problem was with <strong>EnableScrolling</strong> property of the menu control. Setting it to <strong>False</strong> returned menu to realm of realism.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/07/21/infragistics-webdatamenu-expanding-context-menu-up/" rel="bookmark" class="crp_title">Infragistics WebDataMenu: Expanding context menu UP</a></li><li><a href="http://CodeCorner.galanter.net/2011/02/24/infragistics-webdatamenu-csom-additemremoveitem-workaround/" rel="bookmark" class="crp_title">Infragistics WebDataMenu CSOM addItem/removeItem workaround</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebHierarchicalDataGrid: JavaScript errors after upgrade</title>
		<link>http://CodeCorner.galanter.net/2011/10/05/webhierarchicaldatagrid-javascript-errors-after-upgrade/</link>
		<comments>http://CodeCorner.galanter.net/2011/10/05/webhierarchicaldatagrid-javascript-errors-after-upgrade/#comments</comments>
		<pubDate>Wed, 05 Oct 2011 21:26:07 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1430</guid>
		<description><![CDATA[Upgrading 3rd party library to a new version is bound to have problems and Infragistics is no exception. In my case I was upgrading NetAdvantage for ASP.NET from version 2009.2 to to 20011.1 and right away WebHierarchicalDataGrid started to crash client-side. If ScriptManager was in debug mode I&#8217;d get error: Microsoft JScript runtime error: Sys.ArgumentUndefinedException: [...]]]></description>
			<content:encoded><![CDATA[<p>Upgrading 3rd party library to a new version is bound to have problems and Infragistics is no exception. In my case I was upgrading NetAdvantage for ASP.NET from version 2009.2 to to 20011.1 and right away WebHierarchicalDataGrid started to crash client-side. If ScriptManager was in debug mode I&#8217;d get error:</p>
<p><span style="color: #ff0000"><em>Microsoft JScript runtime error: Sys.ArgumentUndefinedException: Value cannot be undefined.Parameter name: type</em></span></p>
<p>With ScriptManager in Release mode it&#8217;d be:</p>
<p><span style="color: #ff0000"><em>Microsoft JScript runtime error: Object expected</em></span></p>
<p>But always in <em>Sys.Component.Create</em> &#8211; it looked like grid&#8217;s client-side scripts weren&#8217;t loading at all. After A LOT of digging I found out that the culprit was grid&#8217;s server-side <strong>Bands.Clear()</strong> method. When called, it caused client-side WHDG JavaScript <strong>not to load</strong>. When that method was commented &#8211; JavaScript errors disappeared. So until Infragistics comes out with a bug fix &#8211; if you experience similar problem, try to avoid <strong>Bands.Clear()</strong> method.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2008/08/21/infragistics-ultrawebgrid-grouping-in-code-problem-solved/" rel="bookmark" class="crp_title">Infragistics UltraWebGrid grouping in code problem (solved)</a></li><li><a href="http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/" rel="bookmark" class="crp_title">WebDataMenu: Incorrect displaying after upgrade</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/10/05/webhierarchicaldatagrid-javascript-errors-after-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Solution for WordPress CURL IPv6 error &#8220;Network is unreachable&#8221;</title>
		<link>http://CodeCorner.galanter.net/2011/06/03/solution-for-wordpress-curl-ipv6-error-network-is-unreachable/</link>
		<comments>http://CodeCorner.galanter.net/2011/06/03/solution-for-wordpress-curl-ipv6-error-network-is-unreachable/#comments</comments>
		<pubDate>Fri, 03 Jun 2011 20:35:52 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1329</guid>
		<description><![CDATA[I am using FeedWordPress plugin on some of my sites to pull data from Google News RSS feeds. It was working fine, but after I moved to a new host, I started to get errors like: Failed to connect to 2a00:1450:8006::63: Network is unreachable Note the IPv6. Google have been supporting it for a while [...]]]></description>
			<content:encoded><![CDATA[<p>I am using <a href="http://feedwordpress.radgeek.com/">FeedWordPress</a> plugin on some of my sites to pull data from Google News RSS feeds. It was working fine, but after I moved to a new host, I started to get errors like:</p>
<p><span style="color: #ff0000;"><strong>Failed to connect to 2a00:1450:8006::63: Network is unreachable</strong></span></p>
<p>Note the IPv6. Google have been supporting it for a while and <strong>news.google.com</strong> resolves to IPv6 first (similar error happens in WordPress admin dashboard in &#8220;Incoming Links&#8221; section). Unfortunately network of my new host didn&#8217;t support IPv6, so I had to find solution to force WordPress to use IPv4. Enter <strong>class-http.php</strong>.<span id="more-1329"></span></p>
<p>Located in <strong>/wp-includes</strong> folder of your WordPress install this module is responsible for different aspects of HTTP communication. By default class <strong>WP_Http_Curl</strong> is used. If you open <strong>function request</strong> you will notice several CURL options bein set, e.g.:</p>
<pre class="brush: php; title: ; notranslate">curl_setopt( $handle, CURLOPT_URL, $url);
curl_setopt( $handle, CURLOPT_RETURNTRANSFER, true );
curl_setopt( $handle, CURLOPT_SSL_VERIFYHOST, $ssl_verify );
curl_setopt( $handle, CURLOPT_SSL_VERIFYPEER, $ssl_verify );
curl_setopt( $handle, CURLOPT_USERAGENT, $r['user-agent'] );
curl_setopt( $handle, CURLOPT_MAXREDIRS, $r['redirection'] );</pre>
<p>If you&#8217;re running PHP 5.3 and above &#8211; there&#8217;s an obvious solution, just add one more option to force IPv4 resolve:</p>
<pre class="brush: php; title: ; notranslate">curl_setopt( $handle, CURLOPT_IPRESOLVE, CURL_IPRESOLVE_V4);</pre>
<p>Unfortunately my host is running PHP 5.2 and there is a known bug about <a href="http://bugs.php.net/47739">missing cURL option do disable IPv6</a> in version prior to 5.3. <em>Thanks guys from Google IPv6 team for finding this, when I contacted them about my IPv6 issues with Google News, they responded to emails instantly, went above and beyond call of duty and I am sure they didn&#8217;t simple Google the answer.</em></p>
<p>So, the less obvious solution is to disable CURL altogether, forcing WordPress to use other means of HTTP transfers. The class has <strong>function test</strong> to see whether CURL can be used:</p>
<pre class="brush: php; title: ; notranslate">function test($args = array()) {
   if ( function_exists('curl_init') &amp;&amp; function_exists('curl_exec') )
      return apply_filters('use_curl_transport', true, $args);

   return false;
}</pre>
<p>Comment the fist 2 lines to make function always return <strong>false</strong>:</p>
<pre class="brush: php; title: ; notranslate">function test($args = array()) {
   //if ( function_exists('curl_init') &amp;&amp; function_exists('curl_exec') )
   //   return apply_filters('use_curl_transport', true, $args);

   return false;
}</pre>
<p>This will tell WordPress that CURL is not available making it switch to other HTTP means that are not forced to use IPv6.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2009/12/26/tnx-net-and-autoblogging-generate-steady-income/" rel="bookmark" class="crp_title">TNX.NET and autoblogging: Generate steady income</a></li><li><a href="http://CodeCorner.galanter.net/2009/12/11/wordpress-mu-delete-empty-posts/" rel="bookmark" class="crp_title">WordPress MU: Delete Empty Posts</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/06/03/solution-for-wordpress-curl-ipv6-error-network-is-unreachable/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Error using Crystal Reports 2008 in ASP.NET application on 64bit server</title>
		<link>http://CodeCorner.galanter.net/2010/08/13/error-using-crystal-reports-2008-in-asp-net-application-on-64bit-server/</link>
		<comments>http://CodeCorner.galanter.net/2010/08/13/error-using-crystal-reports-2008-in-asp-net-application-on-64bit-server/#comments</comments>
		<pubDate>Fri, 13 Aug 2010 13:27:01 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[dotnet]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Quick fix]]></category>
		<category><![CDATA[reporting]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1023</guid>
		<description><![CDATA[If you&#8217;re using Crystal Reports 2008 in your ASP.NET application, and after deploying to a 64bit server getting following error: An error has occurred while attempting to load the Crystal Reports runtime. Either the Crystal Reports registry key permissions are insufficient, or the Crystal Reports runtime is not installed correctly. Please install the appropriate Crystal [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re using Crystal Reports 2008 in your ASP.NET application, and after deploying to a 64bit server getting following error:</p>
<p><em><span style="color: #ff0000;">An error has occurred while attempting to load the Crystal Reports runtime. Either the Crystal Reports registry key permissions are insufficient, or the Crystal Reports runtime is not installed correctly. Please install the appropriate Crystal Reports redistributable (CRRedist*.msi) containing the correct version of the Crystal Reports runtime (x86, x64, or Itanium) required. Please go to http://www.businessobjects.com/support for more information.</span></em></p>
<p>then switch your application to 32bit mode. In case of Windows 2003/IIS6 entire server will have to be switched, in case of Windows 2008/IIS7 a dedicated 32bit application pool can be established for your application.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2008/05/07/dynamic-number-of-fields-in-a-query-for-ssrs-2005/" rel="bookmark" class="crp_title">Dynamic number of fields in a query for SSRS 2005</a></li><li><a href="http://CodeCorner.galanter.net/2011/07/27/solution-for-oraoledb-oracle-provider-is-not-registered-error/" rel="bookmark" class="crp_title">Solution for &#8220;OraOLEDB.Oracle Provider is not registered&#8221; error</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2010/08/13/error-using-crystal-reports-2008-in-asp-net-application-on-64bit-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>PHPBB: Update template file by purging cache</title>
		<link>http://CodeCorner.galanter.net/2010/01/05/phpbb-update-template-file-by-purging-cache/</link>
		<comments>http://CodeCorner.galanter.net/2010/01/05/phpbb-update-template-file-by-purging-cache/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 22:17:58 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[forum]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[phpbb]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=815</guid>
		<description><![CDATA[Scenario: You&#8217;re trying to update a template file in your PHPBB 3.0.x forum, for example to include Google Adsense code into overall_header.html file to display banner on top of all the pages. But after modifying and uploading the file nothing changes, board still displays old template. What is happening &#8211; PHPBB displays cached version of [...]]]></description>
			<content:encoded><![CDATA[<p>Scenario: You&#8217;re trying to update a template file in your PHPBB 3.0.x forum, for example to include Google Adsense code into <strong>overall_header.html</strong> file to display banner on top of all the pages. But after modifying and uploading the file nothing changes, board still displays old template.</p>
<p>What is happening &#8211; PHPBB displays cached version of the template. Forum software caches commonly used files to improve performance. The solution is to purge cache.<br />
<img src="http://www.galanter.net/sitepic/phpbbpurgecache.png" alt="Purgin Cache in PHPBB 3.0.x board" /><br />
Login to your forum Administration Control Panel and click <strong>Run Now</strong> in <strong>Purge the cache</strong> section. After purging is complete changes in your template take effect.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2012/01/11/ics-android-4-on-kindle-fire/" rel="bookmark" class="crp_title">ICS: Android 4 on Kindle Fire</a></li><li><a href="http://CodeCorner.galanter.net/2009/05/14/aspnet-accessing-session-variables-in-class-modules/" rel="bookmark" class="crp_title">ASP.NET accessing session variables in class modules</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2010/01/05/phpbb-update-template-file-by-purging-cache/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Injecting client script into Infragistics async postback</title>
		<link>http://CodeCorner.galanter.net/2009/07/28/injecting-client-script-into-infragistics-async-postback/</link>
		<comments>http://CodeCorner.galanter.net/2009/07/28/injecting-client-script-into-infragistics-async-postback/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:16:48 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=381</guid>
		<description><![CDATA[Often there is a need to add client-side Javascript to the ASP.NET page from server-side code. To perform additional manipulation on rendered controls (hide or disable), to show user an alert message &#8211; just a couple of examples. Standard ASP.NET approach is to use page&#8217;s client script manager&#8217;s  RegisterStartupScript method: Where type: The type of [...]]]></description>
			<content:encoded><![CDATA[<p>Often there is a need to add client-side Javascript to the ASP.NET page from server-side code. To perform additional manipulation on rendered controls (hide or disable), to show user an alert message &#8211; just a couple of examples. Standard ASP.NET approach is to use page&#8217;s client script manager&#8217;s  <em>RegisterStartupScript</em> method:</p>
<pre class="brush: vb; title: ; notranslate">Me.ClientScript.RegisterStartupScript (Type,  Key,  Script, AddScriptTags)</pre>
<p>Where</p>
<p><em>type</em>: The type of the startup script to register.<br />
<em>key</em>: The key of the startup script to register.<br />
<em>script</em>: The startup script literal to register.<br />
<em>addScriptTags</em>: A Boolean value indicating whether to add script tags.</p>
<p>For example:</p>
<pre class="brush: vb; title: ; notranslate">Me.ClientScript.RegisterStartupScript (Me.GetType(), &quot;alert&quot;, &quot;alert('Hello world!');&quot;, True)</pre>
<p>But if you&#8217;re using Infragistics controls that offer async postbacks, like WARP panel or UltraWebTab &#8211; there is a problem with this approach.  Since the page doesn&#8217;t go through the full postback and doesn&#8217;t get destroyed and re-rendered from scratch &#8211; this method doesn&#8217;t work.<span id="more-381"></span></p>
<p>One approach is to create a literal control (either static in ASPX markup or dynamic thru code) and assign it the code that needs to be executed on the client:</p>
<pre class="brush: vb; title: ; notranslate">xltScript.text = &quot;&lt;script type='text/javascript'&gt;alert('Hello world!');&lt;/script&gt;&quot;</pre>
<p>It works, but it can become messy and hard to maintain.  A much better approach is to use Infragistic&#8217;s CallBackManager&#8217;s <em>AddScriptBlock </em>method:</p>
<pre class="brush: vb; title: ; notranslate">AddScriptBlock(page, ownerOfAsyncPostBack, javaScript)</pre>
<p>Where</p>
<p><em>page</em>: Reference to Page.<br />
<em>ownerOfAsyncPostBack</em>: Control, caused async postback. If that parameter is Nothing, then script is added regardless of the owner of postback.<br />
<em>javaScript</em>: Javascript statements.</p>
<p>For example:</p>
<pre class="brush: vb; title: ; notranslate">Infragistics.WebUI.Shared.CallBackManager.AddScriptBlock(Me, Nothing, &quot;alert('Hello World!');&quot;)</pre>
<p>To make it universal we can combine both original ASP.NET approach for full postback and the Infragistics method for async postback into a single function:</p>
<pre class="brush: vb; title: ; notranslate">Public Sub RunJavascript(ByVal i_oPage As Page, ByVal i_sJScode As String)
   If Infragistics.WebUI.Shared.CallBackManager.IsAsyncPostBack(i_oPage) Then
      Infragistics.WebUI.Shared.CallBackManager.AddScriptBlock(i_oPage, Nothing, i_sJScode)
   Else
      i_oPage.ClientScript.RegisterStartupScript(i_oPage.GetType, &quot;JSCode&quot; &amp; Rnd(1).ToString, i_sJScode, True)
   End If
End Sub</pre>
<p>Here, the function <em>RunJavascript</em> (which can reside in a standalone class, separate from the page) accepts 2 parameters: the reference to ASP.NET page and the string with JavaScript statements. First it checks whether the page is in async postback mode (Line 2, <em>IsAsyncPostBack</em> method) and if so &#8211; performs Infragistics <em>AddScriptBlock</em> method. Otherwise it peforms standard ASP.NET <em>RegisterStartupScript</em> method (note randomizer used for the key parameter, this is done so if you call this method several times in a row, all JavaScript statements will added, otherwise only the last one will remain).</p>
<p>Therefore we combine examples from above into a single call:</p>
<pre class="brush: vb; title: ; notranslate">RunJavascript(Me, &quot;alert('Hello world!');&quot;)</pre>
<p>and the JavaScript code will be added to the page no matter whether it is first load, full postback or Infragistics async postback. Don&#8217;t forget to add semicolumn at the end of your JavaScript statement, in case more statements are added later on (otherwise you may get a syntax error when client script tries to execute).</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/2011/11/08/clientscript-registerstartupscript-script-injected-but-not-executed/" rel="bookmark" class="crp_title">ClientScript.RegisterStartupScript: script injected, but not executed</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2009/07/28/injecting-client-script-into-infragistics-async-postback/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Infragistics WebDataMenu: Expanding context menu UP</title>
		<link>http://CodeCorner.galanter.net/2009/07/21/infragistics-webdatamenu-expanding-context-menu-up/</link>
		<comments>http://CodeCorner.galanter.net/2009/07/21/infragistics-webdatamenu-expanding-context-menu-up/#comments</comments>
		<pubDate>Tue, 21 Jul 2009 21:08:15 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[New Stuff]]></category>
		<category><![CDATA[Quick fix]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=371</guid>
		<description><![CDATA[Infragistics WebDataMenu is a light-weight highly responsive menu control with rich server and clinet side model. I was using it to display context menu on right mouse click.  The code is pretty simple: It checks whether the right mouse button was clicked (line 2) then locates the menu object and shows it using showAt method (which [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.infragistics.com/dotnet/netadvantage/aspnet/webdatamenu.aspx" target="_blank">Infragistics WebDataMenu</a> is a light-weight highly responsive menu control with rich server and clinet side model. I was using it to display context menu on right mouse click.  The code is pretty simple:</p>
<pre class="brush: jscript; title: ; notranslate">function onMouseClick(oEvent) {
   if (oEvent.button == 2) { //right mouse button clicked
      var menu = $find(&quot;xwdmMyMenu&quot;);
      menu.showAt(null,null, oEvent);
   }
}</pre>
<p>It checks whether the right mouse button was clicked (line 2) then locates the menu object and shows it using <strong>showAt</strong> method (which accepts 3 parameters, either X and Y client coordinates, or event object from which it derives coordinates of the mouse click).</p>
<p> It&#8217;s all well and good, but the problem is &#8211; menu always shows <em>down</em> from the location of the mouse click. And if the click is at the bottom of the screen &#8211; menu gets cut off:</p>
<p><img style="border: black 1px solid" src="http://www.galanter.net/sitepic/menu1.png" alt="" /></p>
<p>I needed to make menu expand UP and  couldn&#8217;t find a build-in property or method that would change this behaviour (<em>GroupSettings.ExpandDirection</em> property had no effect). Time for a little hack. <span id="more-371"></span> Well, not really a hack since it is used standard public properties and methods. The solution is to shift menu location up by the hight of the menu element:
<pre class="brush: jscript; title: ; notranslate">function onMouseClick(oEvent) {
   if (oEvent.button == 2) { //right mouse button clicked
      var menu = $find(&quot;xwdmMyMenu&quot;);
      menu.showAt(oEvent.clientX, oEvent.clientY - menu.get_element().clientHeight, null);
   }
}</pre>
<p>This approach uses second variation of the <strong>showAt</strong> method that accepts X and Y coorinates. for X it takes clientX cooridnate of the mouse click. And for Y it takes clientY coordinate of the mouse click <em>less hight of the menu element</em>. Which creates the appearance of menu expanding up:</p>
<p><img style="border: black 1px solid" src="http://www.galanter.net/sitepic/menu2.png" alt="" /></p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/10/10/webdatamenu-incorrect-displaying-after-upgrade/" rel="bookmark" class="crp_title">WebDataMenu: Incorrect displaying after upgrade</a></li><li><a href="http://CodeCorner.galanter.net/2011/02/24/infragistics-webdatamenu-csom-additemremoveitem-workaround/" rel="bookmark" class="crp_title">Infragistics WebDataMenu CSOM addItem/removeItem workaround</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2009/07/21/infragistics-webdatamenu-expanding-context-menu-up/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Infragistics Drag and Drop: detecting element during drag</title>
		<link>http://CodeCorner.galanter.net/2009/07/13/infragistics-drag-and-drop-detecting-element-during-drag/</link>
		<comments>http://CodeCorner.galanter.net/2009/07/13/infragistics-drag-and-drop-detecting-element-during-drag/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 21:18:41 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[3rd party]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[New Stuff]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=344</guid>
		<description><![CDATA[I was using Infragistics drag-and-drop framework and set an HTML table element as my drop target. Now I needed to know during drag operation over which HTML table cell I am moving. I needed that in order to dynamically change appearance of draggable markup depending on which cell I am currently over. (Think a strategy game [...]]]></description>
			<content:encoded><![CDATA[<p>I was using <a href="http://www.infragistics.com/dotnet/netadvantage/aspnet/dragdrop.aspx" target="_blank">Infragistics drag-and-drop framework</a> and set an HTML table element as my drop target. Now I needed to know during drag operation over which HTML table cell I am moving. I needed that in order to dynamically change appearance of draggable markup depending on which cell I am currently over.</p>
<p><img src="http://codecorner.galanter.net/sitepic/r1.png" alt="" /><br />
<img src="http://codecorner.galanter.net/sitepic/g1.png" alt="" /><br />
(Think a strategy game &#8211; you&#8217;re placing construction on the terrain &#8211; if there is enough unoccupied room &#8211; the draggable item becomes green, otherwise it remains red).</p>
<p>The solution is to use <strong>elemAtPoint</strong> property during<strong> DragMoveHandler</strong> event.<span id="more-344"></span> Register the event handler during page load:</p>
<pre class="brush: jscript; title: ; notranslate">var g_ddb; //drag and drop behaviour

function pageLoad(sender, args) {
//attachng drag-move event handler
g_ddb.get_events().addDragMoveHandler(dragMoveHandler);
//some other initialization code
//...
}</pre>
<p>and then during the drag operation when this handler is called &#8211; use <strong>elemAtPoint</strong> property to retreive HTML element:</p>
<pre class="brush: jscript; title: ; notranslate">function dragMoveHandler(sender, args) {
//getting element over which drag move is happening
var oEl = args.get_manager()._currentTarget.elemAtPoint;
//using that element
//...
}</pre>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/10/30/webdatagrid-custom-drag-and-drop-columns/" rel="bookmark" class="crp_title">WebDataGrid: Custom drag and drop columns when Colum Moving behavior is enabled</a></li><li><a href="http://CodeCorner.galanter.net/2009/08/12/running-server-generated-javascript-from-client-page-load-event/" rel="bookmark" class="crp_title">Running server-generated JavaScript from client Page Load event</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2009/07/13/infragistics-drag-and-drop-detecting-element-during-drag/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

