<?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; ASP.NET</title>
	<atom:link href="http://CodeCorner.galanter.net/category/vbnet/aspnet/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>Style Rounded Corner images of UltraWebTab thru external stylesheet</title>
		<link>http://CodeCorner.galanter.net/2012/02/17/style-rounded-corner-images-of-ultrawebtab-thru-external-stylesheet/</link>
		<comments>http://CodeCorner.galanter.net/2012/02/17/style-rounded-corner-images-of-ultrawebtab-thru-external-stylesheet/#comments</comments>
		<pubDate>Fri, 17 Feb 2012 17:21:08 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[style]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1660</guid>
		<description><![CDATA[Infragistics UltraWebTab control offers multiple styling options, many of them can be set via external CSS classes. As a matter of fact about only element you cannot style via external stylesheet is rounded corner images. Or can you? By default images used to give the tabs rounded-corner look are referenced directly in UltraWebTab ASPX markup: [...]]]></description>
			<content:encoded><![CDATA[<p>Infragistics UltraWebTab control offers multiple styling options, many of them can be set via external CSS classes. As a matter of fact about only element you cannot style via external stylesheet is rounded corner images. Or can you?</p>
<p>By default images used to give the tabs rounded-corner look are referenced directly in UltraWebTab ASPX markup:</p>
<pre class="brush: xml; title: ; notranslate">&lt;RoundedImage
   SelectedImage=&quot;./images/ig_tab_selected.jpg&quot;
   NormalImage=&quot;./images/ig_tab_normal.gif&quot;
   HoverImage=&quot;./images/ig_tab_hover.jpg&quot;
   FillStyle=&quot;LeftMergedWithCenter&quot;&gt;
&lt;/RoundedImage&gt;</pre>
<p>So, for example if SelectedImage looks like this:</p>
<p><img src="http://kitchen.galanter.net/sitepic/tab_template_image.jpg" alt="Default Selected Image of UltraWebTab" /></p>
<p>It will give your tab appearance like this</p>
<p><img src="http://kitchen.galanter.net/sitepic/Tab_Original_Image.png" alt="Selected Image of UltraWebTab in action" /></p>
<p>Let&#8217;s examine it closer.<span id="more-1660"></span> If your look in browser at rendered HTML of this tab it looks like this (I&#8217;ve removed some attributes to simplify view):</p>
<pre class="brush: xml; title: ; notranslate">&lt;TD class=xuwtHome_2&gt;My Test Tab&lt;/TD&gt;
&lt;TD width=&quot;5&quot; class=xuwtHome_2R&gt;&amp;nbsp;&lt;/TD&gt;
</pre>
<p>Where</p>
<pre class="brush: css; title: ; notranslate">.xuwtHome_2 {
   BACKGROUND: url(./images/ig_tab_selected.jpg) no-repeat left top;
}

.xuwtHome_2R {
   BACKGROUND: url(./images/ig_tab_selected.jpg) no-repeat right top;
}
</pre>
<p>So in reality tab consists of 2 <em>TD</em> elements: First one, on the left, takes the left part of the image as a background; Second on the right &#8211; small &#8220;rounded&#8221; part from the right part of the image (in this case 5 pixels, see <em>TD</em>&#8216;s <em>WIDTH</em> atribute)</p>
<p><img src="http://kitchen.galanter.net/sitepic/Tab_Explained_Image.png" alt="Selected Image of UltraWebTab Explained" /></p>
<p>Knowing this we can now model our CSS class to reference and render rounder corner image:</p>
<pre class="brush: css; title: ; notranslate">.TabStyleSelected /* Style of left TD. Add font and other styles for tab title */
{
   background-image: url(&quot;./images/ig_tab_selected.jpg&quot;) !important;
}

.TabStyleSelected + td /* Style of right TD. Width from width of right rounded part */
{
   background-image: url(&quot;./images/ig_tab_selected.jpg&quot;) !important;
   width:5px !important;
}</pre>
<p>Note &#8220;+&#8221; CSS selector on <em>Line 6</em>. It tells browser to apply this style to next sibling TD element (in our case right TD) of the element to which original style is applied (in our case left TD element). Also note &#8220;width&#8221; attribute on <em>Line 9</em>. It is the width of right &#8220;rounded&#8221; part of the image. If your image is different and rounded part takes more/less &#8211; adjust this value accordingly.</p>
<p>After the style is set like this it just a matter of assigning class to tab element(s). If you want to make this style default for all tabs &#8211; use <em>SelectedTabStyle</em> element:</p>
<pre class="brush: xml; title: ; notranslate">&lt;SelectedTabStyle CssClass=&quot;TabStyleSelected&quot;/&gt;</pre>
<p>If you want to apply separate round corner styles to individual tabs (which was not possible originally with round corner images <del>set in stone</del> set in ASPX markup) you can do that as well:</p>
<pre class="brush: xml; title: ; notranslate">&lt;igtab:Tab&gt;
   &lt;SelectedStyle CssClass=&quot;TabStyleSelected&quot; /&gt;
&lt;/igtab:Tab&gt;</pre>
<p>Or even do it programmaticaly</p>
<pre class="brush: vb; title: ; notranslate">oTabControl.SelectedStyle.CssClass = &quot;TabStyleSelected&quot;</pre>
<p>Similar approach can be used to define &#8220;normal&#8221; and hover tab styles and if you need to change rounded styles (either globally, or per tab) no need to change ASPX markup, no need to rename original images or paste your images over original, just create new images and reference them in the stylesheet.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2008/01/30/removechild-and-ssl-and-infragistics-webhtmleditor/" rel="bookmark" class="crp_title">removeChild, SSL and Infragistics WebHtmlEditor</a></li><li><a href="http://CodeCorner.galanter.net/2009/08/13/easy-rounded-corners-in-pure-htmlcss/" rel="bookmark" class="crp_title">Easy rounded corners in pure HTML/CSS</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/02/17/style-rounded-corner-images-of-ultrawebtab-thru-external-stylesheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Correctly apply external styles to UltraWebGrid</title>
		<link>http://CodeCorner.galanter.net/2012/02/09/correctly-apply-external-styles-to-ultrawebgrid/</link>
		<comments>http://CodeCorner.galanter.net/2012/02/09/correctly-apply-external-styles-to-ultrawebgrid/#comments</comments>
		<pubDate>Thu, 09 Feb 2012 22:44:24 +0000</pubDate>
		<dc:creator>yomgal</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1647</guid>
		<description><![CDATA[Classic Infragistics UltraWebGrid allows you to programmaticaly specify CSS styles for its various elements. For example code like this: Would set style of grid header and rows via external CSS class. You would expect that simple defining classes like this: should do the trick, but you may experience some unwanted, erratic behavior: styles getting lost, [...]]]></description>
			<content:encoded><![CDATA[<p>Classic Infragistics UltraWebGrid allows you to programmaticaly specify CSS styles for its various elements. For example code like this:</p>
<pre class="brush: vb; title: ; notranslate">xmyGrid.DisplayLayout.HeaderStyleDefault.CssClass = &quot;HeaderStyle&quot;
xmyGrid.DisplayLayout.RowStyleDefault.CssClass = &quot;RowStyle&quot;</pre>
<p>Would set style of grid header and rows via external CSS class. You would expect that simple defining classes like this:</p>
<pre class="brush: css; title: ; notranslate">.HeaderStyle {  /* style definition goes here */ }
.RowStyle {  /* style definition goes here */ }</pre>
<p>should do the trick, but you may experience some unwanted, erratic behavior: styles getting lost, styles getting mixed up (row would get a header style and vise versa).</p>
<p>To fix this we should let grid know that header style should apply only to header row (THEAD/TH HTML elements) and row style applies only to rows with data (TBODY/TD elements). This is done via slight adjustments of the above CSS to point it to specific elements:</p>
<pre class="brush: css; title: ; notranslate">THEAD.HeaderStyle TR TH{  /* style definition goes here */ }
TBODY.RowStyle TR TD {  /* style definition goes here */ }</pre>
<p>This way there&#8217;s no confusion, styles apply exactly were they belong. Also you may need to set grids <em>MergeStyles</em> property to <em>False</em> and make each class fully define it&#8217;s element (including fonts, colors, backgrounds etc.)</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2012/02/17/style-rounded-corner-images-of-ultrawebtab-thru-external-stylesheet/" rel="bookmark" class="crp_title">Style Rounded Corner images of UltraWebTab thru external stylesheet</a></li><li><a href="http://CodeCorner.galanter.net/2010/08/09/ultrawebgrid-highlight-row-on-mouseover-with-selection-enabled/" rel="bookmark" class="crp_title">Ultrawebgrid: Highlight row on MouseOver with Selection enabled</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/02/09/correctly-apply-external-styles-to-ultrawebgrid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UltraWebGrid TopItemSpacing=&#8221;Auto&#8221;: Solution for FireFox</title>
		<link>http://CodeCorner.galanter.net/2012/01/12/ultrawebgrid-topitemspacing-auto-solution-for-firefox/</link>
		<comments>http://CodeCorner.galanter.net/2012/01/12/ultrawebgrid-topitemspacing-auto-solution-for-firefox/#comments</comments>
		<pubDate>Thu, 12 Jan 2012 21:46:40 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[style]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1621</guid>
		<description><![CDATA[If you&#8217;re still using classic Infragistics Controls and want to make them work in modern browsers, sometimes a little additional work is required. Hopefully this little trick will save you some time. UltraWebGrid has a neat property TopItemSpacing, when set to Auto it automatically spreads top level menu items across the menu control, giving them [...]]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;re still using classic Infragistics Controls and want to make them work in modern browsers, sometimes a little additional work is required. Hopefully this little trick will save you some time.</p>
<p>UltraWebGrid has a neat property <em>TopItemSpacing</em>, when set to <em>Auto</em> it automatically spreads top level menu items across the menu control, giving them nice spacing in between. Unfortunately this property seems to work in Internet Explorer only, in Firefox (and Chrome and etc.) it is ignored, rendering menu in <em>Compact</em> mode giving top level items crowded &#8220;too-close-for-comfort&#8221; look.</p>
<p>The solution is to take spacing in our own hands. Set <em>TopItemSpacing</em> to <em>Compact</em> and instead add right padding to <em>TopLevelParentItemStyle</em> and <em>TopLevelLeafItemStyle</em> elements of the menu. For example (from the markup point of view):</p>
<pre class="brush: xml; highlight: [2]; title: ; notranslate">&lt;TopLevelLeafItemStyle Cursor=&quot;Hand&quot; Height=&quot;18px&quot; BorderWidth=&quot;1px&quot; Font-Size=&quot;8pt&quot;&gt;
   &lt;Padding Right=&quot;6px&quot; /&gt;
&lt;/TopLevelLeafItemStyle&gt;</pre>
<p>Actual pixel value of the padding is up to your particular scenario, but the final result is top level menu items will be nicely spaced both in IE and in Firefox.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2011/12/06/ultrawebmenu-when-background-doesnt-change-on-hover/" rel="bookmark" class="crp_title">UltraWebMenu: When background doesn&#8217;t change on hover in IE9</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/2012/01/12/ultrawebgrid-topitemspacing-auto-solution-for-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to add threshold line to MSChart in ASP.NET</title>
		<link>http://CodeCorner.galanter.net/2012/01/10/how-to-add-threshold-line-to-mschart-in-asp-net/</link>
		<comments>http://CodeCorner.galanter.net/2012/01/10/how-to-add-threshold-line-to-mschart-in-asp-net/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 20:35:19 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1601</guid>
		<description><![CDATA[Often, when drawing a chart, there&#8217;s a need to show a threshold &#8211; basically a line that indicates whether your values are going above or below it. Take for example this ColumnChart: Let&#8217;s say we need to show a threshold for the value of 7. Here&#8217;s how. MSChart API supports several Annotation objects, we&#8217;re interested [...]]]></description>
			<content:encoded><![CDATA[<p>Often, when drawing a chart, there&#8217;s a need to show a <em>threshold</em> &#8211; basically a line that indicates whether your values are going above or below it. Take for example this ColumnChart:</p>
<p><img src="http://kitchen.galanter.net/sitepic/ChartWithoutThreshold.png" alt="Chart Without Threshold" /></p>
<p>Let&#8217;s say we need to show a threshold for the value of 7. Here&#8217;s how.<span id="more-1601"></span> </p>
<p>MSChart API supports several <em>Annotation</em> objects, we&#8217;re interested in <em>HorizontalLineAnnotation</em>. Take a look at the following code:</p>
<pre class="brush: vb; title: ; notranslate">Dim oHla As New HorizontalLineAnnotation()

With oHla

    .AxisX = xmsChart.ChartAreas(0).AxisX
    .AxisY = xmsChart.ChartAreas(0).AxisY
    .ClipToChartArea = xmsChart.ChartAreas(0).Name
    .IsInfinitive = True

    .AnchorY = 7
    .LineWidth = 3
    .LineColor = Drawing.Color.Red
    .LineDashStyle = ChartDashStyle.Dot

End With

xmsChart.Annotations.Add(oHla)</pre>
<ul>
<li><em>Line 1</em> creates HorizontalLineAnnotation object</li>
<li><em>Lines 5, 6, 7</em> assocciate the annotation with chart area</li>
<li><em>Line 8</em> makes sure that annotation line stretches thru entire chart</li>
<li><em>Line 10</em> assigns our threshold value</li>
<li><em>Lines 11, 12, 13</em> set the style of the annotation line</li>
<li><em>Line 17</em> adds annotation we created to the chart</li>
</ul>
<p>The result:</p>
<p><img src="http://kitchen.galanter.net/sitepic/ChartWithThreshold.png" alt="Chart With Threshold" /></p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/01/06/serving-mschart-via-webservice/" rel="bookmark" class="crp_title">Serving image from ASP.NET MSChart to external applications via WebService</a></li><li><a href="http://CodeCorner.galanter.net/2009/05/19/global-chart-type-for-dundas-chart-control/" rel="bookmark" class="crp_title">Global Chart Type for Dundas Chart Control</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/01/10/how-to-add-threshold-line-to-mschart-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WebDataGrid: Prevent scrolling on row selection</title>
		<link>http://CodeCorner.galanter.net/2012/01/09/webdatagrid-prevent-scrolling-on-row-selection/</link>
		<comments>http://CodeCorner.galanter.net/2012/01/09/webdatagrid-prevent-scrolling-on-row-selection/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 20:39:14 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1592</guid>
		<description><![CDATA[If you working with Infragistics Aikido controls and your WebDataGrid or WHDG is too long &#8211; a common approach to make content scrollable is to place grid control inside of a DIV with fixed dimensions and overflow set to auto: It works fine, but there&#8217;s one drawback: if you scroll your grid horizontally and then [...]]]></description>
			<content:encoded><![CDATA[<p>If you working with Infragistics Aikido controls and your WebDataGrid or WHDG is too long &#8211; a common approach to make content scrollable is to place grid control inside of a DIV with fixed dimensions and overflow set to auto:</p>
<p><img src="http://kitchen.galanter.net/sitepic/ScrollableGrid.png" alt="WHDG scrollable inside of parent DIV" /></p>
<p>It works fine, but there&#8217;s one drawback: if you scroll your grid horizontally and then select a row &#8211; grid&#8217;s scroll position snaps back to the leftmost position. Infragistics says that it&#8217;s a browser bug and we need to talk to browser vendor about it. Wanting to solve the problem in this century I looked for alternatives and this is what I found.<span id="more-1592"></span></p>
<p>To avoid the shift in scroll position we need to cancel the scroll event. Doing it directly (adding handler to &#8220;onscroll&#8221; event and canceling it there) is impossible since event is uncancelable (is it even a word?). Instead we can catch grid&#8217;s &#8220;RowSelectionChanging&#8221; event and cancel event bubble there:</p>
<pre class="brush: jscript; title: ; notranslate">function xMyGrid_RowSelectionChanging(sender, eventArgs) {
   event.cancelBubble = true
}</pre>
<p>of course a better, more compatible approach would be:</p>
<pre class="brush: jscript; title: ; notranslate">function xMyGrid_RowSelectionChanging(sender, eventArgs) {
   eventArgs.getBrowserEvent().stopPropagation();
}</pre>
<p>but unfortunately &#8220;eventArgs.getBrowserEvent()&#8221; is <em>null</em> in this case and we have to resort to first approach. This method still allows rows to be selected but cancels scroll to the left after selection.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/01/06/delaying-selectedindexchanged-event/" rel="bookmark" class="crp_title">Delaying SelectedIndexChanged event of ComboBox in VB.NET WinForm</a></li><li><a href="http://CodeCorner.galanter.net/2010/07/08/how-todisable-hyperlink-clicks/" rel="bookmark" class="crp_title">How to Disable hyperlink clicks</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2012/01/09/webdatagrid-prevent-scrolling-on-row-selection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>ASP.NET: Delete file from server after TransmitFile command</title>
		<link>http://CodeCorner.galanter.net/2011/12/27/asp-net-delete-file-from-server-after-transmitfile-command/</link>
		<comments>http://CodeCorner.galanter.net/2011/12/27/asp-net-delete-file-from-server-after-transmitfile-command/#comments</comments>
		<pubDate>Tue, 27 Dec 2011 22:14:10 +0000</pubDate>
		<dc:creator>yomgal</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[dotnet]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1559</guid>
		<description><![CDATA[It&#8217;s a common scenario: user needs to download a file from the server by clicking link or a button in your ASPX page. The server-side code for this is pretty straightforward and looks something like this: The code accepts 2 parameters: i_sServerPath &#8211; full path to the file on the server and i_sDisplayName &#8211; file [...]]]></description>
			<content:encoded><![CDATA[<p>It&#8217;s a common scenario: user needs to download a file from the server by clicking link or a button in your ASPX page. The server-side code for this is pretty straightforward and looks something like this:</p>
<pre class="brush: vb; title: ; notranslate">Sub DownloadFile(ByVal i_sServerPath As String, ByVal i_sDisplayName As String)
   Dim oFile As FileInfo = New FileInfo(i_sServerPath)

   With Response
      .Clear()
      .ClearHeaders()
      .AddHeader(&quot;Content-Length&quot;, oFile.Length.ToString())
      .ContentType = ReturnContentType(oFile.Extension.ToLower())
      .AddHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; &amp; i_sDisplayName)
      .TransmitFile(oFile.FullName)
      .End()
   End With

End Sub</pre>
<p>The code accepts 2 parameters: <em>i_sServerPath</em> &#8211; full path to the file on the server and <em>i_sDisplayName</em> &#8211; file name that will be displayed to the user in the &#8220;Save As&#8221; dialog. Code also populates response headers based on file information. I use this handy function to populate ContentType based on file extention:</p>
<pre class="brush: vb; title: ; notranslate">Function ReturnContentType(ByVal i_sfileExtension As String) As String
   Select Case i_sfileExtension
      Case &quot;.htm&quot;, &quot;.html&quot;, &quot;.log&quot; : Return &quot;text/HTML&quot;
      Case &quot;.txt&quot; : Return &quot;text/plain&quot;
      Case &quot;.doc&quot; : Return &quot;application/ms-word&quot;
      Case &quot;.tiff&quot;, &quot;.tif&quot; : Return &quot;image/tiff&quot;
      Case &quot;.asf&quot; : Return &quot;video/x-ms-asf&quot;
      Case &quot;.avi&quot; : Return &quot;video/avi&quot;
      Case &quot;.zip&quot; : Return &quot;application/zip&quot;
      Case &quot;.xls&quot;, &quot;.csv&quot; : Return &quot;application/vnd.ms-excel&quot;
      Case &quot;.gif&quot; : Return &quot;image/gif&quot;
      Case &quot;.jpg&quot;, &quot;jpeg&quot; : Return &quot;image/jpeg&quot;
      Case &quot;.bmp&quot; : Return &quot;image/bmp&quot;
      Case &quot;.wav&quot; : Return &quot;audio/wav&quot;
      Case &quot;.mp3&quot; : Return &quot;audio/mpeg3&quot;
      Case &quot;.mpg&quot;, &quot;mpeg&quot; : Return &quot;video/mpeg&quot;
      Case &quot;.rtf&quot; : Return &quot;application/rtf&quot;
      Case &quot;.asp&quot; : Return &quot;text/asp&quot;
      Case &quot;.pdf&quot; : Return &quot;application/pdf&quot;
      Case &quot;.fdf&quot; : Return &quot;application/vnd.fdf&quot;
      Case &quot;.ppt&quot; : Return &quot;application/mspowerpoint&quot;
      Case &quot;.dwg&quot; : Return &quot;image/vnd.dwg&quot;
      Case &quot;.msg&quot; : Return &quot;application/msoutlook&quot;
      Case &quot;.xml&quot;, &quot;.sdxl&quot; : Return &quot;application/xml&quot;
      Case &quot;.xdp&quot; : Return &quot;application/vnd.adobe.xdp+xml&quot;
      Case Else : Return &quot;application/octet-stream&quot;
   End Select
End Function</pre>
<p>It&#8217;s all good, but what if you need to delete the file from the server immediately after user downloaded it? <span id="more-1559"></span>For example it was a report, generated by user&#8217;s request and saved into temporary file, and that file needs to be deleted after user downloads it.</p>
<p>We have to user <em>Response.End()</em> after <em>Response.TransmitFile()</em> otherwise download won&#8217;t work. But any server-side command after <em>Response.End()</em> doesn&#8217;t work either. The solution is to flush data, delete file and then call  <em>Response.End()</em>. Here is the modified version of <em>DownloadFile</em>:</p>
<pre class="brush: vb; highlight: [11,12]; title: ; notranslate">Sub DownloadFile(ByVal i_sServerPath As String, ByVal i_sDisplayName As String)
   Dim oFile As FileInfo = New FileInfo(i_sServerPath)

   With Response
      .Clear()
      .ClearHeaders()
      .AddHeader(&quot;Content-Length&quot;, oFile.Length.ToString())
      .ContentType = ReturnContentType(oFile.Extension.ToLower())
      .AddHeader(&quot;Content-Disposition&quot;, &quot;attachment; filename=&quot; &amp; i_sDisplayName)
      .TransmitFile(oFile.FullName)
      .Flush()
      oFile.Delete()
      .End()
   End With

End Sub</pre>
<p>Take a look at Lines 11 and 12 &#8211; the code flushes the data and then deletes the file. If you call this function in a server-side code (e.g. as a response to a button click) user gets a prompt to download file and then, after file is downloaded &#8211; it is deleted from the server.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/07/20/javascript-isdate-validate-date-according-browser-locale/" rel="bookmark" class="crp_title">JavaScript IsDate(): Validate date according browser locale</a></li><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></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/12/27/asp-net-delete-file-from-server-after-transmitfile-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UltraWebMenu: When background doesn&#8217;t change on hover in IE9</title>
		<link>http://CodeCorner.galanter.net/2011/12/06/ultrawebmenu-when-background-doesnt-change-on-hover/</link>
		<comments>http://CodeCorner.galanter.net/2011/12/06/ultrawebmenu-when-background-doesnt-change-on-hover/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 18:53:27 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[Internet Explorer]]></category>
		<category><![CDATA[solution]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1513</guid>
		<description><![CDATA[If you tried to use Infragistics classic UltraWebMenu control in IE9 you may experience issue (even in the latest version, 11.2 at the time of this post) whereby menu items don&#8217;t change background on mouse hover even though background is specified in menu&#8217;s HoverItemStyle property. The solution is specify BorderStyle in HoverItemStyle. It can be [...]]]></description>
			<content:encoded><![CDATA[<p>If you tried to use Infragistics classic UltraWebMenu control in IE9 you may experience issue (even in the latest version, 11.2 at the time of this post) whereby menu items don&#8217;t change background on mouse hover even though background is specified in menu&#8217;s <strong>HoverItemStyle</strong> property.</p>
<p>The solution is specify <strong>BorderStyle</strong> in <strong>HoverItemStyle</strong>. It can be any value besides <em>NotSet</em>, but the actual attribute has to be there. So for example if you want your hover style to have no borders and your original style looks like:</p>
<pre class="brush: xml; title: ; notranslate">&lt;HoverItemStyle
   ForeColor=&quot;White&quot;
   BackColor=&quot;#81C0E9&quot;
   Height=&quot;18px&quot;
   BorderWidth=&quot;0px&quot;&gt;
&lt;/HoverItemStyle&gt;</pre>
<p>change it to</p>
<pre class="brush: xml; highlight: [6]; title: ; notranslate">&lt;HoverItemStyle
   ForeColor=&quot;White&quot;
   BackColor=&quot;#81C0E9&quot;
   Height=&quot;18px&quot;
   BorderWidth=&quot;0px&quot;
   BorderStyle=&quot;None&quot;&gt;
&lt;/HoverItemStyle&gt;</pre>
<p>I don&#8217;t know why border style affects showing of the background, but there you have it. Adding <strong>BorderStyle</strong> to <strong>HoverItemStyle</strong> will enable displaying of background color on hover.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/08/09/ultrawebgrid-highlight-row-on-mouseover-with-selection-enabled/" rel="bookmark" class="crp_title">Ultrawebgrid: Highlight row on MouseOver with Selection enabled</a></li><li><a href="http://CodeCorner.galanter.net/2012/01/12/ultrawebgrid-topitemspacing-auto-solution-for-firefox/" rel="bookmark" class="crp_title">UltraWebGrid TopItemSpacing=&#8221;Auto&#8221;: Solution for FireFox</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/12/06/ultrawebmenu-when-background-doesnt-change-on-hover/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>UltraWebGrid bug: Row is selected on mouse move</title>
		<link>http://CodeCorner.galanter.net/2011/11/15/ultrawebgrid-bug-row-is-selected-on-mouse-move/</link>
		<comments>http://CodeCorner.galanter.net/2011/11/15/ultrawebgrid-bug-row-is-selected-on-mouse-move/#comments</comments>
		<pubDate>Tue, 15 Nov 2011 23:03:38 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[workaround]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1486</guid>
		<description><![CDATA[Submitted for your approval an UltraWebGrid with CellClickActionDefault=&#8221;RowSelect&#8221; and SelectTypeRowDefault=&#8221;Single&#8221; &#8211; an ordinary down-to-earth grid. It also posses event handler AfterSelectChangeHandler, also nothing out of the ordinary. But in a minute the aforementioned grid will exhibit properties most unusual. As the alert message ahead reads: Infragistics Bug. Sorry, got carried away there for a while. [...]]]></description>
			<content:encoded><![CDATA[<p>Submitted for your approval an UltraWebGrid with <em>CellClickActionDefault=&#8221;RowSelect&#8221;</em> and <em>SelectTypeRowDefault=&#8221;Single&#8221;</em> &#8211; an ordinary down-to-earth grid. It also posses event handler <em>AfterSelectChangeHandler</em>, also nothing out of the ordinary. But in a minute the aforementioned grid will exhibit properties most unusual. As the alert message ahead reads: <em>Infragistics Bug</em><span id="more-1486"></span>.</p>
<p>Sorry, got carried away there for a while. But you must agree, a lot of bugs in code makes you think that you are in the Twilight Zone indeed. Anyway. You happily click the grid&#8217;s rows, selection changes, <em>AfterSelectChangeHandler</em> is getting executed, life goes on. Until your JavaScript code inside of <em>AfterSelectChangeHandler</em> displays an alert message to the user. After that a new UltraWebGrid feature is born: Row selection change on mouse move &#8211; a simple mouse wave over a row selects that row. It&#8217;s magic! Not the good kind though.</p>
<p><del>Traveling through another dimension</del> looking at Infragistics JS library that handles mouse events I found that in <em>igtbl_cellMouseMove</em> function selection occurs if grid&#8217;s attribute <em>mouseDown</em> is set to <em>1</em>. Wild guess &#8211; it is used for drag-selection, but this ain&#8217;t the case and the attribute shouldn&#8217;t be set. So the solution: unset it. At the end of your AfterSelectChangeHandler handler insert:</p>
<pre class="brush: jscript; title: ; notranslate">igtbl_getGridById(gridName).Element.setAttribute('mouseDown', 0);</pre>
<p>and enjoy the happy end.</p>
<p><em>This issue was found in Infragistics NetAdvantage for ASP.NET 2011.1.2097, it probably exists in other versions.</em></p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/08/09/ultrawebgrid-highlight-row-on-mouseover-with-selection-enabled/" rel="bookmark" class="crp_title">Ultrawebgrid: Highlight row on MouseOver with Selection enabled</a></li><li><a href="http://CodeCorner.galanter.net/2011/04/22/solution-for-previoussibling-is-null-or-not-an-object-error-in-grouped-ultrawebgrid/" rel="bookmark" class="crp_title">Solution for &#8216;previousSibling&#8217; is null or not an object error in grouped UltraWebGrid</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/11/15/ultrawebgrid-bug-row-is-selected-on-mouse-move/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WHDG: RowIslandsPopulating event fires multiple times</title>
		<link>http://CodeCorner.galanter.net/2011/10/28/whdg-rowislandspopulating-event-fires-multiple-times/</link>
		<comments>http://CodeCorner.galanter.net/2011/10/28/whdg-rowislandspopulating-event-fires-multiple-times/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 16:31:09 +0000</pubDate>
		<dc:creator>Yuriy</dc:creator>
				<category><![CDATA[ADO.NET]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Infragistics]]></category>
		<category><![CDATA[Rant]]></category>
		<category><![CDATA[VB.NET]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[solution]]></category>

		<guid isPermaLink="false">http://CodeCorner.galanter.net/?p=1457</guid>
		<description><![CDATA[I&#8217;ve been successfully using manual load on demand in WebHierarchicalDataGrid for a while now, but recently noticed strange thing. The deeper in grid&#8217;s hierarchy I expanded the children &#8211; the slower it went. In my case every time user clicks [+] to expand a row, VB.NET code calls an SQL Server Stored procedure to bring [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been successfully using <a href="http://codecorner.galanter.net/2010/12/23/webhierarchicaldatagrid-manual-load-on-demand-when-bound-to-dataset/">manual load on demand in WebHierarchicalDataGrid</a> for a while now, but recently noticed strange thing. The deeper in grid&#8217;s hierarchy I expanded the children &#8211; the slower it went.</p>
<p>In my case every time user clicks [+] to expand a row, VB.NET code calls an SQL Server Stored procedure to bring in child rows. I grew suspicious and fired up SQL Profiler. What I saw surprised me. Number of calls to the stored procedure increased the deeper in grid&#8217;s hierarchy I expanded the children. When I clicked [+] on the root level it resulted in 1 SP call. Clicking [+] on the child to expand grandchild &#8211; 2 calls. Expanding grandchild to see grand-grandchild rows &#8211; 3 calls, etc.<span id="more-1457"></span></p>
<p>I went back to the VB.NET code that calls the SP, it&#8217;s the handler for <em>RowIslandsPopulating</em> event:</p>
<pre class="brush: vb; title: ; notranslate"> Protected Sub xmyGrid_RowIslandsPopulating(ByVal sender As Object, _
ByVal e As ContainerRowCancelEventArgs) Handles xmyGrid.RowIslandsPopulating

   e.Cancel = True
   CreateRowIslands(e.Row)

End Sub</pre>
<p>Where <em>CreateRowIslands</em> is a VB sub that calls SQL Server Stored procedure to create child grid. Setting a breakpoint here I confirmed my suspicions: <em>RowIslandsPopulating</em> event is called for rows that already have been expanded. E.g. if I expand grand-child to display grand-grand-child rows, the event will fire for root, child and grand-child &#8211; 3 times, in turn calling stored procedure 3 times.</p>
<p>How to avoid this? While comparing the multiple calls I realized that rows already expanded had their <em>Expanded</em> property set to <em>True</em>. And while we can prevent <em>RowIslandsPopulating</em> event from firing multiple times, we can at least tell it not to do anything if RowIslands are already populated. So, the very slight change:</p>
<pre class="brush: vb; title: ; notranslate"> Protected Sub xmyGrid_RowIslandsPopulating(ByVal sender As Object, _
ByVal e As ContainerRowCancelEventArgs) Handles xmyGrid.RowIslandsPopulating

   e.Cancel = True
   If e.Row.Expanded = False CreateRowIslands(e.Row)

End Sub</pre>
<p>Solves the issue.</p>
<div id="crp_related"><h4>Related Posts:</h4><ul><li><a href="http://CodeCorner.galanter.net/2010/12/23/webhierarchicaldatagrid-manual-load-on-demand-when-bound-to-dataset/" rel="bookmark" class="crp_title">WebHierarchicalDataGrid: Manual Load on Demand when bound to DataSet</a></li><li><a href="http://CodeCorner.galanter.net/2008/09/26/ultrawebgrid-in-outlookgroupby-mode-how-to-count-total-number-of-rows-in-a-subgroup/" rel="bookmark" class="crp_title">UltraWebGrid in OutlookGroupBy Mode: How to count total number of rows in subgroups</a></li></ul></div>]]></content:encoded>
			<wfw:commentRss>http://CodeCorner.galanter.net/2011/10/28/whdg-rowislandspopulating-event-fires-multiple-times/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

