<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Tech Treasure</title>
	<atom:link href="http://chiragrdarji.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://chiragrdarji.wordpress.com</link>
	<description>Articles of ASP.NET, C#, SQL Server, Timesaver Tools and something about me</description>
	<lastBuildDate>Fri, 09 Oct 2009 07:39:54 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='chiragrdarji.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://www.gravatar.com/blavatar/458454f1318868bb5eaffe9ecffeb805?s=96&#038;d=http://s.wordpress.com/i/buttonw-com.png</url>
		<title>Tech Treasure</title>
		<link>http://chiragrdarji.wordpress.com</link>
	</image>
			<item>
		<title>Set Full Image Path in FCK Editor</title>
		<link>http://chiragrdarji.wordpress.com/2009/10/09/set-full-image-path-in-fck-editor-2/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/10/09/set-full-image-path-in-fck-editor-2/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 07:39:54 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/2009/10/09/set-full-image-path-in-fck-editor-2/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; We have used FCK editor as an HTML editor for our recent project. It is one the best and easy to integrate HTML editor available free. When I test the editor on local server and it works fine. However when we add image using FCK editor the image path is relative to tour webpage. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=252&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#160;&#160;&#160;&#160;&#160;&#160;&#160; We have used FCK editor as an HTML editor for our recent project. It is one the best and easy to integrate HTML editor available free. When I test the editor on local server and it works fine. However when we add image using FCK editor the image path is relative to tour webpage. So if you have created an email template using FCK editor and you sends email to your customers they will not able see the image. </p>
<p><a href="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor.jpg"><img style="display:inline;border-width:0;" title="Set Full Image Path in FCK Editor" border="0" alt="Set Full Image Path in FCK Editor" src="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor_thumb.jpg?w=393&#038;h=350" width="393" height="350" /></a> </p>
<p>Fig &#8211; (1) Relative Image path in FCK editor</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; We need to use <strong>full image path</strong> <strong>in FCK editor</strong> to display the image. You can change <strong>SetUrl</strong> function at following place to <strong>set full image path in FCK editor</strong>. You can find SetUrl function in <strong>fck_image.js</strong> fule at “FckEditor\editor\dialog\fck_image”. Below is the original function,</p>
</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, &#39;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function SetUrl( url, width, height, alt )</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">{</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> ( sActualBrowser == <span style="color:#006080;">'Link'</span> )</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        GetE(<span style="color:#006080;">'txtLnkUrl'</span>).<span style="color:#0000ff;">value</span> = url ;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        UpdatePreview() ;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">else</span></pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        GetE(<span style="color:#006080;">'txtUrl'</span>).<span style="color:#0000ff;">value</span> = url ;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        GetE(<span style="color:#006080;">'txtWidth'</span>).<span style="color:#0000ff;">value</span> = width ? width : <span style="color:#006080;">''</span> ;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        GetE(<span style="color:#006080;">'txtHeight'</span>).<span style="color:#0000ff;">value</span> = height ? height : <span style="color:#006080;">''</span> ;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span> ( alt )</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            GetE(<span style="color:#006080;">'txtAlt'</span>).<span style="color:#0000ff;">value</span> = alt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        UpdatePreview() ;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        UpdateOriginal( <span style="color:#0000ff;">true</span> ) ;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&#160;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    dialog.SetSelectedTab( <span style="color:#006080;">'Info'</span> ) ;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">}</pre>
</p></div>
</div>
<p>Fig &#8211; (2) SetUrl function of FCK Editor</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Change GetE(‘txtUrl’).value = url, first line in else condition to GetE(‘txtUrl’).value = “http://www.xyz.com” + url. See the changed line below,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, &#39;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, &#39;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">GetE(<span style="color:#006080;">'txtUrl'</span>).<span style="color:#0000ff;">value</span> = <span style="color:#006080;">'http://www.xyz.com'</span> + url ;</pre>
</p></div>
</div>
<p>Fig &#8211; (3) Changed function.</p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Save <strong>fck_image.js</strong>&#160; file and now check the image path. FCK editor will take full image path instead of relative.</p>
<p><a href="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor2.jpg"><img style="display:inline;border-width:0;" title="Set Full Image Path in FCK Editor 2" border="0" alt="Set Full Image Path in FCK Editor 2" src="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor2_thumb.jpg?w=410&#038;h=365" width="410" height="365" /></a> </p>
<p>Fig &#8211; (4) Full Image Path in FCK Editor</p>
<p>&#160;</p>
<p><strong>Set Full path for Flash File</strong></p>
<p>&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; Same way you have to change <strong>fck_flash.js</strong> file at FckEditor\editor\dialog\fck_flash folder to set fill flash path in FCK Editor. </p>
</p>
<p>&#160;</p>
<p>Happy Programming !!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/252/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/252/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/252/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=252&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/10/09/set-full-image-path-in-fck-editor-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>

		<media:content url="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor_thumb.jpg" medium="image">
			<media:title type="html">Set Full Image Path in FCK Editor</media:title>
		</media:content>

		<media:content url="http://chiragrdarji.files.wordpress.com/2009/10/setfullimagepathinfckeditor2_thumb.jpg" medium="image">
			<media:title type="html">Set Full Image Path in FCK Editor 2</media:title>
		</media:content>
	</item>
		<item>
		<title>AJAX UpdatePanel and UpdateProgress to show please wait</title>
		<link>http://chiragrdarji.wordpress.com/2009/08/20/ajax-updatepanel-and-updateprogress-to-show-please-wait/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/08/20/ajax-updatepanel-and-updateprogress-to-show-please-wait/#comments</comments>
		<pubDate>Thu, 20 Aug 2009 20:03:03 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/2009/08/20/ajax-updatepanel-and-updateprogress-to-show-please-wait/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160; While refreshing the AJAX skill today I wrote a simple code to display please wait message while asynchronous postback. I added one Update Panel, one Update Progress panel and a button control and registered button&#160; as Asynchronous Postback Trigger control. I assign my UpdatePanel’s id as AssociatedUpdatePanelID to UpdateProgress panel. I ran the code [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=246&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="justify">&#160;&#160;&#160;&#160; While refreshing the AJAX skill today I wrote a simple code to display <strong>please wait message while asynchronous postback</strong>. I added one Update Panel, one Update Progress panel and a button control and registered button&#160; as Asynchronous Postback Trigger control. I assign my UpdatePanel’s id as AssociatedUpdatePanelID to UpdateProgress panel. I ran the code found that Progress panel is not displayed while async postback, strange !!!! Then I remember few basic points regarding Update Panel and Update Progress which is available on <a href="http://msdn.microsoft.com/hi-in/library/system.web.ui.updateprogress(en-us).aspx" target="_blank">MSDN</a> and found that If we set AssociatedUpdatePanelID to Update Progress panel then we must have to button as inside Update Panel if register button as Async Postback trigger then it will not work. Below is the points (that MSDN Suggests) needs to remember while using UpdateProgress,</p>
