<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Dhaval Upadhyaya</title>
	<atom:link href="http://dhavalupadhyaya.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dhavalupadhyaya.wordpress.com</link>
	<description>Articles on Microsoft Technology</description>
	<lastBuildDate>Fri, 13 Jan 2012 03:59:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='dhavalupadhyaya.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Dhaval Upadhyaya</title>
		<link>http://dhavalupadhyaya.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://dhavalupadhyaya.wordpress.com/osd.xml" title="Dhaval Upadhyaya" />
	<atom:link rel='hub' href='http://dhavalupadhyaya.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Screen Readers with Silverlight Applications</title>
		<link>http://dhavalupadhyaya.wordpress.com/2012/01/13/screen-readers-with-silverlight-applications/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2012/01/13/screen-readers-with-silverlight-applications/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 03:24:57 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[508 compliance in Silverlight]]></category>
		<category><![CDATA[508 compliance with Silverlight]]></category>
		<category><![CDATA[508 in Silverlight]]></category>
		<category><![CDATA[508 Rehabilitation Act in Silverlight]]></category>
		<category><![CDATA[508 with Silverlight]]></category>
		<category><![CDATA[Screen Reader not working with combox]]></category>
		<category><![CDATA[Screen Reader not working with combox in Silverlight]]></category>
		<category><![CDATA[Screen Reader Problem in Silverlight]]></category>
		<category><![CDATA[Screen Readers with Silverlight]]></category>
		<category><![CDATA[Screen Readers with Silverlight Applications]]></category>
		<category><![CDATA[Screen Readers with Smart Client applications]]></category>
		<category><![CDATA[Screen Readers with Smart Client technology]]></category>
		<category><![CDATA[Silverlight with Screen Readers]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=197</guid>
		<description><![CDATA[Screen Readers with Silverlight Applications. Web based applications fly across global boundaries due to which accessibility and ease of use becomes one of the most important factor that drives the sales count of the service we provide. As per 508 Compliance if we require our service served to audience with disabilities it should follow various [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=197&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color:#ff6600;">Screen Readers with Silverlight Applications.</span></strong></p>
<p style="text-align:justify;"><strong></strong><br />
Web based applications fly across global boundaries due to which accessibility and ease of use becomes one of the most important factor that drives the sales count of the service we provide.</p>
<p style="text-align:justify;">As per 508 Compliance if we require our service served to audience with disabilities it should follow various aspects.</p>
<p style="text-align:justify;">For thorough details please refer</p>
<p style="text-align:justify;"><a href="http://en.wikipedia.org/wiki/Section_508_Amendment_to_the_Rehabilitation_Act_of_1973">http://en.wikipedia.org/wiki/Section_508_Amendment_to_the_Rehabilitation_Act_of_1973</a></p>
<p style="text-align:justify;">This article is specifically targeted for users interested to know</p>
<p style="text-align:justify;">How do we provide support for Screen Readers software with the applications developed in one of the most cutting edge technology Silverlight?</p>
<p style="text-align:justify;">Traditional web based applications that emits html to browsers easily comply with Screen readers based on specifications followed for HTML.<br />
With Silverlight based applications the Silverlight plug-in takes care for screen readers. We just need to follow some methodologies provided in form of Automation Properties in Silverlight. Automation Properties provide several methods and attachable properties which help us define access keys, instruction text for screen readers and much more.</p>
<p style="text-align:justify;">For details please refer</p>
<p style="text-align:justify;"><a href="http://msdn.microsoft.com/en-us/library/system.windows.automation.automationproperties(v=vs.95).aspx">http://msdn.microsoft.com/en-us/library/system.windows.automation.automationproperties(v=vs.95).aspx</a></p>
<p style="text-align:justify;">By following these properties the work is pretty much simple.</p>
<p><span style="text-decoration:underline;"><strong>Sample 1</strong></span></p>
<p><pre class="brush: xml;">
&lt;TextBox  id=” nameTextBox” AutomationProperties.Name=”Please enter name” /&gt;
</pre></p>
<p>Screen reader will voice over “Please enter name” when this textbox receives focus.</p>
<p><span style="text-decoration:underline;"><strong>Sample 2</strong></span></p>
<p><pre class="brush: xml;">
&lt;TextBlock id=”nameTextBlock” Text=”Please enter name” /&gt;
&lt;TextBox  id=”nameTextBox” AutomationProperties.LabeledBy=&quot;{Binding ElementName= nameTextBlock }&quot; /&gt;
</pre></p>
<p style="text-align:justify;">Screen reader will voice over “Please enter name” when this textbox receives focus. Here is the case when we want to directly bind the AutomationProperties.Name property of textbox to any control, in this case a label beside text box.</p>
<p>Pretty much simply till here.</p>
<p style="text-align:justify;"><strong>But wait!</strong></p>
<p style="text-align:justify;">Silverlight SDK and Controls are very powerful and includes number of controls that can be bound directly to objects. Here is where most of the screen readers fail while generating voice over for such control. I will depict the problem with one of the control “Combo Box”</p>
<p style="text-align:justify;"><span style="text-decoration:underline;"><strong>Problem</strong></span><br />
If your combo box is bound to any dictionary object including collection than screen readers will work perfectly. But if combo box is bound to any object like “Person” than screen readers will fail.</p>
<p><span style="text-decoration:underline;"><strong>Sample Code</strong></span></p>
<p><pre class="brush: xml;">
&lt;ComboBox Name=&quot;personsComboBox&quot; ItemsSource=&quot;{Binding}&quot; DisplayMemberPath=&quot;Name&quot;/&gt;
</pre></p>
<p>&nbsp;</p>
<p><pre class="brush: csharp;">
public class Person : INotifyPropertyChanged
    {
        private string name;
        public string Name
        {
            get
            {
                return name;
            }
            set
            {
                if (value != name)
                {
                    name = value;
                    OnPropertyChnaged(&quot;Name&quot;);
                }
            }
        }

        private string surname;
        public string Surname
        {
            get
            {
                return surname;
            }
            set
            {
                if (value != surname)
                {
                    surname = value;
                    OnPropertyChnaged(&quot;Surname&quot;);
                }
            }
        }

        private Int32 age;
        public Int32 Age
        {
            get
            {
                return age;
            }
            set
            {
                if (value != age)
                {
                    age = value;
                    OnPropertyChnaged(&quot;Age&quot;);
                }
            }
        }

        #region INotifyPropertyChanged Members

        public event PropertyChangedEventHandler PropertyChanged;

        private void OnPropertyChnaged(string propertyName)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }

        #endregion

    }
</pre></p>
<p><span style="text-decoration:underline;"><strong>Solution</strong></span></p>
<p style="text-align:justify;">Screen Readers works on strings attached to the controls using attachable property AutomationProperties.Name as described in above example code. With the case were we are binding objects directly to control, screen readers fail and voice over the entire path (Namespace.ObjecName) were the object reside. In order to overcome this issue simply override ToString() method for your objects.</p>
<p style="text-align:justify;">Adding this code with the Person object designed above will ask screen readers to voice over “Name” property.</p>
<p><pre class="brush: csharp;">
public override string ToString()
        {
            return Name;
        }
</pre></p>
<p>Tricky but yet simple.</p>
<p>Enjoy Coding.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/197/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/197/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/197/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=197&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2012/01/13/screen-readers-with-silverlight-applications/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Automatic File Download</title>
		<link>http://dhavalupadhyaya.wordpress.com/2011/02/12/automatic-file-download/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2011/02/12/automatic-file-download/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 07:52:47 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[Automatic File Download]]></category>
		<category><![CDATA[Automatic File Download problem]]></category>
		<category><![CDATA[file download blocked]]></category>
		<category><![CDATA[file download blocked in ie]]></category>
		<category><![CDATA[file download not working in ie]]></category>
		<category><![CDATA[file download problem]]></category>
		<category><![CDATA[filedownload problem in ie]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=186</guid>
		<description><![CDATA[Troubleshooting automatic file download issue in IE7.0 and later version Problem: File download using .aspx page or HTTP handler does not work in IE 7.0 and later version. Solution: If you are storing your files in database and using .aspx page or HTTP handler to write the file to the response, than you must have [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=186&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color:#ff6600;">Troubleshooting automatic file download issue in IE7.0 and later version</span></strong></p>
<p><strong>Problem</strong>: File download using .aspx page or HTTP handler does not work in IE 7.0 and later version.</p>
<p><strong>Solution</strong>: If you are storing your files in database and using .aspx page or HTTP handler to write the file to the response, than you must have been bugged by this issue. This is not an error or IE bug but it’s just that the newer version of IE wants to protect its users from malicious contents that could sniff or simply harm your computer or data.<br />
To make it more secure IE has provided option to its users to allow\disallow the automatic downloading of files. This can be set in any kind of security zones. To turn On\Off user needs to perform below steps</p>
<p>Step1) Open IE and click Tools &gt; Internet Options<br />
Step2) Go to Security Tab. Select desired zone and then click Custom Level Button.<br />
Step3) Now look for Downloads &gt; Automatic prompting for file downloads. By default this is disabled due to which any automatic file downloads will be blocked. Enable this feature as shown below.</p>
<p><strong>Note</strong>: If you do not want your users to make any changes for above mentioned settings than you can achieve the automatic download but as a tweak you need to have an interim page which requires some user action like button click to download a file.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/186/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/186/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/186/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=186&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2011/02/12/automatic-file-download/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Animating Grid Column</title>
		<link>http://dhavalupadhyaya.wordpress.com/2011/02/12/animating-datagrid-column/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2011/02/12/animating-datagrid-column/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 07:48:46 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Animating Grid]]></category>
		<category><![CDATA[Animating Grid Column Width]]></category>
		<category><![CDATA[Animating Grid In Silverlight]]></category>
		<category><![CDATA[Animating Grid Row Height]]></category>
		<category><![CDATA[DoubleAnimation]]></category>
		<category><![CDATA[DoubleAnimation on Grid]]></category>
		<category><![CDATA[DoubleAnimation on Grid in SIlverlight]]></category>
		<category><![CDATA[Storyboarding]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=177</guid>
		<description><![CDATA[Troubleshooting InvalidOperationException: DoubleAnimation cannot be used to animate property Width due to incompatible type. Silverlight has great support for Animation and you might have experienced animating most of the controls on one or the other aspect. But animating ColumnDefinition.Width or RowDefinition.Height properties for Grid control is not straight forward. To achieve this one has to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=177&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color:#ff6600;">Troubleshooting InvalidOperationException: DoubleAnimation cannot be used to animate property Width due to incompatible type.</span></strong></p>
<p>Silverlight has great support for Animation and you might have experienced animating most of the controls on one or the other aspect. But animating ColumnDefinition.Width or RowDefinition.Height properties for Grid control is not straight forward. To achieve this one has to make a tweak.</p>
<p><strong>Problem </strong>: InvalidOperationException: DoubleAnimation cannot be used to animate property Width due to incompatible type.</p>
<p><strong>Reason </strong>: Width property of grid is not of type double but is of type GridLength.  Further GridLength has a property called Value of type Double, but Value is ReadOnly so to change the width or height you have to create a new instance of the GridLength object and set it to the Width Property of the grid.</p>
<p><strong>Solution</strong>: To achieve this we simply create a dependency property in our page and in the change event of that property we set the new instance of GridLength to width property of the grid.</p>
<p><pre class="brush: xml;">

&lt;Grid x:Name=&quot;myGrid&quot;&gt;
        &lt;Grid.Resources&gt;
            &lt;Storyboard x:Name=&quot;myStoryboardC&quot;&gt;
                &lt;DoubleAnimation From=&quot;150&quot; To=&quot;0&quot; Duration=&quot;00:00:1&quot;
                Storyboard.TargetName=&quot;myPageName&quot;
                Storyboard.TargetProperty=&quot;ColumnWidth&quot;&gt;
                    &lt;DoubleAnimation.EasingFunction&gt;
                        &lt;CubicEase EasingMode=&quot;EaseOut&quot;/&gt;
                    &lt;/DoubleAnimation.EasingFunction&gt;
                &lt;/DoubleAnimation&gt;
            &lt;/Storyboard&gt;
            &lt;Storyboard x:Name=&quot;myStoryboardE&quot;&gt;
                &lt;DoubleAnimation From=&quot;0&quot; To=&quot;150&quot; Duration=&quot;00:00:1&quot;
                Storyboard.TargetName= “myPageName&quot;
                Storyboard.TargetProperty=&quot;ColumnWidth&quot;&gt;
                    &lt;DoubleAnimation.EasingFunction&gt;
                        &lt;CubicEase EasingMode=&quot;EaseOut&quot;/&gt;
                    &lt;/DoubleAnimation.EasingFunction&gt;
                &lt;/DoubleAnimation&gt;
            &lt;/Storyboard&gt;
        &lt;/Grid.Resources&gt;
        &lt;Grid.ColumnDefinitions&gt;
            &lt;ColumnDefinition x:Name=&quot;Column1&quot; Width=&quot;150&quot; MaxWidth=&quot;250&quot; MinWidth=&quot;0&quot;&gt;
            &lt;/ColumnDefinition&gt;
            &lt;ColumnDefinition Width=&quot;15&quot; MaxWidth=&quot;15&quot; MinWidth=&quot;15&quot;/&gt;
            &lt;ColumnDefinition Width=&quot;*&quot;/&gt;
        &lt;/Grid.ColumnDefinitions&gt;
        &lt;Grid.RowDefinitions&gt;
            &lt;RowDefinition Height=&quot;*&quot;/&gt;
        &lt;/Grid.RowDefinitions&gt;

        &lt;Rectangle x:Name=&quot;myRectangle&quot;
     Fill=&quot;Blue&quot; Width=&quot;200&quot; Height=&quot;30&quot; Grid.Column=&quot;0&quot;/&gt;

        &lt;layoutToolkit:Accordion x:Name=&quot;acc&quot; SelectionMode=&quot;ZeroOrMore&quot; Grid.Column=&quot;0&quot;&gt;
            &lt;layoutToolkit:AccordionItem Header=&quot;hi&quot;&gt;
                &lt;StackPanel&gt;
                    &lt;TextBlock Text=&quot;1&quot;/&gt;
                    &lt;TextBlock Text=&quot;2&quot;/&gt;
                    &lt;TextBlock Text=&quot;3&quot;/&gt;
                &lt;/StackPanel&gt;
            &lt;/layoutToolkit:AccordionItem&gt;
            &lt;layoutToolkit:AccordionItem Header=&quot;hi&quot; Content=&quot;Task 2&quot;/&gt;
            &lt;layoutToolkit:AccordionItem Header=&quot;hi&quot; Content=&quot;Task 3&quot;/&gt;
        &lt;/layoutToolkit:Accordion&gt;

        &lt;Button x:Name=&quot;btnEC&quot; Content=&quot;&amp;lt;&quot; Grid.Column=&quot;1&quot; Click=&quot;Button_Click&quot; /&gt;

        &lt;data:DataGrid x:Name=&quot;dataGrid1&quot; Margin=&quot;0&quot; Grid.Column=&quot;2&quot;&gt;
            &lt;data:DataGrid.RowDetailsTemplate&gt;
                &lt;DataTemplate&gt;
                    &lt;StackPanel Background=&quot;LightBlue&quot;&gt;
                        &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                            &lt;TextBlock Text=&quot;This item has details.&quot; /&gt;
                        &lt;/StackPanel&gt;
                        &lt;StackPanel Orientation=&quot;Horizontal&quot;&gt;
                            &lt;TextBlock Text=&quot;Here is some data: &quot; /&gt;
                            &lt;TextBlock Text=&quot;{Binding FirstName}&quot; /&gt;
                            &lt;TextBlock Text=&quot; LastName&quot; /&gt;
                            &lt;TextBlock Text=&quot;{Binding LastName}&quot; /&gt;
                        &lt;/StackPanel&gt;
                    &lt;/StackPanel&gt;
                &lt;/DataTemplate&gt;
            &lt;/data:DataGrid.RowDetailsTemplate&gt;
        &lt;/data:DataGrid&gt;

    &lt;/Grid&gt;

</pre></p>
<p><pre class="brush: csharp;">

public partial class MainPage : UserControl
    {

        bool toogle;
        public MainPage()
        {
            InitializeComponent();
            this.Name = &quot;myPageName&quot;;
        }

        public static readonly DependencyProperty ColumnWidthProperty = DependencyProperty.Register(&quot;ColumnWidth&quot;,
                                                                                                    typeof(double),
                                                                                                    typeof(MainPage),
                                                                                                    new PropertyMetadata
                                                                                                      (ColumnWidthChanged));
        public double ColumnWidth
        {
            get
            {
                return (double)GetValue(ColumnWidthProperty);
            }
            set
            {
                SetValue(ColumnWidthProperty, value);
            }
        }

        private static void ColumnWidthChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            var mainPage = (MainPage)d;
            mainPage.Column1.Width = new GridLength((double)e.NewValue);
        }

        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (!toogle)
            {
                myStoryboardC.Begin();
                btnEC.Content = &quot;&gt;&quot;;
                toogle = !toogle;
            }
            else
            {
                myStoryboardE.Begin();
                btnEC.Content = &quot;&lt;&quot;;
                toogle = !toogle;
            }
        }
    }

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/177/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/177/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/177/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=177&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2011/02/12/animating-datagrid-column/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Show loading while downloading XAP modules in prism.</title>
		<link>http://dhavalupadhyaya.wordpress.com/2010/09/04/show-loading-while-downloading-xap-modules-in-prism/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2010/09/04/show-loading-while-downloading-xap-modules-in-prism/#comments</comments>
		<pubDate>Sat, 04 Sep 2010 08:10:30 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[busy indicator in prism]]></category>
		<category><![CDATA[busy indicator in silverlight]]></category>
		<category><![CDATA[show loading bar while downloading xap packages]]></category>
		<category><![CDATA[show loading in prism]]></category>
		<category><![CDATA[show loading xap packages]]></category>
		<category><![CDATA[show progress bar while downloading xap packages]]></category>
		<category><![CDATA[show progress bar xap packages]]></category>
		<category><![CDATA[show progress in prism]]></category>
		<category><![CDATA[Silverlight Prism module loading]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=172</guid>
		<description><![CDATA[Show loading while downloading XAP modules in prism. Scenario : To show progress bar when modules (xap’s) in prism are downloaded. Problem : Currently in prism the default ModuleManager class does not expose a progress event that can be tracked to show some progressing of the modules (xap’s) being downloaded. Solution : Prism’s ModuleManager internally [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=172&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color:#ff9900;">Show loading while downloading XAP modules in prism.</span></strong></p>
<p><strong>Scenario :</strong> To show progress bar when modules (xap’s) in prism are downloaded.</p>
<p><strong>Problem : </strong>Currently in prism the default ModuleManager class does not expose a progress event that can be tracked to show some progressing of the modules (xap’s) being downloaded.</p>
<p><strong>Solution : </strong>Prism’s ModuleManager internally uses instance of XapModuleTypeLoader to load modules (xap’s) asynchronously. Thanks to the community of prism for providing CreateDownloader() as virtual method.</p>
<p>Straight to the point I will jot down the steps to achieve the above mentioned goal.</p>
<p><strong>Step 1</strong> &#8211; Create an event and an event argument classes that will be used in custom class below</p>
<p><pre class="brush: csharp;">

public class ModuleDownloadProgressEvent : CompositePresentationEvent&lt;ModuleDownloadProgressArgs&gt;
{
}

public class ModuleDownloadProgressArgs
{
    public ModuleDownloadProgressArgs(int BytesReceived, bool IsComplete) { _BytesReceived = BytesReceived; _IsComplete = IsComplete; }
    private int _BytesReceived;
    public int BytesReceived { get { return _BytesReceived; } set { _BytesReceived = value; } }
    private bool _IsComplete;
    public bool IsComplete { get { return _IsComplete; } set { _IsComplete = value; } }
}

</pre></p>
<p><strong>Step 2</strong> &#8211; Create a class that derives from IFileDownloader.</p>
<p><pre class="brush: csharp;">

public class CustomFileDownloader : IFileDownloader
{
    private readonly WebClient webClient = new WebClient();
    private readonly IEventAggregator eventAgg;

    public CustomFileDownloader()
    {
        eventAgg = ServiceLocator.Current.GetInstance&lt;IEventAggregator&gt;();
    }

    private event EventHandler&lt;DownloadCompletedEventArgs&gt; _downloadCompleted;
    public event EventHandler&lt;DownloadCompletedEventArgs&gt; DownloadCompleted
    {
        add
        {
            if (this._downloadCompleted == null)
            {
                this.webClient.OpenReadCompleted += this.WebClient_OpenReadCompleted;
                this.webClient.DownloadProgressChanged += this.DownloadProgressChanged;
            }

            this._downloadCompleted += value;
        }

        remove
        {
            this._downloadCompleted -= value;
            if (this._downloadCompleted == null)
            {
                this.webClient.OpenReadCompleted -= this.WebClient_OpenReadCompleted;
                this.webClient.DownloadProgressChanged -= this.DownloadProgressChanged;
            }
        }
    }

    void DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
    {
        RaiseDownloadProgressChanged(e.ProgressPercentage, false);
    }

    private void RaiseDownloadProgressChanged(int val, bool isComplete)
    {
        eventAgg.GetEvent&lt;ModuleDownloadProgressEvent&gt;().Publish(new ModuleDownloadProgressArgs(val, isComplete));
    }

    public void DownloadAsync(Uri uri, object userToken)
    {
        this.webClient.OpenReadAsync(uri, userToken);
    }

    private void WebClient_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
    {
        this._downloadCompleted(this, ConvertArgs(e));
        RaiseDownloadProgressChanged(0, true);
    }

    private static DownloadCompletedEventArgs ConvertArgs(OpenReadCompletedEventArgs args)
    {
        return new DownloadCompletedEventArgs(args.Error == null ? args.Result : null, args.Error, args.Cancelled, args.UserState);
    }
}

</pre></p>
<p><strong>Step 3 </strong>- Create a class that derives from XapModuleTypeLoader and override its virtual method CreateDownloader returning your class object prepared in step 1</p>
<p><pre class="brush: csharp;">

public class CustomXapModuleTypeLoader : XapModuleTypeLoader
{
    protected override IFileDownloader CreateDownloader()
    {
        return new CustomFileDownloader();
    }
}

</pre></p>
<p><strong>Step 4</strong> &#8211; Create a class that derives from ModuleManager and override its virtual method ModuleTypeLoaders replacing default XapModuleTypeLoader with your class object prepared in step 2.</p>
<p><pre class="brush: csharp;">

public class CustomModuleManager : ModuleManager
{
    public CustomModuleManager(IModuleInitializer moduleInitializer, IModuleCatalog moduleCatalog, ILoggerFacade loggerFacade)
        : base(moduleInitializer, moduleCatalog, loggerFacade) { }
    private System.Collections.Generic.IEnumerable&lt;IModuleTypeLoader&gt; typeLoaders;
    public override System.Collections.Generic.IEnumerable&lt;IModuleTypeLoader&gt; ModuleTypeLoaders
    {
        get
        {
            if (this.typeLoaders == null)
            {
                this.typeLoaders = new List&lt;IModuleTypeLoader&gt;()
                                      {
                                          new CustomXapModuleTypeLoader()
                                      };
            }

            return this.typeLoaders;
        }
        set
        {
            this.typeLoaders = value;
        }
    }
}

</pre></p>
<p><strong>Step 5</strong> &#8211; Register your custom ModuleManager class prepared in step 4, in overridden method ConfigureContainer() of your Bootstrapper class.</p>
<p><pre class="brush: csharp;">

	base.RegisterTypeIfMissing(typeof(IModuleManager), typeof(CustomModuleManager), true);

</pre></p>
<p><strong>Step 6</strong> – Create a method in Shell that will respond to the ModuleDownloadProgressEvent event when published</p>
<p><pre class="brush: csharp;">

public void ShowHide(ModuleDownloadProgressArgs e)
{
	// Your Dream Goes Here
}

</pre></p>
<p><strong>Step 7</strong> – Finally in the Shell subscribe to the ModuleDownloadProgressEvent  event prepared in Step 1.</p>
<p><pre class="brush: csharp;">

	eventAggregator.GetEvent&lt;ModuleDownloadProgressEvent&gt;().Subscribe(ShowHide, ThreadOption.UIThread);

</pre></p>
<p>That’s it!!!</p>
<p>Enjoy Prism.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/172/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/172/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/172/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=172&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2010/09/04/show-loading-while-downloading-xap-modules-in-prism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Packing and Deploying Custom Templates in Visual Studio.</title>
		<link>http://dhavalupadhyaya.wordpress.com/2010/08/07/packing-and-deploying-custom-templates-in-visual-studio/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2010/08/07/packing-and-deploying-custom-templates-in-visual-studio/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 05:51:57 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Visual Studio IDE]]></category>
		<category><![CDATA[deploy .vstemplate]]></category>
		<category><![CDATA[package templates in vs]]></category>
		<category><![CDATA[Packing and Deploying Custom Templates in Visual Studio]]></category>
		<category><![CDATA[vstemplate]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=161</guid>
		<description><![CDATA[Packing and Deploying Custom Templates in Visual Studio. Once you have created your own template (Creating project templates for Visual Studio) its time for its distribution. To make the template appear into the “New Project” window it is important to place the zip file of the template to correct location. This can be done manually [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=161&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><strong>Packing and Deploying Custom Templates in Visual Studio.</strong></span></p>
<p>Once you have created your own template<span style="color:#ff6600;"> (<a href="http://dhavalupadhyaya.wordpress.com/2010/08/07/creating-project-templates-for-visual-studio/" target="_blank">Creating project templates for Visual Studio</a>) </span>its time for its distribution.<br />
To make the template appear into the “New Project” window it is important to place the zip file of the template to correct location. This can be done manually and through .vsi (Visual Studio Installer) file. Also .vsi file will be helpful for distribution of your template to different community or users.</p>
<p>To create the .vsi file for your template follow the below steps<br />
1)Create a file in the project folder with .vscontent extension having the below code</p>
<p><pre class="brush: xml;">

&lt;VSContent xmlns=&quot;http://schemas.microsoft.com/developer/vscontent/2005&quot;&gt;
  &lt;Content&gt;
    &lt;FileName&gt;MyFirstWebProjectTemplate.zip&lt;/FileName&gt;
    &lt;DisplayName&gt;My First Web Project Template&lt;/DisplayName&gt;
    &lt;Description&gt;A project template created for this example.&lt;/Description&gt;
    &lt;FileContentType&gt;VSTemplate&lt;/FileContentType&gt;
    &lt;ContentVersion&gt;1.0&lt;/ContentVersion&gt;
    &lt;Attributes&gt;
      &lt;Attribute name=&quot;ProjectType&quot; value=&quot;Visual C#&quot;/&gt;
      &lt;Attribute name=&quot;ProjectSubType&quot; value=&quot;CSharp&quot;/&gt;
      &lt;Attribute name=&quot;TemplateType&quot; value=&quot;Project&quot;/&gt;
    &lt;/Attributes&gt;
  &lt;/Content&gt;
&lt;/VSContent&gt;

</pre></p>
<p><span style="text-decoration:underline;">File Name:</span> Name of the file that needs to be deployed. Here it is our custom template zip file.</p>
<p><span style="text-decoration:underline;">DisplayName:</span> Name that appears in the deployment wizard</p>
<p><span style="text-decoration:underline;">Description:</span> Small description regarding the component that is being deployed. It appears as tooltip for the Display Name</p>
<p><span style="text-decoration:underline;">FileContentType:</span> Type of the file being deployed. It can be Toolbox Control, Code Snippet, VSTemplate etc.</p>
<p><span style="text-decoration:underline;">ContentVersion:</span> Version of the content being deployed. Let be 1.0</p>
<p><span style="text-decoration:underline;">ProjectType:</span> Type of the project. It can be Visual Basic, Visaul C#, Visual J# etc</p>
<p><span style="text-decoration:underline;">ProjectSubType:</span> Type of subcategory to which the template would be placed. It can be CSharp, JSharp, Visual Basic etc</p>
<p><span style="text-decoration:underline;">TemplateType:</span> Type of the template that is being deployed. It can be Project, Item.</p>
<p>2)Select all the files to be included in your template (including the .vscontent file) and compress it to prepare a standard zip file. In above case it will produce MyFirstWebProjectTemplate.zip.</p>
<p>3)Rename the extension of the .zip file to .vsi.</p>
<p><strong>Alternate Approach</strong></p>
<p>1)Select all the files to be included in your template (including the .vstemplate file) and compress it to prepare a standard zip file.</p>
<p>2)Create a file in the project folder with .vscontent extension as shown in the above scenario</p>
<p>3)Select the zip file created in step 1 and .vscontent file created in step 2. Right click and click “Add to archive”. In the Archive name give MyTemplate.vsi and zip it. It will create a new MyTemplate.vsi file.</p>
<p>That’s it distribute the .vsi file.</p>
<p><strong>Note:</strong> In order to avoid the “No Signature Found” warning and to display the publisher information into the .vsi package you must sign your .vsi file</p>
<p><pre class="brush: xml;">

&lt;VSTemplate Version=&quot;2.0.0&quot; xmlns=&quot;http://schemas.microsoft.com/developer/vstemplate/2005&quot; Type=&quot;Project&quot;&gt;
	&lt;TemplateData&gt;
      &lt;Name&gt;ASP.NET AJAX Control Project&lt;/Name&gt;
      &lt;Description&gt;Create new ASP.NET AJAX Control Extenders and Behaviors&lt;/Description&gt;
      &lt;ProjectType&gt;CSharp&lt;/ProjectType&gt;
      &lt;SortOrder&gt;1000&lt;/SortOrder&gt;
      &lt;CreateNewFolder&gt;true&lt;/CreateNewFolder&gt;
      &lt;DefaultName&gt;AjaxControlExtender&lt;/DefaultName&gt;
      &lt;ProvideDefaultName&gt;true&lt;/ProvideDefaultName&gt;
      &lt;LocationField&gt;Enabled&lt;/LocationField&gt;
      &lt;EnableLocationBrowseButton&gt;true&lt;/EnableLocationBrowseButton&gt;
      &lt;Icon&gt;__TemplateIcon.ico&lt;/Icon&gt;
  &lt;/TemplateData&gt;
  &lt;TemplateContent&gt;
      &lt;CustomParameters&gt;
        &lt;CustomParameter Name=&quot;$baseitemname$&quot; Value=&quot;$safeprojectname$&quot;/&gt;
        &lt;CustomParameter Name=&quot;$rootnamespace$&quot; Value=&quot;$safeprojectname$&quot;/&gt;
      &lt;/CustomParameters&gt;
      &lt;Project TargetFileName=&quot;AjaxControlExtender.csproj&quot; File=&quot;AjaxControlExtender.csproj&quot; ReplaceParameters=&quot;true&quot;&gt;
        &lt;ProjectItem TargetFileName=&quot;$safeprojectname$Behavior.js&quot; ReplaceParameters=&quot;true&quot;&gt;Behavior.js&lt;/ProjectItem&gt;
        &lt;ProjectItem TargetFileName=&quot;$safeprojectname$Extender.cs&quot; ReplaceParameters=&quot;true&quot;&gt;Extender.cs&lt;/ProjectItem&gt;
        &lt;ProjectItem TargetFileName=&quot;$safeprojectname$Designer.cs&quot; ReplaceParameters=&quot;true&quot;&gt;Designer.cs&lt;/ProjectItem&gt;
        &lt;Folder Name=&quot;bin&quot;  TargetFolderName=&quot;bin&quot;&gt;
                    &lt;ProjectItem&gt;AjaxControlToolkit.dll&lt;/ProjectItem&gt;
        &lt;/Folder&gt;
      &lt;/Project&gt;
  &lt;/TemplateContent&gt;
&lt;/VSTemplate&gt;

&lt;VSTemplate Version=&quot;2.0.0&quot; Type=&quot;Project&quot; xmlns=&quot;http://schemas.microsoft.com/developer/vstemplate/2005&quot;&gt;
    &lt;TemplateData&gt;
      &lt;Name&gt;MyFirstWebProjectTemplate&lt;/Name&gt;
      &lt;Description&gt;A simple Web template&lt;/Description&gt;
      &lt;Icon&gt;icon.ico&lt;/Icon&gt;
      &lt;ProjectType&gt;Web&lt;/ProjectType&gt;
      &lt;ProjectSubType&gt;CSharp&lt;/ProjectSubType&gt;
      &lt;DefaultName&gt;WebSite&lt;/DefaultName&gt;
    &lt;/TemplateData&gt;
    &lt;TemplateContent&gt;
      &lt;Project File=&quot;MyFirstWebProjectTemplate.webproj&quot; TargetFileName=&quot;MyFirstWebProjectTemplate.webproj&quot;&gt;
	        &lt;ProjectItem&gt;web.config&lt;/ProjectItem&gt;
	        &lt;ProjectItem OpenInEditor=&quot;true&quot;&gt;Default.aspx&lt;/ProjectItem&gt;
	        &lt;ProjectItem&gt;Default.aspx.cs&lt;/ProjectItem&gt;
	        &lt;Folder Name=&quot;App_Code&quot;  TargetFolderName=&quot;App_Code&quot;&gt;
            &lt;Folder Name=&quot;BAL&quot;  TargetFolderName=&quot;BAL&quot;&gt;
            &lt;/Folder&gt;
            &lt;Folder Name=&quot;DAL&quot;  TargetFolderName=&quot;DAL&quot;&gt;
                        &lt;ProjectItem&gt;DataAccess.cs&lt;/ProjectItem&gt;
            &lt;/Folder&gt;
	        &lt;/Folder&gt;
	        &lt;Folder Name=&quot;App_Data&quot;  TargetFolderName=&quot;App_Data&quot;&gt;
	        &lt;/Folder&gt;
      &lt;/Project&gt;
    &lt;/TemplateContent&gt;
&lt;/VSTemplate&gt;

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/161/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/161/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/161/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=161&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2010/08/07/packing-and-deploying-custom-templates-in-visual-studio/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Creating project templates for Visual Studio</title>
		<link>http://dhavalupadhyaya.wordpress.com/2010/08/07/creating-project-templates-for-visual-studio/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2010/08/07/creating-project-templates-for-visual-studio/#comments</comments>
		<pubDate>Sat, 07 Aug 2010 05:43:57 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Visual Studio IDE]]></category>
		<category><![CDATA[creating .vstemplate]]></category>
		<category><![CDATA[custom project templates]]></category>
		<category><![CDATA[project templates]]></category>
		<category><![CDATA[project templates for Visual Studio]]></category>
		<category><![CDATA[reusable project templates]]></category>
		<category><![CDATA[templates in visual studio]]></category>
		<category><![CDATA[templates in vs]]></category>
		<category><![CDATA[vstemplate]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=159</guid>
		<description><![CDATA[Creating project templates for Visual Studio Reusability though heard thousands of times, ranges from a small code snippet to the entire enterprise level framework. This article will demonstrate the word reusable in terms of – Reusing the company framework or code through a fantastic feature of Visual Studio called Templates. Templates A group of packaged [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=159&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><strong>Creating project templates for Visual Studio</strong></span></p>
<p>Reusability though heard thousands of times, ranges from a small code snippet to the entire enterprise level framework. This article will demonstrate the word reusable in terms of – Reusing the company framework or code through a fantastic feature of Visual Studio called Templates.</p>
<p><span style="text-decoration:underline;"><span style="color:#000000;"><strong>Templates</strong></span></span></p>
<p>A group of packaged files that help to accelerate the development process by eliminating the need to start the project from scratch. Templates are divided into two parts</p>
<p><strong>Project Templates :</strong> This category appears into “New Project” dialog box when one is starting a fresh new project. It is further divided into Project Templates and Website Templates.</p>
<p><strong>Item Templates :</strong> This category appears into “Add Item” dialog box when one wants to add a new item to the project.</p>
<p>Ways to create template: There are two ways in which one can create the desired template manually or by using the export template wizard of Visual Studio.</p>
<p>I will stick to the process of manually creating a Website Template.<br />
Steps to create a new website template.<br />
1)Create a new Web site.</p>
<p>2)Prepare the framework (files to be included in your website template)</p>
<p>3)Create a file with .vstemplate as extension in the same directory of your project.</p>
<p>4)Alter the .vstemplate file to provide template metadata as given below.</p>
<p><pre class="brush: xml;">

&lt;VSTemplate Version=&quot;2.0.0&quot; Type=&quot;Project&quot; xmlns=&quot;http://schemas.microsoft.com/developer/vstemplate/2005&quot;&gt;
    &lt;TemplateData&gt;
      &lt;Name&gt;MyFirstWebProjectTemplate&lt;/Name&gt;
      &lt;Description&gt;A simple Web template&lt;/Description&gt;
      &lt;Icon&gt;icon.ico&lt;/Icon&gt;
      &lt;ProjectType&gt;Web&lt;/ProjectType&gt;
      &lt;ProjectSubType&gt;CSharp&lt;/ProjectSubType&gt;
      &lt;DefaultName&gt;WebSite&lt;/DefaultName&gt;
    &lt;/TemplateData&gt;
    &lt;TemplateContent&gt;
      &lt;Project File=&quot;MyFirstWebProjectTemplate.webproj&quot; TargetFileName=&quot;MyFirstWebProjectTemplate.webproj&quot;&gt;
        &lt;ProjectItem&gt;web.config&lt;/ProjectItem&gt;
        &lt;ProjectItem OpenInEditor=&quot;true&quot;&gt;Default.aspx&lt;/ProjectItem&gt;
        &lt;ProjectItem&gt;Default.aspx.cs&lt;/ProjectItem&gt;
        &lt;Folder Name=&quot;App_Code&quot;  TargetFolderName=&quot;App_Code&quot;&gt;
          &lt;Folder Name=&quot;BAL&quot;  TargetFolderName=&quot;BAL&quot;&gt;
          &lt;/Folder&gt;
          &lt;Folder Name=&quot;DAL&quot;  TargetFolderName=&quot;DAL&quot;&gt;
            &lt;ProjectItem&gt;DataAccess.cs&lt;/ProjectItem&gt;
          &lt;/Folder&gt;
        &lt;/Folder&gt;
        &lt;Folder Name=&quot;App_Data&quot;  TargetFolderName=&quot;App_Data&quot;&gt;
        &lt;/Folder&gt;
      &lt;/Project&gt;
    &lt;/TemplateContent&gt;
&lt;/VSTemplate&gt;

</pre></p>
<p>The above vstemplate XML file includes three major sections</p>
<p><strong><span style="text-decoration:underline;">VSTemplate:</span></strong> Identifies the template as a project or item template and provides the template version number</p>
<p><strong><span style="text-decoration:underline;">Template Data:</span></strong> Includes all the metadata that defines the display characteristics related to the Add New Website Screen.</p>
<p><span style="text-decoration:underline;">Name: </span> Name of the template that appear under the My Template section</p>
<p><span style="text-decoration:underline;">Description:</span> Small description that is depicted in the status bar of the New website screen.</p>
<p><span style="text-decoration:underline;">Icon:</span><strong> </strong>Name of the Icon file that is shown as the preview icon for the newly created template.</p>
<p><span style="text-decoration:underline;">Project Type: </span>Type of the project template. This is one of the main attributes as it decides under which section the template will appear. Specifically mention “Web” for creating web site project template.</p>
<p><span style="text-decoration:underline;">Project Sub Type:</span> Type of the language for the template. It can be CSharp, VisualBasic, JSharp etc.</p>
<p><span style="text-decoration:underline;">DefaultName:</span> The default name of the website</p>
<p><strong><span style="text-decoration:underline;">Template Content:</span></strong> Includes the definition for all the files and folder structure that would be created when the template is imported.</p>
<p><span style="text-decoration:underline;">Project File:</span> This is the name of the project file that is used internally by visual studio to refer files while extracting the template. So incase of project template it will be the name of the projet file Eg “MyFirstWebProjectTemplate.csproj”<br />
As website donot produce project files just create a file with .webproj extension Eg MyFirstWebProjectTemplate.webproj</p>
<p><span style="text-decoration:underline;">ProjectItem:</span> This attributes includes all the files that need to be extracted.</p>
<p><span style="text-decoration:underline;">Folder:</span> Used to organize files into specific folder structure just incase. In the above example template will create App_Code foler, BAL and DAL folder under App_Code folder and place DataAccess.cs file into DAL folder.</p>
<p>5)Now navigate to the project folder. Select all the files to be included in your template (including the .vstemplate file) and compress it to prepare a standard zip file. In above case it will produce MyFirstWebProjectTemplate.zip.</p>
<p>6)Now simply move the zip file to My Documents\Visual Studio 2005\Templates\ProjectTemplates folder.</p>
<p>7)To validate Open Visual Studio and goto File &gt;&gt; New &gt;&gt; Website. The newly created template will appear into My Templates section of the “New Website Screen”. That’s it you have created your own first template.</p>
<p><strong>Conclusion</strong><br />
To save time with scratch projects prepare template with a framework including UI aspects like Basic Layout(Login.aspx,DefaultMaster.aspx, etc), Architectural aspects like  Authentication,Authorization,Security,Utility classes etc<br />
and save your time and money.</p>
<p>Templates can be used locally as well as can be distributed to others users. To prepare a .vsi deployment package for your template refer</p>
<p><span style="color:#ff6600;"><a href="http://dhavalupadhyaya.wordpress.com/2010/08/07/packing-and-deploying-custom-templates-in-visual-studio/" target="_blank"> Packing and Deploying Custom Templates in Visual Studio.</a></span></p>
<p><strong>Note:</strong> Though the template creation seems to be easy but in reality its not. Above was the simplest type of the template that we have created. Visual Studio has great amount of flexibility to produce different types of templates like, project templates, website templates (the one above), item templates and wizard base templates.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/159/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/159/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/159/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=159&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2010/08/07/creating-project-templates-for-visual-studio/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Document generation in C#</title>
		<link>http://dhavalupadhyaya.wordpress.com/2010/04/10/document-generation-in-c/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2010/04/10/document-generation-in-c/#comments</comments>
		<pubDate>Sat, 10 Apr 2010 11:58:00 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[automatic documentation generation]]></category>
		<category><![CDATA[c sharp documentation]]></category>
		<category><![CDATA[c# documentation]]></category>
		<category><![CDATA[c# xml documentation]]></category>
		<category><![CDATA[ndoc documentation]]></category>
		<category><![CDATA[ndoc documentation in c sharp]]></category>
		<category><![CDATA[ndoc documentation in c#]]></category>
		<category><![CDATA[xml documentation]]></category>
		<category><![CDATA[xml documentation in c sharp]]></category>
		<category><![CDATA[xml documentation in c#]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=153</guid>
		<description><![CDATA[Document generation in C# Why document? One of the most famous nightmares among the developers is generating the detailed documentation of the code they have already done. But this notion should be changed as one should always detail each and every aspect of the code they have produced. Proper documentation not only helps others to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=153&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><strong>Document generation in C#</strong></span></p>
<p><strong>Why document?</strong><br />
One of the most famous nightmares among the developers is generating the detailed documentation of the code they have already done. But this notion should be changed as one should always detail each and every aspect of the code they have produced. Proper documentation not only helps others to understand the code but also brings down the maintenance cost of the project if properly utilized.</p>
<p><strong>When to document?</strong><br />
I usually prefer to document things but it depends on the following factors Size of Project, Complexity of Code, Client Need etc. One should not consider the Cost of the project as a factor affecting the decision you know why?</p>
<p><strong>What to document?<br />
</strong>No matter whatever the piece of code is you can comment it and latter when needed can produce the required document for that particular section. Namespace, Class, Structure, Interface, Enum, Property, Method, Event and all other stuff can be documented. Always follow the practice of commenting your code as and when you finalize with that particular section.</p>
<p><strong> </strong><strong><span style="text-decoration:underline;">Solution</span></strong></p>
<p>C# has an inbuilt feature than one can take the advantage to generate the document automatically. You just need to be aware of the attributes used for placing and formatting the comments. Some of them are mentioned below</p>
<p><pre class="brush: csharp;">
&lt;c&gt; Use to depict a code into a single line.
E.g.: &lt;c&gt; int i = 0 ; &lt;/c&gt;

&lt;code&gt; Use to depict a code snippet into a multiple lines
E.g.: 	&lt;code&gt;
for (int i = 0; i &lt; 10; i++)
      {
         //Code
      }
&lt;/code&gt;
&lt;example&gt;
Use to depict a code example of how to utilize particular type or member.
&lt;example&gt; This sample shows how to call the GetEmployee method.
 &lt;code&gt;
   class Employee
   {
      public static int Main()
      {
         return GetEmployee();
      }
   }
 &lt;/code&gt;
 &lt;/example&gt;

&lt;list&gt;
Use to depict a bulleted, numbered, tabled list.

&lt;param&gt;
Use to depict the parameters of the method, events etc
E.g.: &lt;param name='name'&gt;description&lt;/param&gt;

&lt;paramref&gt;
Use to depict the name of the parameter.
E.g.: &lt;paramref name=’name’/&gt;

&lt;remarks&gt;
Use to depict additional information about the type or member.
E.g: &lt;remarks&gt;Additional information goes here&lt;/remarks&gt;

&lt;returns&gt;
Use to depict the return value of a method.
E.g: &lt;returns&gt;Returns List&lt;Employee&gt;&lt;/returns&gt;

&lt;see&gt;
Use to depict links to similar topics from within the text or highlights the text in the page.
E.g: 	&lt;see href=&quot;www.google.com&quot;&gt;Google&lt;/see&gt;
&lt;see langword=&quot;true | false&quot;/&gt;

&lt;seealso&gt;
Use to depict links to similar topics at the very end of the documented page similar to 'See also' section of the MSDN help.
E.g: &lt;seealso href=&quot; www.google.com&quot;&gt;Google&lt;/seealso&gt;

&lt;summary&gt;
Use to depict a small description of the type or the member.
E.g: &lt;summary&gt;description&lt;/summary&gt;

&lt;value&gt;
Use to describe the value of the property.
E.g: &lt;value&gt; description&lt;/value&gt;
</pre></p>
<p>Taking into consideration that you have beautifully commented each and every piece of your code you can generate the document with just few clicks.</p>
<p><span style="text-decoration:underline;"><strong>Practice Lesson</strong></span></p>
<p>Step 1) Create a class library project named Document<br />
Step 2) Add a class named Employee to the project.<br />
Step 3) Copy past the code below</p>
<p><pre class="brush: csharp;">

using System;
using System.Collections.Generic;
using System.Web;

namespace Document
{

    /// &lt;summary&gt;
    /// Summary description for Employee
    /// &lt;/summary&gt;
    public class Employee
    {
        /// &lt;summary&gt;
        /// Employee Class default constructor
        /// &lt;/summary&gt;
        public Employee()
        {

        }

        /// &lt;summary&gt;
        /// Employee Class constructor
        /// &lt;c&gt;Employee objEmployee = new Employee('dhaval',25)&lt;/c&gt;
        /// &lt;/summary&gt;
        /// &lt;param name=&quot;name&quot;&gt;Name of the employee&lt;/param&gt;
        /// &lt;param name=&quot;age&quot;&gt;Age of the employee&lt;/param&gt;
        public Employee(string name, int age)
        {

        }

    }

}

</pre></p>
<p>Step 4) Go to project properties &gt;&gt; build section and check XML Document file section under output group as shown below<br />
Step 5) Build the project and go to bin\debug folder. Document.Xml file would have been generated containing all the details required to generate the document<br />
Step 6) Open NDOC and click on add button<br />
Step 7) Provide path of Document.dll in the assembly file name and Document.XML path in XML Doc Filename and click Ok<br />
Step 8 Finally click Build from the ndoc toolbar or select build from documentation menu</p>
<p>To view the output document click View icon from ndoc toolbar or select view from documentation menu.</p>
<p>That’s It. You’re done</p>
<p><strong><span style="text-decoration:underline;">Note:</span> </strong>Above are the very few sample tags related to the visual aspect of the document generation there are number of tags that can handle various other aspect of the document generation like permission, threading, include, exclude etc.</p>
<p>As the internal architecture of the NDOC is based on XML and XSLT one can also generate the Custom Tags of their own.</p>
<p>To play around more you can take the reference of the below official site of NDOC</p>
<p><a href="http://ndoc.sourceforge.net/usersguide.html">http://ndoc.sourceforge.net/usersguide.html</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/153/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/153/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/153/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=153&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2010/04/10/document-generation-in-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>How to load latest image uploaded with the file upload control without hitting refresh button?</title>
		<link>http://dhavalupadhyaya.wordpress.com/2010/03/04/how-to-load-latest-image-uploaded-with-the-file-upload-control-without-hitting-refresh-button/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2010/03/04/how-to-load-latest-image-uploaded-with-the-file-upload-control-without-hitting-refresh-button/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 13:17:54 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[.Net image load problem]]></category>
		<category><![CDATA[.Net Image Problem]]></category>
		<category><![CDATA[Image in .net not refreshed]]></category>
		<category><![CDATA[image not loaded properly]]></category>
		<category><![CDATA[Image Not refereshed]]></category>
		<category><![CDATA[Image Proplem]]></category>
		<category><![CDATA[Image Refresh]]></category>
		<category><![CDATA[Load Image Problem]]></category>
		<category><![CDATA[referesh image]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=116</guid>
		<description><![CDATA[How to load latest image uploaded with the file upload control without hitting refresh button? Problem Scenario: When we use fixed image url and upload an image file with the same name than the image displayed in the browser remains the same as the old one till we go and refresh the page. The below [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=116&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><strong>How to load latest image uploaded with the file upload control without hitting refresh button?</strong></span></p>
<p><span style="text-decoration:underline;">Problem Scenario:</span></p>
<p>When we use fixed image url and upload an image file with the same name than the image displayed in the browser remains the same as the old one till we go and refresh the page.</p>
<p>The below depicted code will perform according to the above explained scenario.</p>
<p><pre class="brush: xml;">
&lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;Default.aspx.cs&quot; Inherits=&quot;FileUpload_Default&quot; %&gt;
&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head runat=&quot;server&quot;&gt;
    &lt;title&gt;Image Test&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
 &lt;form id=&quot;form1&quot; runat=&quot;server&quot;&gt;
        &lt;div&gt;
            &lt;asp:FileUpload ID=&quot;FileUpload1&quot; runat=&quot;server&quot; /&gt;
            &lt;asp:Button ID=&quot;btnUpload&quot; runat=&quot;server&quot; Text=&quot;Upload&quot; OnClick=&quot;btnUpload_Click&quot; /&gt;
            &lt;br /&gt;
            &lt;asp:Image ID=&quot;Image1&quot; ImageUrl=&quot;~/FileUpload/file1.jpg&quot; runat=&quot;server&quot; /&gt;
  			&lt;/div&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre><br />
<pre class="brush: csharp;">
using System;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

public partial class FileUpload_Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }

    protected void btnUpload_Click(object sender, EventArgs e)
    {
        string filePath = string.Concat(Server.MapPath(&quot;file1.jpg&quot;));

        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(filePath);
        }
    }
}
</pre></p>
<p><span style="text-decoration:underline;">Solution:</span></p>
<p>Now to approach this kind of situation their are basically two thing that can be done.</p>
<p>1) Rather than just fixing the image url path of image in .aspx page make the path associated to it in the code behind page as well. Like shown in the below sample code.</p>
<p><pre class="brush: csharp;">

protected void btnUpload_Click(object sender, EventArgs e)
    {
        string filePath = string.Concat(Server.MapPath(&quot;file1.jpg&quot;));

        if (FileUpload1.HasFile)
        {
            FileUpload1.SaveAs(filePath);
        }

         Image1.ImageUrl = filePath;
    }

</pre></p>
<p>OR</p>
<p>2) If you are changing the image url from javascript than just append time or any random number as a part of query string to the image url. Appending the time after the image path will make it treat as a separate request in IIS and the image will be perfectly loaded.</p>
<p><pre class="brush: xml;">

&lt;a href=&quot;http://localhost/MyArticles/FileUpload/file1.jpg?t=11/7/2009%204:25:23%20PM&quot;&gt;http://localhost/MyArticles/FileUpload/file1.jpg?t=11/7/2009%204:25:23%20PM&lt;/a&gt;

</pre></p>
<p>or</p>
<p><pre class="brush: xml;">

http://localhost/MyArticles/FileUpload/file1.jpg?t=63245

</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=116&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2010/03/04/how-to-load-latest-image-uploaded-with-the-file-upload-control-without-hitting-refresh-button/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>URL Remapping in .Net 2.0</title>
		<link>http://dhavalupadhyaya.wordpress.com/2009/01/23/url-remapping-in-net-20/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2009/01/23/url-remapping-in-net-20/#comments</comments>
		<pubDate>Fri, 23 Jan 2009 17:03:17 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[Remap URL]]></category>
		<category><![CDATA[Remap URL in .net]]></category>
		<category><![CDATA[Remapping URL's in web.config file]]></category>
		<category><![CDATA[URL remap in .net]]></category>
		<category><![CDATA[URL Remapping in .Net 2.0]]></category>
		<category><![CDATA[URL Remmaping]]></category>
		<category><![CDATA[urlMappings]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=134</guid>
		<description><![CDATA[In this article I will walk through a concept for URL Remapping in .Net 2.0 The need for url remapping can arise due to several reasons like Generating SEO friendly urls Hiding the actual page or other data from web users. Control over each and every entry and exits for web requests. Etc. .Net 2.0 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=134&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong><span style="color:#ff6600;">In this article I will walk through a concept for URL Remapping in .Net 2.0</span></strong></p>
<p>The need for url remapping can arise due to several reasons like<br />
Generating SEO friendly urls<br />
Hiding the actual page or other data from web users.<br />
Control over each and every entry and exits for web requests.<br />
Etc.<br />
.Net 2.0 gives flexibility to define and remap urls in web.config file as well as generating your own Custom URL Remapper HTTP Module.<br />
I will explain the first approach i.e remap urls in web.config in this post and will try to wrap up the second one in my next article with a pretty decent code sample for building Custom URL Remapper HTTP Module.<br />
<strong>Remapping URL&#8217;s in web.config file.</strong><br />
To Map urls .Net provides a section named  urlMappings in web.config file where one can define the collection for their mapped urls.</p>
<p><pre class="brush: xml;">
&lt;configuration&gt;
&lt;system.web&gt;
 &lt;urlMappings&gt;
  &lt;add url=”~/Home.aspx” mappedUrl=”~/Default.aspx”/&gt;
 &lt;/urlMappings&gt;
&lt;/system.web&gt;
&lt;/configuration&gt;
</pre></p>
<p>Here whenever the request for Home.aspx will come the .Net engine will search for  urlMappings section in web.config file and server the page that is mapped with it. In the above mention example it will server Default.aspx page.<br />
Limitations: To have more control over the urls, regular expression cannot be used. So it is better to build our own  URL Remapper HTTP Module.<br />
<strong>Live World Scenario:</strong><br />
In case of shopping cart with thousands of product categories and catalogs it is very important to make this page SEO Friendly. Though SEO includes several criteria depending on different robots basic idea of URL remains the same. So by using URL Remapping we can generate SEO friendly URLS that robots can easily search.<br />
Like say for example we are having three products categories viz<br />
CellPhones<br />
Computers<br />
DigitalCameras<br />
We can map all the three categories to a single page that servers the purpose of displaying these products based on the product name<br />
So we map all the three to Product.aspx page like shown in the below section.</p>
<p><pre class="brush: xml;">
&lt;configuration&gt;
&lt;system.web&gt;
 &lt;urlMappings&gt;
  &lt;clear/&gt;
  &lt;add url=&quot;~/CellPhones.aspx&quot; mappedUrl=&quot;~/Product.aspx&quot;/&gt;
  &lt;add url=&quot;~/Computers.aspx&quot; mappedUrl=&quot;~/Product.aspx&quot;/&gt;
  &lt;add url=&quot;~/DigitalCameras.aspx&quot; mappedUrl=&quot;~/Product.aspx&quot;/&gt;
&lt;/urlMappings&gt;
&lt;/system.web&gt;
&lt;/configuration&gt;
</pre></p>
<p>Now whenever the request for  CellPhones.aspx,  Computers.aspx or DigitalCameras.aspx comes .Net engine will compile Product.aspx page and will server to the requesting client. In Product.aspx page we can extract the name and make calls to database to get all the products related to the given category.</p>
<p> </p>
<p>To Download code sample<span style="color:#ff6600;"><strong> </strong><a title="URL Remapping Code Sample by Dhaval Upadhyaya" href="http://upadhyayadhaval.googlepages.com/URLRemapping.zip" target="_blank">Click Here </a></span></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/134/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/134/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/134/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=134&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2009/01/23/url-remapping-in-net-20/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
		<item>
		<title>Modify Web Configuration file without restarting asp net worker process (aspnet_wp).</title>
		<link>http://dhavalupadhyaya.wordpress.com/2008/10/19/modify-web-configuration-file-without-restarting-asp-net-worker-process-aspnet_wp/</link>
		<comments>http://dhavalupadhyaya.wordpress.com/2008/10/19/modify-web-configuration-file-without-restarting-asp-net-worker-process-aspnet_wp/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 09:11:02 +0000</pubDate>
		<dc:creator>Dhaval Upadhyaya</dc:creator>
				<category><![CDATA[Configuration]]></category>
		<category><![CDATA[aspnet_wp]]></category>
		<category><![CDATA[aspnet_wp restart while changing configuration file]]></category>
		<category><![CDATA[aspnet_wp restart while changing web config]]></category>
		<category><![CDATA[aspnet_wp restart while changing web.config]]></category>
		<category><![CDATA[Change configuration file without restarting aspnet_wp]]></category>
		<category><![CDATA[Change web config without restarting aspnet_wp]]></category>
		<category><![CDATA[Change web.config without restarting aspnet_wp]]></category>
		<category><![CDATA[donot restart aspnet_wp]]></category>
		<category><![CDATA[stop restarting aspnet_wp]]></category>

		<guid isPermaLink="false">http://dhavalupadhyaya.wordpress.com/?p=124</guid>
		<description><![CDATA[Modify Web Configuration file without restarting asp net worker process (aspnet_wp). No one in the world can say that web.config file will remain intact after the deployment. Modifications have to happen to some or the other parameters of the web configuration file like one has to add or remove key value pairs from appsettings section [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=124&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><span style="color:#ff6600;"><strong>Modify Web Configuration file without restarting asp net worker process (aspnet_wp).</strong></span></p>
<p>No one in the world can say that web.config file will remain intact after the deployment. Modifications have to happen to some or the other parameters of the web configuration file like one has to add or remove key value pairs from appsettings section etc…</p>
<p>So what?<br />
As soon as the webs configuration file is saved the aspnet_wp worker process of that particular web application gets restarted and all the current sessions and data are lost.</p>
<p>This can cause tremendous issues to an organization whose application needs to be up for 24*7.</p>
<p>To recover from such kind of scenario Microsoft has already provided a great tweak to handle this.</p>
<p>Following are some steps that need to be followed.<br />
Step 1) Make a separate configuration file lets say for example appsettings.config with the following xml data.</p>
<p><pre class="brush: xml;">

&lt;?xml version=&quot;1.0&quot;?&gt;
&lt;appSettings&gt;
  &lt;clear/&gt;
  &lt;add key=&quot;Name&quot; value=&quot;Dhaval&quot;/&gt;
  &lt;add key=&quot;Surname&quot; value=&quot;Upadhyaya&quot;/&gt;
&lt;/appSettings&gt;

</pre></p>
<p>Step 2) Now in the original web.config file make your appSettings section look like below</p>
<p><pre class="brush: xml;">

&lt;appSettings configSource=&quot;appsettings.config&quot;&gt;
&lt;/appSettings&gt;

</pre></p>
<p>You are done.</p>
<p> <br />
Place a debug point on the Application_Start event in global.asax file and check that changing appsettings.config does not restart the worker process.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/dhavalupadhyaya.wordpress.com/124/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/dhavalupadhyaya.wordpress.com/124/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/dhavalupadhyaya.wordpress.com/124/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=dhavalupadhyaya.wordpress.com&amp;blog=3874716&amp;post=124&amp;subd=dhavalupadhyaya&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://dhavalupadhyaya.wordpress.com/2008/10/19/modify-web-configuration-file-without-restarting-asp-net-worker-process-aspnet_wp/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/43e17fb661c7183b78a0ff22ace00644?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">dhavalupadhyaya</media:title>
		</media:content>
	</item>
	</channel>
</rss>