<p align="justify">The AssociatedUpdatePanelID property has the following effect on UpdateProgress control behavior, </p>
<p align="justify"><strong>When the AssociatedUpdatePanelID property is not set, the UpdateProgress control is displayed for the following postbacks: </strong></p>
<ul>
<li>
<div align="justify">Postbacks that originate from inside any UpdatePanel control. </div>
</li>
<li>
<div align="justify">Postbacks that originate from controls that are asynchronous triggers for any UpdatePanel control. </div>
</li>
</ul>
<p align="justify"><strong>When the AssociatedUpdatePanelID property is set to an UpdatePanel control ID, the UpdateProgress control is displayed for postbacks that originate from inside the associated UpdatePanel control.</strong> </p>
<p align="justify">If the AssociatedUpdatePanelID property is set to a control that does not exist, the UpdateProgress control will never be shown. </p>
<p align="justify"><strong>You must provide client script to display an UpdateProgress control when a target UpdatePanel control is updated in the following circumstances</strong></p>
<ul>
<li>
<div align="justify">When a postback from a control is registered as an asynchronous postback trigger for the panel, and there is an UpdateProgress control on the page. However, the AssociatedUpdatePanelID property is not set to the panel&#8217;s ID. </div>
</li>
<li>
<div align="justify">When postbacks from controls are registered as asynchronous postback controls by using the RegisterAsyncPostBackControl method of the ScriptManager control. </div>
</li>
</ul>
<p>&#160;</p>
<p>Happy Programming!!!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/246/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/246/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/246/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=246&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/08/20/ajax-updatepanel-and-updateprogress-to-show-please-wait/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>Context.RewritePath and Images</title>
		<link>http://chiragrdarji.wordpress.com/2009/08/19/context-rewritepath-and-images/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/08/19/context-rewritepath-and-images/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 19:32:23 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/2009/08/19/context-rewritepath-and-images/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160; I was reading articles on URL Rewriting in ASP.NET and I found the most common way suggested is to use Context.RewritePath either in global.asax file or in HttpHandler with Application_BeginRequest method. The most common found code is Context.RewritePath(NewURL). When you the application you find it works like a charm and yes it does so!!!!. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=245&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p align="justify">&#160;&#160;&#160;&#160; I was reading articles on URL Rewriting in ASP.NET and I found the most common way suggested is to use <strong>Context.RewritePath </strong>either in global.asax file or in HttpHandler with Application_BeginRequest method. The most common found code is <strong>Context.RewritePath</strong>(NewURL). When you the application you find it works like a charm and yes it does so!!!!. </p>
<p align="justify">&#160;&#160;&#160;&#160; However sometime <strong>Images and CSS are not displayed</strong> on page when we use <strong>Context.RewritePath.</strong> Let me be more specific if you have a hierarchy as shown below,</p>
<p><a href="http://chiragrdarji.files.wordpress.com/2009/08/imagesnotdisplayedcontext-rewritepath.jpg"><img title="ImagesNotDisplayedContext.RewritePath" style="display:inline;border-width:0;" height="198" alt="ImagesNotDisplayedContext.RewritePath" src="http://chiragrdarji.files.wordpress.com/2009/08/imagesnotdisplayedcontext-rewritepath_thumb.jpg?w=207&#038;h=198" width="207" border="0" /></a> </p>
<p>Fig &#8211; (1) Website structure</p>
<p align="justify">&#160;&#160;&#160;&#160;&#160;&#160; Now if you have used images on Default2.aspx and also have css for controls. We have redirected user to Default2.aspx page using <strong>Context.RewritePath</strong> path when there is no specific file available physically. So here if we write the URL <a href="http://localhost:3030/Example1/Test.aspx">http://localhost:3030/Example1/Test.aspx</a> then we are redirected to Default.aspx page and images will be displayed properly. However id you type URL <a href="http://localhost:3030/Example1/Products/Test.aspx">http://localhost:3030/Example1/Products/Test.aspx</a> then we are redirected to Default.aspx page however <strong>images will not be displayed</strong>.</p>
<p align="justify">&#160;&#160;&#160;&#160;&#160;&#160; Even if you have assign ImageURL using “~/Images/Image1.jpg” you find that images will not be displayed. The image path will always taken as relative path with the URL mentioned in address bar. So in first case the virtual path of image becomes Example1/Images/Image1.jpg while in second case the virtual path of image becomes Example1/Products/Images/Image1.jpg. So in second case <strong>images and css will not displayed with</strong> <strong>Context.RewritePath.</strong></p>
<p align="justify">&#160;&#160;&#160;&#160;&#160; To solve this use second argument with <strong>Context.RewritePath</strong> so the function will be <strong>Context.RewritePath</strong>(NewURL,<strong>false</strong>) and everything will work fine. if second argument is true reset the virtual path else the virtual path will not be changed. As we want virtual path to be unchanged we have to pass false in second argument.</p>
<p align="justify">Pleas read <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=105061" target="_blank">this article</a> for more detail.</p>
<p>Happy Programming !!!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/245/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/245/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/245/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=245&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/08/19/context-rewritepath-and-images/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>

		<media:content url="http://chiragrdarji.files.wordpress.com/2009/08/imagesnotdisplayedcontext-rewritepath_thumb.jpg" medium="image">
			<media:title type="html">ImagesNotDisplayedContext.RewritePath</media:title>
		</media:content>
	</item>
		<item>
		<title>How to detect page is loaded</title>
		<link>http://chiragrdarji.wordpress.com/2009/08/12/how-to-detect-page-is-loaded/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/08/12/how-to-detect-page-is-loaded/#comments</comments>
		<pubDate>Wed, 12 Aug 2009 18:59:31 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/2009/08/12/how-to-detect-page-is-loaded/</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160; Sometime we need to find when the page is loaded or page is completely loaded before specific java script function is called.&#160; As we all know if try to access DOM element using document.getElementBtId() before page is loaded or page is completely loaded we get error. So to prevent the error we can user [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=242&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&#160;&#160;&#160;&#160;&#160; Sometime we need to find when the <strong>page is loaded</strong> or <strong>page is completely loaded</strong> before specific java script function is called.&#160; As we all know if try to access DOM element using document.getElementBtId() before page is loaded or page is completely loaded we get error. So to prevent the error we can user following java script to detect page is loaded?</p>
<div id="codeSnippetWrapper" style="border-right:silver 1px solid;border-top:silver 1px solid;font-size:8pt;overflow:auto;border-left:silver 1px solid;width:97.5%;cursor:text;direction:ltr;max-height:200px;line-height:12pt;border-bottom:silver 1px solid;font-family:&#39;background-color:#f4f4f4;text-align:left;margin:20px 0 10px;padding:4px;">
<div id="codeSnippet" style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum1" style="color:#606060;">   1:</span> var body = document.getElementsByTagName(<span style="color:#006080;">'BODY'</span>)[0];</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum2" style="color:#606060;">   2:</span>&#160; </pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum3" style="color:#606060;">   3:</span> <span style="color:#0000ff;">if</span> (body &amp;&amp; body.readyState == <span style="color:#006080;">'loaded'</span>) {</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum4" style="color:#606060;">   4:</span>     AfterLoad();</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum5" style="color:#606060;">   5:</span> } <span style="color:#0000ff;">else</span> {        </pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum6" style="color:#606060;">   6:</span>     <span style="color:#0000ff;">if</span> (window.addEventListener) {</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum7" style="color:#606060;">   7:</span>         window.addEventListener(<span style="color:#006080;">'load'</span>, AfterLoad, <span style="color:#0000ff;">false</span>);</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum8" style="color:#606060;">   8:</span>     } <span style="color:#0000ff;">else</span> {</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum9" style="color:#606060;">   9:</span>     window.attachEvent(<span style="color:#006080;">'onload'</span>, AfterLoad);</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum10" style="color:#606060;">  10:</span>     }</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum11" style="color:#606060;">  11:</span> }</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum12" style="color:#606060;">  12:</span> function AfterLoad() {</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:white;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum13" style="color:#606060;">  13:</span>     alert(<span style="color:#006080;">&quot;page loaded !!!&quot;</span>);</pre>
<p><!--CRLF--></p>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;direction:ltr;line-height:12pt;font-family:&#39;background-color:#f4f4f4;text-align:left;border-style:none;margin:0;padding:0;"><span id="lnum14" style="color:#606060;">  14:</span> }</pre>
<p><!--CRLF--></div>
</div>
<p>Fig (1) – Detect Page is loaded !!</p>
<p>&#160;</p>
<p>Happy Programming !!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/242/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/242/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/242/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=242&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/08/12/how-to-detect-page-is-loaded/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>How to set multiple default button in ASP.NET</title>
		<link>http://chiragrdarji.wordpress.com/2009/08/11/how-to-set-multiple-default-button-in-asp-net/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/08/11/how-to-set-multiple-default-button-in-asp-net/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 09:55:28 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=240</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; In my previous post I mentioned the one way to set default button in ASP.NET. There are few other methods also.&#160; One of them is to use asp panel and set its DefaultButton property. When we need to set multiple default buttons on single page we can do it by using asp panels. Lets [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=240&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; In my <a href="http://chiragrdarji.wordpress.com/2007/03/24/default-button-in-aspnet/" target="_blank">previous post</a> I mentioned the one way to set <strong>default button in ASP.NET</strong>. There are few other methods also.&nbsp; One of them is to use asp panel and set its <strong>DefaultButton</strong> property. When we need to set multiple default buttons on single page we can do it by using asp panels. Lets consider that you have login control and search control on same page.&nbsp; User must be redirect to proper page while he press enter on search and login control. Lets look at following code,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;asp:Panel ID=<span style="color:#006080;">"pnlSearch"</span> DefaultButton=<span style="color:#006080;">"btnSearch"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;table width=<span style="color:#006080;">"50%"</span> cellpadding=<span style="color:#006080;">"0"</span> cellspacing=<span style="color:#006080;">"0"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                Search :</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;asp:TextBox ID=<span style="color:#006080;">"txtSerach"</span> runat=<span style="color:#006080;">"server"</span>&gt;&lt;/asp:TextBox&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;asp:Button  ID=<span style="color:#006080;">"btnSearch"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Search"</span> OnClick=<span style="color:#006080;">"btnSearch_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;/table&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;/asp:Panel&gt;</pre>
</div>
</div>
<p>Fig &#8211; (1) <strong>Default Button</strong> with asp panel in ASP.NET</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You can add multiple asp panel and set default button for each panel. I found this as the easiest way to set <strong>multiple default button in asp.net</strong>. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lets look at how default button works. First step is to observe the rendered HTML,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;div id=<span style="color:#006080;">"pnlSearch"</span> onkeypress=<span style="color:#006080;">"javascript:return WebForm_FireDefaultButton(event, 'btnSearch')"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    </pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;table width=<span style="color:#006080;">"50%"</span> cellpadding=<span style="color:#006080;">"0"</span> cellspacing=<span style="color:#006080;">"0"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                Search :</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;input name=<span style="color:#006080;">"txtSerach"</span> type=<span style="color:#006080;">"text"</span> id=<span style="color:#006080;">"txtSerach"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;input type=<span style="color:#006080;">"submit"</span> name=<span style="color:#006080;">"btnSearch"</span> <span style="color:#0000ff;">value</span>=<span style="color:#006080;">"Search"</span> id=<span style="color:#006080;">"btnSearch"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;/table&gt;                        </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;/div&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
</div>
</div>
<p>Fig &#8211; (2) HTML code for <strong>Default Button</strong> with asp panel in ASP.NET</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ASP panel is rendered as DIV.&nbsp; You may have observer that onkeypress event is added to DIV, onkeypress events calles <strong>WebForm_FireDefaultButton</strong>(event, &#8216;btnSearch&#8217;) function. ASP.NET automatically includes <strong>WebForm_FireDefaultButton</strong>&nbsp;function when&nbsp;default button property is set.&nbsp;&nbsp;&nbsp;<strong>WebForm_FireDefaultButton</strong>&nbsp;takes button&#8217;s&nbsp;ClientID as one of the argument and second argument is event. As Click is the&nbsp;default event of button, button click event will be fired on post back. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Now take a look at <strong>WebForm_FireDefaultButton</strong> function,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">function WebForm_FireDefaultButton(<span style="color:#0000ff;">event</span>, target) {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">event</span>.keyCode == 13) {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        var src = <span style="color:#0000ff;">event</span>.srcElement || <span style="color:#0000ff;">event</span>.target;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span> (!src || (src.tagName.toLowerCase() != <span style="color:#006080;">"textarea"</span>)) {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            var defaultButton;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">if</span> (__nonMSDOMBrowser) {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">               defaultButton = document.getElementById(target);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">else</span> {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                defaultButton = document.all[target];</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">if</span> (defaultButton &amp;&amp; <span style="color:#0000ff;">typeof</span>(defaultButton.click) != <span style="color:#006080;">"undefined"</span>) {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                defaultButton.click();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                <span style="color:#0000ff;">event</span>.cancelBubble = <span style="color:#0000ff;">true</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                <span style="color:#0000ff;">if</span> (<span style="color:#0000ff;">event</span>.stopPropagation) <span style="color:#0000ff;">event</span>.stopPropagation();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">false</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">return</span> <span style="color:#0000ff;">true</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">}</pre>
</div>
</div>
<p>Fig (3) &#8211; <strong>WebForm_FireDefaultButton</strong> function&nbsp;included with&nbsp;<strong>default button</strong> </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When user press the enter key while the focus is set to any control within DIV it calls <strong>WebForm_FireDefaultButton</strong> function.</p>
<p>Few interesting articles you may like to read,</p>
<p><a href="http://scottonwriting.net/sowblog/posts/13698.aspx">http://scottonwriting.net/sowblog/posts/13698.aspx</a></p>
<p><a href="http://weblogs.asp.net/rternier/archive/2007/10/17/updatepanel-firefox-and-the-defaultbutton.aspx">http://weblogs.asp.net/rternier/archive/2007/10/17/updatepanel-firefox-and-the-defaultbutton.aspx</a></p>
<p><a href="http://forums.asp.net/t/1409941.aspx">http://forums.asp.net/t/1409941.aspx</a></p>
<p>&nbsp;</p>
<p>Happy Programming !!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/240/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/240/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/240/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=240&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/08/11/how-to-set-multiple-default-button-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>Maintain Viewstate for Dynamic controls across the postback</title>
		<link>http://chiragrdarji.wordpress.com/2009/05/20/maintain-viewstate-for-dynamic-controls-across-the-postback/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/05/20/maintain-viewstate-for-dynamic-controls-across-the-postback/#comments</comments>
		<pubDate>Wed, 20 May 2009 09:11:18 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=238</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160; Most of us have faced the case when we have to load the controls dynamically. We can load user control by calling LoadControl method. To load inbuilt server controls we can use Page.Form.Controls.Add() method or we can user any container like panel or place holder and call Controls.Add() method. Upto this it looks very [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=238&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Most of us have faced the case when we have to load the controls dynamically. We can load user control by calling LoadControl method. To load inbuilt server controls we can use Page.Form.Controls.Add() method or we can user any container like panel or place holder and call Controls.Add() method. Upto this it looks very easy and works fine. However at first postback&nbsp;you either find the control is not loaded or the viewstate is not preserved for that control.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Lets take an example, we have a user control with only one textbox inside it and a web for which have two buttons LoadControl and Submit. When user clicks on LoadControl button we will load the user control and on Submit button we just submit the form so that postback occurs.</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> &lt;%@ Control Language=<span style="color:#006080;">"C#"</span> AutoEventWireup=<span style="color:#006080;">"true"</span> CodeFile=<span style="color:#006080;">"ucTestControl.ascx.cs"</span></pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>      Inherits=<span style="color:#006080;">"ucTestControl"</span> %&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> &lt;asp:TextBox ID=<span style="color:#006080;">"txtName"</span> runat=<span style="color:#006080;">"server"</span>&gt;&lt;/asp:TextBox&gt;</pre>
</div>
</div>
<p>Fig &#8211; (1) User control with only a textbox.</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> &lt;%@ Page Language=<span style="color:#006080;">"C#"</span> AutoEventWireup=<span style="color:#006080;">"true"</span> </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> CodeFile=<span style="color:#006080;">"LoadUserConrtolDynamically.aspx.cs"</span></pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     Inherits=<span style="color:#006080;">"LoadUserConrtolDynamically"</span> %&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span> &lt;!DOCTYPE html PUBLIC <span style="color:#006080;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span> <span style="color:#006080;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span> &lt;html xmlns=<span style="color:#006080;">"http://www.w3.org/1999/xhtml"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span> &lt;head runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span>     &lt;title&gt;Dynamically Load User Control&lt;/title&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span> &lt;/head&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span> &lt;body&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span>     &lt;form id=<span style="color:#006080;">"form1"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span>     &lt;div&gt;       </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span>         &lt;table&gt;            </pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span>             &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span>                 &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  17:</span>                     Click on <span style="color:#006080;">"Load Control"</span> button to load user control dynamically.</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  18:</span>                 &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  19:</span>             &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  20:</span>             &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  21:</span>                 &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  22:</span>                     &lt;asp:Button ID=<span style="color:#006080;">"btnLoad"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Load Control"</span> OnClick=<span style="color:#006080;">"btnLoad_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  23:</span>                 &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  24:</span>                 &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  25:</span>                     &lt;asp:Button ID=<span style="color:#006080;">"btnSubmit"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Submit"</span> OnClick=<span style="color:#006080;">"btnSubmit_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  26:</span>                 &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  27:</span>             &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  28:</span>             &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  29:</span>                 &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  30:</span>                     Enter Name:</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  31:</span>                 &lt;/td&gt;                </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  32:</span>             &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  33:</span>         &lt;/table&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  34:</span>     &lt;/div&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  35:</span>     &lt;/form&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  36:</span> &lt;/body&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  37:</span> &lt;/html&gt;</pre>
</div>
</div>
<p>Fig &#8211; (2) Webform with two buttons.&nbsp;</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnSubmit_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnLoad_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span> {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>     AddUserControl();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span> }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> AddUserControl()</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span>     UserControl ucTest = (UserControl)LoadControl(<span style="color:#006080;">"~/ucTestControl.ascx"</span>);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span>     Page.Form.Controls.Add(ucTest);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span>     IsControlAdded = <span style="color:#0000ff;">true</span>;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span> }</pre>
</div>
</div>
<p>Fig &#8211; (3) Code behind for Webform</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; As you can see we are calling LoadControl() method to load our user control. Now when you click on submit button and you find that the control disappears.&nbsp; WHY? The reason is as we have loaded the control the page&#8217;s control tree does not have its detail so we need to load the control again with each postback. So first rule for lading dynamic control is,</p>
<p><strong>RULE 1 : Load the Dynamic control in each postback</strong></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; So in our example we also need to add the control with each postback. However we need to check that whether the control is loaded before postback or not. To check this I have created one property as shown in code below,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">bool</span> IsControlAdded</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     get</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>     {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>         <span style="color:#0000ff;">if</span> (ViewState[<span style="color:#006080;">"IsControlAdded"</span>] == <span style="color:#0000ff;">null</span>)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>             ViewState[<span style="color:#006080;">"IsControlAdded"</span>] = <span style="color:#0000ff;">false</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   8:</span>         <span style="color:#0000ff;">return</span> (<span style="color:#0000ff;">bool</span>)ViewState[<span style="color:#006080;">"IsControlAdded"</span>];</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   9:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  10:</span>     }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  11:</span>     set</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  12:</span>     {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  13:</span>         ViewState[<span style="color:#006080;">"IsControlAdded"</span>] = <span style="color:#0000ff;">value</span>;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  14:</span>     }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  15:</span> }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  16:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  17:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Page_Load(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  18:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  19:</span>     <span style="color:#0000ff;">if</span>(IsControlAdded)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  20:</span>         AddUserControl();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  21:</span> }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  22:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  23:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnSubmit_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  24:</span> {        </pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  25:</span> }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  26:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  27:</span> <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnLoad_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  28:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  29:</span>     <span style="color:#0000ff;">if</span>(!IsControlAdded)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  30:</span>         AddUserControl();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  31:</span> }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  32:</span> &nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  33:</span> <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> AddUserControl()</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  34:</span> {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  35:</span>     UserControl ucTest = (UserControl)LoadControl(<span style="color:#006080;">"~/ucTestControl.ascx"</span>);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  36:</span>     Page.Form.Controls.Add(ucTest);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  37:</span>     IsControlAdded = <span style="color:#0000ff;">true</span>;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">  38:</span> }</pre>
</div>
</div>
<p>Fig &#8211; (4) loading dynamic control with each postback.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;You may have notice the code the code for lading user control,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> UserControl ucTest = (UserControl)LoadControl(<span style="color:#006080;">"~/ucTestControl.ascx"</span>);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> Page.Form.Controls.Add(ucTest);</pre>
</div>
</div>
<p>Fig &#8211; (5) Code for loading User control Dynamically</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You may also write this two line code in single line as shown below,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> Page.Form.Controls.Add(LoadControl(<span style="color:#006080;">"~/ucTestControl.ascx"</span>));</pre>
</div>
</div>
<p>Fig &#8211; (6) Code for loading Dynamic Control</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If you use this code to load user control dynamically than <u><strong>sometime</strong></u> you find an interesting issue. The viewstate&nbsp;is not maintained for dynamically loaded control&nbsp;!!!!!! The viewstate requires the controls ID to store the viewstate properly. So always use code shown in Fig &#8211; (4) to load user control dynamically.</p>
<p><strong>RULE&nbsp;2 : Always load the Dynamic control&nbsp;by assigning it to one temporary variable so that it has unique id.</strong></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;One more common mistake is we write Page.Controls.Add() to add the control. This will leads to &#8220;<i><strong><font color="#ff0000">Control &#8216;ControlName&#8217; of type &#8216;ControlType&#8217; must be placed inside a form tag with runat=server</font></strong></i>&#8221; error.</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Now we have to find how the viewstate is maintained for dynamically loaded user control. I will suggest you to read <a href="http://www.codeproject.com/KB/aspnet/aspnetviewstatepagecycle.aspx" target="_blank"><strong>this</strong></a> article first. When we add any control dynamically it&nbsp;play &#8220;catch-up&#8221; with the page life cycle once they are added. Once the control is added to the &#8220;<code>Controls"</code> collection, it plays &#8220;catch-up&#8221; with the page life cycle, and all the events that it missed are fired. This leads to a very important conclusion: you can add dynamic controls at any time during the page life cycle until the &#8220;<code>PreRender"</code> event. Even when you add the dynamic control in the &#8220;<code>PreRender"</code> event, once the control is added to the &#8220;<code>Controls"</code> collection, the &#8220;<code>Init"</code>, &#8220;<code>LoadViewState"</code>, &#8220;<code>LoadPostbackdata"</code>, &#8220;<code>Load"</code>, and &#8220;<code>SaveViewstate"</code> are fired for this control. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; We have seen how to load user controls dynamically now we will see how to load inbuilt server controls.&nbsp; The process is same however we don&#8217;t have to use LoadControl method, we can directly use Controls.Add() method as shown below,</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> TextBox tempText = <span style="color:#0000ff;">new</span> TextBox();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> tempText.ID = LstTextBoxId.Count.ToString();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span> <span style="color:#008000;">// pnlTextBox is asp:Panel</span></pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span> pnlTextBox.Controls.Add(tempText);</pre>
</div>
</div>
<p>Fig &#8211; (7) Load server controls at runtime and maintaining viewstate</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Here we have added server controls and user controls dynamically using regular way. You can load user controls / server control dynamically using AJAX also. Below is the code where I have displayed loading controls using AJAX and normal way.</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;%@ Page Language=<span style="color:#006080;">"C#"</span> AutoEventWireup=<span style="color:#006080;">"true"</span> </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CodeFile=<span style="color:#006080;">"LoadUserConrtolDynamically.aspx.cs"</span></pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    Inherits=<span style="color:#006080;">"LoadUserConrtolDynamically"</span> %&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;!DOCTYPE html PUBLIC <span style="color:#006080;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#006080;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;html xmlns=<span style="color:#006080;">"http://www.w3.org/1999/xhtml"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;head runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;title&gt;Dynamically Load User Control&lt;/title&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;/head&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;body&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;form id=<span style="color:#006080;">"form1"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;div&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;asp:ScriptManager ID=<span style="color:#006080;">"ScriptManager1"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;/asp:ScriptManager&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;table&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    Click on <span style="color:#006080;">"Add Textbox"</span> button to add texbox dynamically.</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:Button ID=<span style="color:#006080;">"btnAddTextBox"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Add Textbox"</span> OnClick=<span style="color:#006080;">"btnAddTextBox_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:Panel ID=<span style="color:#006080;">"pnlTextBox"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;/asp:Panel&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:Label ID=<span style="color:#006080;">"lblTest"</span> runat=<span style="color:#006080;">"server"</span>&gt;&lt;/asp:Label&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;br /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    Click on <span style="color:#006080;">"Add Textbox using Ajax"</span> button to add texbox dynamically with Ajax.</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:UpdatePanel ID=<span style="color:#006080;">"upnlLOadControl"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                        &lt;ContentTemplate&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            &lt;asp:Button ID=<span style="color:#006080;">"btnAddTextBoxAjax"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Add Textbox using Ajax"</span> OnClick=<span style="color:#006080;">"btnAddTextBoxAjax_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            &lt;asp:Panel ID=<span style="color:#006080;">"pnlAjaxTextbox"</span> runat=<span style="color:#006080;">"server"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                            &lt;/asp:Panel&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                        &lt;/ContentTemplate&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;/asp:UpdatePanel&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;br /&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    Click on <span style="color:#006080;">"Load Control"</span> button to load user control dynamically.</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:Button ID=<span style="color:#006080;">"btnLoad"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Load Control"</span> OnClick=<span style="color:#006080;">"btnLoad_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    &lt;asp:Button ID=<span style="color:#006080;">"btnSubmit"</span> runat=<span style="color:#006080;">"server"</span> Text=<span style="color:#006080;">"Submit"</span> OnClick=<span style="color:#006080;">"btnSubmit_Click"</span> /&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;td colspan=<span style="color:#006080;">"2"</span>&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                    Enter Name:</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                &lt;/td&gt;                </pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            &lt;/tr&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        &lt;/table&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;/div&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    &lt;/form&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;/body&gt;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;/html&gt;</pre>
</div>
</div>
<p>Fig &#8211; (8) code for aspx page.</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System.Collections.Generic;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System.Linq;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System.Web;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System.Web.UI;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">using</span> System.Web.UI.WebControls;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;"><span style="color:#0000ff;">public</span> <span style="color:#0000ff;">partial</span> <span style="color:#0000ff;">class</span> LoadUserConrtolDynamically : System.Web.UI.Page</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">{</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">public</span> <span style="color:#0000ff;">bool</span> IsControlAdded</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        get</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">if</span> (ViewState[<span style="color:#006080;">"IsControlAdded"</span>] == <span style="color:#0000ff;">null</span>)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                ViewState[<span style="color:#006080;">"IsControlAdded"</span>] = <span style="color:#0000ff;">false</span>;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">return</span> (<span style="color:#0000ff;">bool</span>)ViewState[<span style="color:#006080;">"IsControlAdded"</span>];</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        set</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            ViewState[<span style="color:#006080;">"IsControlAdded"</span>] = <span style="color:#0000ff;">value</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">public</span> List&lt;String&gt; LstTextBoxId</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        get</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">if</span> (ViewState[<span style="color:#006080;">"LstTextBoxId"</span>] == <span style="color:#0000ff;">null</span>)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                ViewState[<span style="color:#006080;">"LstTextBoxId"</span>] = <span style="color:#0000ff;">new</span> List&lt;String&gt;();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">return</span> (List&lt;String&gt;)ViewState[<span style="color:#006080;">"LstTextBoxId"</span>];</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        set</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            ViewState[<span style="color:#006080;">"LstTextBoxId"</span>] = <span style="color:#0000ff;">value</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">public</span> List&lt;String&gt; LstAjaxTextBoxId</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        get</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">if</span> (ViewState[<span style="color:#006080;">"LstAjaxTextBoxId"</span>] == <span style="color:#0000ff;">null</span>)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">                ViewState[<span style="color:#006080;">"LstAjaxTextBoxId"</span>] = <span style="color:#0000ff;">new</span> List&lt;String&gt;();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            <span style="color:#0000ff;">return</span> (List&lt;String&gt;)ViewState[<span style="color:#006080;">"LstAjaxTextBoxId"</span>];</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        set</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            ViewState[<span style="color:#006080;">"LstAjaxTextBoxId"</span>] = <span style="color:#0000ff;">value</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> Page_Load(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span>(IsControlAdded)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            AddUserControl();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span> (LstTextBoxId.Count &gt; 0)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            AddTextBoxes(pnlTextBox, LstTextBoxId);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span> (LstAjaxTextBoxId.Count &gt; 0)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            AddTextBoxes(pnlAjaxTextbox, LstAjaxTextBoxId);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnSubmit_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {        </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnLoad_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">if</span>(!IsControlAdded)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            AddUserControl();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> AddUserControl()</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        UserControl ucTest = (UserControl)LoadControl(<span style="color:#006080;">"~/ucTestControl.ascx"</span>);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        Page.Form.Controls.Add(ucTest);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        IsControlAdded = <span style="color:#0000ff;">true</span>;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">private</span> <span style="color:#0000ff;">void</span> AddTextBoxes(Panel pnlTemp,List&lt;String&gt; lstTemp)</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        TextBox tempText;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        <span style="color:#0000ff;">for</span> (<span style="color:#0000ff;">int</span> i = 0; i &lt; lstTemp.Count; i++)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            tempText = <span style="color:#0000ff;">new</span> TextBox();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            tempText.ID = lstTemp[i];</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">            pnlTemp.Controls.Add(tempText);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        }</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnAddTextBox_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    { </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        TextBox tempText = <span style="color:#0000ff;">new</span> TextBox();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        tempText.ID = LstTextBoxId.Count.ToString();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        pnlTextBox.Controls.Add(tempText);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        LstTextBoxId.Add(LstTextBoxId.Count.ToString());</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&nbsp;</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    <span style="color:#0000ff;">protected</span> <span style="color:#0000ff;">void</span> btnAddTextBoxAjax_Click(<span style="color:#0000ff;">object</span> sender, EventArgs e)</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    {</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        TextBox tempText = <span style="color:#0000ff;">new</span> TextBox();</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        tempText.ID = Guid.NewGuid().ToString();</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        pnlAjaxTextbox.Controls.Add(tempText);</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">        LstAjaxTextBoxId.Add(tempText.ID);</pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">    }</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">}</pre>
</div>
</div>
<p>Fig &#8211; (9) Code for aspx.cs page</p>
<div style="border-bottom:gray 1px solid;border-left:gray 1px solid;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:consolas, 'Courier New', courier, monospace;max-height:200px;font-size:8pt;overflow:auto;border-top:gray 1px solid;cursor:text;border-right:gray 1px solid;margin:20px 0 10px;padding:4px;">
<div style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;padding:0;">
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;%@ Control Language=<span style="color:#006080;">"C#"</span> AutoEventWireup=<span style="color:#006080;">"true"</span> </pre>
<pre style="line-height:12pt;background-color:#f4f4f4;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">CodeFile=<span style="color:#006080;">"ucTestControl.ascx.cs"</span> Inherits=<span style="color:#006080;">"ucTestControl"</span> %&gt;</pre>
<pre style="line-height:12pt;background-color:white;width:100%;font-family:consolas, 'Courier New', courier, monospace;color:black;font-size:8pt;overflow:visible;border-style:none;margin:0;padding:0;">&lt;asp:TextBox ID=<span style="color:#006080;">"txtName"</span> runat=<span style="color:#006080;">"server"</span>&gt;&lt;/asp:TextBox&gt;</pre>
</div>
</div>
<p>Fig &#8211; (10) Code for&nbsp;user control</p>
<p>&nbsp;</p>
<p>Happy Programming !!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/238/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/238/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/238/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=238&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/05/20/maintain-viewstate-for-dynamic-controls-across-the-postback/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>Could not load file or assembly Microsoft.SqlServer.Management.Sdk.Sfc</title>
		<link>http://chiragrdarji.wordpress.com/2009/05/14/could-not-load-file-or-assembly-microsoft-sqlserver-management-sdk-sfc/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/05/14/could-not-load-file-or-assembly-microsoft-sqlserver-management-sdk-sfc/#comments</comments>
		<pubDate>Thu, 14 May 2009 06:19:58 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Sql Server]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=233</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160; You may receive &#8220;Could not load file or assembly Microsoft.SqlServer.Management.Sdk.Sfc&#8221; while connection to database.&#160; I got the error when I tried to connect to SQL Server 2005 from Visual studio 2008 using server explorer. The exact error is,
Could not load file or assembly ‘Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ or one of its dependencies. The system [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=233&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You may receive &#8220;Could not load file or assembly Microsoft.SqlServer.Management.Sdk.Sfc&#8221; while connection to database.&nbsp; I got the error when I tried to connect to SQL Server 2005 from Visual studio 2008 using server explorer. The exact error is,</p>
<blockquote><p>Could not load file or assembly ‘Microsoft.SqlServer.Management.Sdk.Sfc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91′ or one of its dependencies. The system cannot find the file specified.</p>
</blockquote>
<p><font color="#666666">&nbsp;&nbsp;&nbsp;&nbsp; To solve this error you need to <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=C6C3E9EF-BA29-4A43-8D69-A2BED18FE73C&amp;displaylang=en" target="_blank">download</a> following three updates from Microsoft.</font></p>
<ul>
<li>Microsoft SQL Server System CLR Types</li>
<li>Microsoft SQL Server 2008 Management Objects</li>
<li>Microsoft SQL Server 2008 Native Client</li>
</ul>
<p>I found the solution form <a href="http://www.aghausman.net/dotnet/could-not-load-file-or-assembly-microsoftsqlservermanagementsdksfc.html" target="_blank">here</a>. Thanks to Ahmed !!!</p>
<p><font color="#666666"></font></p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/233/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/233/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/233/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=233&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/05/14/could-not-load-file-or-assembly-microsoft-sqlserver-management-sdk-sfc/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>The current build operation (build key Build Key[Microsoft.Practices.EnterpriseLibrary.Data.Database, null]) failed: The value can not be null or an empty string. (Strategy type ConfiguredObjectStrategy, index 2)</title>
		<link>http://chiragrdarji.wordpress.com/2009/01/07/the-current-build-operation-build-key-build-keymicrosoftpracticesenterpriselibrarydatadatabase-null-failed-the-value-can-not-be-null-or-an-empty-string-strategy-type-configuredobjectstrate/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/01/07/the-current-build-operation-build-key-build-keymicrosoftpracticesenterpriselibrarydatadatabase-null-failed-the-value-can-not-be-null-or-an-empty-string-strategy-type-configuredobjectstrate/#comments</comments>
		<pubDate>Wed, 07 Jan 2009 12:37:05 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=231</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; You may find this error while working with Data Application block in enterprise library. When you look into the inner exception you will find the message &#8220;The value can not be null or an empty string.&#8221;.&#160; This message does not give proper information to user. 
&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; When enterprise library does not find default database [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=231&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; You may find this error while working with Data Application block in enterprise library. When you look into the inner exception you will find the message &#8220;The value can not be null or an empty string.&#8221;.&nbsp; This message does not give proper information to user. </p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When enterprise library does not find default database than it will show this error. You need to add &#8220;defaultDatabase&#8221; in web.config file to solve this error.</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;max-height:200px;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> &lt;configuration&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span>     &lt;configSections&gt;          </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   3:</span>     &lt;/configSections&gt;  </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   4:</span>     &lt;connectionStrings&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   5:</span>         &lt;add connectionString=<span style="color:#006080;">""</span> providerName=<span style="color:#006080;">"System.Data.SqlClient"</span>  name=<span style="color:#006080;">"ConnectionStr"</span>/&gt;    </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   6:</span>     &lt;/connectionStrings&gt;</pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   7:</span>   &lt;dataConfiguration defaultDatabase=<span style="color:#006080;">"ConnectionStr"</span> /&gt;</pre>
</div>
</div>
<p>Fig &#8211; (1) Add DataConfiguration section to web.config file to avoid error</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; When you add &lt;dataConfiguration defaultDatabase=&#8221;ConnectionStr&#8221; /&gt; tag to web.config file you may get &#8220;Unrecognized configuration section dataConfiguration&#8221; error. Add &#8220;dataConfiguration&#8221; section in Configuration section to solve &#8220;Unrecognized configuration section dataConfiguration&#8221; error.</p>
<div style="border-right:gray 1px solid;border-top:gray 1px solid;font-size:8pt;overflow:auto;border-left:gray 1px solid;width:97.5%;cursor:text;line-height:12pt;border-bottom:gray 1px solid;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;max-height:200px;margin:20px 0 10px;padding:4px;">
<div style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;padding:0;">
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:white;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   1:</span> &lt;section name=<span style="color:#006080;">"dataConfiguration"</span> </pre>
<pre style="font-size:8pt;overflow:visible;width:100%;color:black;line-height:12pt;font-family:consolas, 'Courier New', courier, monospace;background-color:#f4f4f4;border-style:none;margin:0;padding:0;"><span style="color:#606060;">   2:</span> type=<span style="color:#006080;">"Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"</span> /&gt;</pre>
</div>
</div>
<p>Fig &#8211; (2) Solution of Unrecognized configuration section dataConfiguration error</p>
<p>&nbsp;</p>
<p>Happy Programming!!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/231/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/231/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/231/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=231&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/01/07/the-current-build-operation-build-key-build-keymicrosoftpracticesenterpriselibrarydatadatabase-null-failed-the-value-can-not-be-null-or-an-empty-string-strategy-type-configuredobjectstrate/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>An error occurred creating the configuration section, &#8216;Microsoft.Practices.EnterpriseLibrary,The located assembly&#8217;s manifest definition does not match the assembly reference</title>
		<link>http://chiragrdarji.wordpress.com/2009/01/05/an-error-occurred-creating-the-configuration-section-microsoftpracticesenterpriselibrarythe-located-assemblys-manifest-definition-does-not-match-the-assembly-reference/</link>
		<comments>http://chiragrdarji.wordpress.com/2009/01/05/an-error-occurred-creating-the-configuration-section-microsoftpracticesenterpriselibrarythe-located-assemblys-manifest-definition-does-not-match-the-assembly-reference/#comments</comments>
		<pubDate>Mon, 05 Jan 2009 11:34:13 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=229</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160; Today I was exploring Enterprise Library 4.1 and encounter this error. I created a sample application and added reference to few DLL from &#8220;EntLib41Src\bin&#8221; folder to my application. When I hit F5 to run the application I got following error,
&#8220;An error occurred creating the configuration section handler for exceptionHandling: Could not load file or [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=229&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp; Today I was exploring Enterprise Library 4.1 and encounter this error. I created a sample application and added reference to few DLL from &#8220;EntLib41Src\bin&#8221; folder to my application. When I hit F5 to run the application I got following error,</p>
<p>&#8220;<font color="#ff0000">An error occurred creating the configuration section handler for exceptionHandling: Could not load file or assembly &#8216;Microsoft.Practices.EnterpriseLibrary.ExceptionHandling, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35&#8242; or one of its dependencies. The located assembly&#8217;s manifest definition does not match the assembly reference. (Exception from HRESULT: 0&#215;80131040)</font>&#8220;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; While searching for the reason I found a link <a href="http://blogs.msdn.com/tomholl/archive/2007/04/19/avoiding-configuration-pitfalls-with-incompatible-copies-of-enterprise-library.aspx" target="_blank">here.</a> According to this link assemblies in &#8220;EntLib41Src\bin&#8221; folders are not strong name assemblies. So when you run the application you will encounter error as shown above. While &#8220;Program Files\Microsoft Enterprise Library 4.1 &#8211; October 2008\Bin&#8221; folder contains strong name assemblies. You have to add reference from &#8220;Program Files\Microsoft Enterprise Library 4.1 &#8211; October 2008\Bin&#8221; folder in your application.</p>
<p>Happy Programming !!!</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/229/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/229/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/229/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=229&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2009/01/05/an-error-occurred-creating-the-configuration-section-microsoftpracticesenterpriselibrarythe-located-assemblys-manifest-definition-does-not-match-the-assembly-reference/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
		<item>
		<title>Distributed Caching Framework &quot;Velocity&quot; from MS</title>
		<link>http://chiragrdarji.wordpress.com/2008/12/24/distributed-caching-framework-velocity-from-ms/</link>
		<comments>http://chiragrdarji.wordpress.com/2008/12/24/distributed-caching-framework-velocity-from-ms/#comments</comments>
		<pubDate>Wed, 24 Dec 2008 11:54:33 +0000</pubDate>
		<dc:creator>chiragrdarji</dc:creator>
				<category><![CDATA[DotNet 2.0]]></category>
		<category><![CDATA[DotNet 3.0]]></category>
		<category><![CDATA[Techincal]]></category>

		<guid isPermaLink="false">http://chiragrdarji.wordpress.com/?p=225</guid>
		<description><![CDATA[&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160;&#160; &#8220;Velocity&#8221; a caching framework introduced by Microsoft for distributed caching in ASP.NET. When you use &#8220;Velocity,&#8221; you can retrieve data by using keys or other identifiers, named &#8220;tags.&#8221; &#8220;Velocity&#8221; supports optimistic and pessimistic concurrency models, high availability, and a variety of cache configurations. “Velocity” includes an ASP.NET session provider object that enables you to [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=225&subd=chiragrdarji&ref=&feed=1" />]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &#8220;Velocity&#8221; a caching framework introduced by Microsoft for distributed caching in ASP.NET. When you use &#8220;Velocity,&#8221; you can retrieve data by using keys or other identifiers, named &#8220;tags.&#8221; &#8220;Velocity&#8221; supports optimistic and pessimistic concurrency models, high availability, and a variety of cache configurations. “Velocity” includes an ASP.NET session provider object that enables you to store ASP.NET session objects in the distributed cache without having to write to databases, which increases the performance and scalability of ASP.NET applications.</p>
<h5>Key Features of “Velocity”</h5>
<ul>
<li>Caches any serializable CLR object and provides access through simple cache APIs.
<li>Supports enterprise scale: tens to hundreds of computers.
<li>Configurable to run as a service accessed over the network or run embedded with the application.
<li>Supports common cache configurations.
<li>Supports dynamic scaling by adding new nodes.
<li>Configurable number of backup copies to provide high availability.
<li>Automatic load balancing.
<li>Integration with administration and monitoring tools such as ETW, System Center, etc.
<li>Provides tight integration with ASP.NET to be able to cache ASP.NET session data in the cache without having to write it to source databases. It can also be used as a cache for application data to be able to cache application data across the entire Web farm.
<li>Follows the cache-aside architecture (also known as Explicit Caching) for V1. That is, you must decide explicitly which objects to put/remove in your applications and “Velocity” does not synchronize with any source database automatically.
<li>Support for multiple client languages (for example, PHP, C#, C++, etc.).</li>
</ul>
<p>&nbsp;</p>
<p>For more detail visit <a href="http://msdn.microsoft.com/hi-in/library/cc645013(en-us).aspx" target="_blank">here</a>.</p>
  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/chiragrdarji.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/chiragrdarji.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/chiragrdarji.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/chiragrdarji.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/chiragrdarji.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/chiragrdarji.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/chiragrdarji.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/chiragrdarji.wordpress.com/225/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/chiragrdarji.wordpress.com/225/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/chiragrdarji.wordpress.com/225/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=chiragrdarji.wordpress.com&blog=615156&post=225&subd=chiragrdarji&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://chiragrdarji.wordpress.com/2008/12/24/distributed-caching-framework-velocity-from-ms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/4f713b8273537ef65495a6ece1b5b403?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">chiragrdarji</media:title>
		</media:content>
	</item>
	</channel>
</rss>