<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Sehajpal.com &#187; Development</title>
	<atom:link href="http://www.sehajpal.com/index.php/category/development/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sehajpal.com</link>
	<description>No path is too difficult. No destination is too far !</description>
	<lastBuildDate>Thu, 22 Dec 2011 07:31:34 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>How to change calendar icon in telerik asp.net control</title>
		<link>http://www.sehajpal.com/index.php/2011/03/how-to-change-calendar-icon-in-telerik-asp-net-control/</link>
		<comments>http://www.sehajpal.com/index.php/2011/03/how-to-change-calendar-icon-in-telerik-asp-net-control/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 11:01:22 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Telerik]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=319</guid>
		<description><![CDATA[It was very hard to find a work around to solve this problem as there was nothing helpful available on internet. Just use the following line of code inside calendar tag i.e. before this line &#60;/radcln:raddatepicker&#62;.   &#60;DatePopupButton ImageUrl=&#8221;~/RadControls/Calendar/Skins/myStyle/Img/datePickerPopup.gif&#8221; HoverImageUrl=&#8221;~/RadControls/Calendar/Skins/myStyle/Img/datePickerPopupHover.gif&#8221; /&#62;]]></description>
			<content:encoded><![CDATA[<p>It was very hard to find a work around to solve this problem as there was nothing helpful available on internet.</p>
<p>Just use the following line of code inside calendar tag i.e. before this line &lt;/radcln:raddatepicker&gt;.  </p>
<p>&lt;DatePopupButton ImageUrl=&#8221;~/RadControls/Calendar/Skins/myStyle/Img/datePickerPopup.gif&#8221; HoverImageUrl=&#8221;~/RadControls/Calendar/Skins/myStyle/Img/datePickerPopupHover.gif&#8221; /&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2011/03/how-to-change-calendar-icon-in-telerik-asp-net-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to remove dotted line from HTML link, check box and radio buttons</title>
		<link>http://www.sehajpal.com/index.php/2011/03/how-to-remove-dotted-line-from-html-link-check-box-and-radio-buttons/</link>
		<comments>http://www.sehajpal.com/index.php/2011/03/how-to-remove-dotted-line-from-html-link-check-box-and-radio-buttons/#comments</comments>
		<pubDate>Mon, 14 Mar 2011 09:19:59 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=315</guid>
		<description><![CDATA[ Please add the following CSS Styles in your default style sheet or add under style tag in head of the page. input[type="radio"], input[type="checkbox"]{ outline: none; } a{text-decoration: none; outline: 0; }]]></description>
			<content:encoded><![CDATA[<p> Please add the following CSS Styles in your default style sheet or add under style tag in head of the page.</p>
<div><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;">input[type="radio"]</span></span></span></span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">,</span></span></div>
<div>
<p><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;">input[type="checkbox"]</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">{ </span></span><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;">outline</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">: </span></span><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;">none</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">; }</span></span></p>
<div><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><span style="font-family: Consolas; color: #800000; font-size: x-small;"><br />
a</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">{</span></span><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;">text-decoration</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">: </span></span><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;">none</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">; </span></span><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;"><span style="font-family: Consolas; color: #ff0000; font-size: x-small;">outline</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">: </span></span><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;"><span style="font-family: Consolas; color: #0000ff; font-size: x-small;">0</span></span></span><span style="font-family: Consolas; font-size: x-small;"><span style="font-family: Consolas; font-size: x-small;">; }</span></span></div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2011/03/how-to-remove-dotted-line-from-html-link-check-box-and-radio-buttons/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graceful Degrading to HTML or ASP.Net page</title>
		<link>http://www.sehajpal.com/index.php/2011/02/graceful-degrading-to-html-or-asp-net-page/</link>
		<comments>http://www.sehajpal.com/index.php/2011/02/graceful-degrading-to-html-or-asp-net-page/#comments</comments>
		<pubDate>Fri, 04 Feb 2011 14:25:15 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=312</guid>
		<description><![CDATA[Have you ever wonder how Microsoft checks if the Silverlight plugin is not unstalled on your your system then the default ASP.Net website should appear otherwise new Silverlight website must be presented ? here is the trick called Graceful Degrading In case no Silverlight plugin has been installed on client’s machine, just present asp.net or HTML version]]></description>
			<content:encoded><![CDATA[<p>Have you ever wonder how Microsoft checks if the Silverlight plugin is not unstalled on your your system then the default ASP.Net website should appear otherwise new Silverlight website must be presented ?</p>
<p>here is the trick called <strong>Graceful Degrading </strong></p>
<p>In case no Silverlight plugin has been installed on client’s machine, just present asp.net or HTML version of your page in the Silverlight Tag of your ASP.Net host page.</p>
<p>&lt;asp:Silverlight ID=&#8221;xamlApp&#8221; runat=&#8221;server&#8221; Source=&#8221;~/ClientBin/SLApp.xap&#8221;</p>
<p>    MinimumVersion=&#8221;2.0.31005.0&#8243;&gt;</p>
<p>    &lt;PluginNotInstalledTemplate&gt;</p>
<p>           &lt;div id=&#8221;someHTML&#8221; &gt;</p>
<p>            &lt;!&#8211; Some HTML website code or ASP.Net webpage code &#8211;&gt;</p>
<p>           &lt;/div&gt;</p>
<p>     &lt;/PluginNotInstalledTemplate&gt;</p>
<p>&lt;/asp:Silverlight&gt;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2011/02/graceful-degrading-to-html-or-asp-net-page/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to convert from IEnumerable to EntitySet to get Entity back in action</title>
		<link>http://www.sehajpal.com/index.php/2010/11/how-to-convert-from-ienumerable-to-entityset-to-get-entity-back-in-action/</link>
		<comments>http://www.sehajpal.com/index.php/2010/11/how-to-convert-from-ienumerable-to-entityset-to-get-entity-back-in-action/#comments</comments>
		<pubDate>Sat, 27 Nov 2010 13:47:35 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[LINQ]]></category>
		<category><![CDATA[SilverLight]]></category>
		<category><![CDATA[WCF]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=301</guid>
		<description><![CDATA[One way of achieving is to use what most google search results find on web i.e.  public static EntitySet&#60;T&#62; ToEntitySet&#60;T&#62; (this IEnumerable&#60;T&#62; source) where T : class     {         var es = new EntitySet&#60;T&#62; ();         es.AddRange (source);         return es;     } Then you could write your query as follows: var questions =]]></description>
			<content:encoded><![CDATA[<p>One way of achieving is to use what most google search results find on web i.e.</p>
<p> public static EntitySet&lt;T&gt; ToEntitySet&lt;T&gt; (this IEnumerable&lt;T&gt; source) where T : class<br />
    {<br />
        var es = new EntitySet&lt;T&gt; ();<br />
        es.AddRange (source);<br />
        return es;<br />
    }</p>
<p>Then you could write your query as follows:<br />
var questions = from q in e.Element(&#8220;Questions&#8221;).Elements(&#8220;Question&#8221;)</p>
<p>                            select new Question<br />
                            {<br />
                                Text = q.Attribute(&#8220;title&#8221;).Value,<br />
                                Point = (decimal) q.Attribute(&#8220;point&#8221;),<br />
                                Choices = (</p>
<p>  from c in q.Elements(&#8220;Choices&#8221;).Elements(&#8220;Choice&#8221;)</p>
<p>                                          select new Choice<br />
                                          {                                        <br />
                                              Text = c.Attribute(&#8220;title&#8221;).Value,<br />
                                              Correct = (bool) c.Attribute(&#8220;isCorrect&#8221;)<br />
                                          }           </p>
<p>                                     ).ToEntitySet();</p>
<p>                            };</p>
<p>But to achieve this, one may need to add reference to System.Data.Linq and even then there are sometimes when you don&#8217;t find the solution, in cases where only one Entity is required.<br />
A very simple and effective trick for a work around of this problem is to use the following :</p>
<p>var FirstQuestion = Questions.Where(q=&gt;q.ID==someIDParameter).ToList().FirstorDefault();</p>
<p>Now use this and do the work peacefully.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/11/how-to-convert-from-ienumerable-to-entityset-to-get-entity-back-in-action/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>How to solve LoadFromRemoteSources error in VS 2010</title>
		<link>http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/</link>
		<comments>http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 12:20:48 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=277</guid>
		<description><![CDATA[ I was facing an issue during the migration of my silverlight application to Visual Studio 2010. The issue was something like there are some references into the application from the network shared folder. When compiling the application there was a weird error saying : The &#8220;ValidateXaml&#8221; task failed unexpectedly. System.IO.FileLoadException: Could not load file or]]></description>
			<content:encoded><![CDATA[<p> I was facing an issue during the migration of my silverlight application to Visual Studio 2010. The issue was something like there are some references into the application from the network shared folder. When compiling the application there was a weird error saying :</p>
<blockquote><p>The &#8220;ValidateXaml&#8221; task failed unexpectedly.<br />
System.IO.FileLoadException: Could not load file or assembly &#8216;file://\\xxxxxxxx\Assemblies\xxxxx.dll&#8217; or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0&#215;80131515)<br />
File name: &#8216;file://\\xxxxxxxx\Assemblies\xxxxx.dll&#8217; &#8212;&gt; System.NotSupportedException: An attempt was made to load an assembly from a network location which would have caused the assembly to be sandboxed in previous versions of the .NET Framework. This release of the .NET Framework does not enable CAS policy by default, so this load may be dangerous. If this load is not intended to sandbox the assembly, please enable the loadFromRemoteSources switch. See <a href="http://go.microsoft.com/fwlink/?LinkId=155569">http://go.microsoft.com/fwlink/?LinkId=155569</a> for more information.</p>
<p>   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)<br />
   at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark&amp; stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)<br />
   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark&amp; stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks)<br />
   at System.Reflection.RuntimeAssembly.InternalLoadFrom(String assemblyFile, Evidence securityEvidence, Byte[] hashValue, AssemblyHashAlgorithm hashAlgorithm, Boolean forIntrospection, Boolean suppressSecurityChecks, StackCrawlMark&amp; stackMark)<br />
   at System.Reflection.Assembly.LoadFrom(String assemblyFile)<br />
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)<br />
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.XamlValidator.Execute(ITask task)<br />
   at Microsoft.Silverlight.Build.Tasks.ValidateXaml.Execute()<br />
   at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute()<br />
   at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask, Boolean&amp; taskResult)</p></blockquote>
<p>Navigating the microsoft link for this problem, it is bit confusing that we have to add the LoadFromRemoteSources switch to some app.config file or web.config file !! So here is the process to accomplish the task and get rid of thsi ridiculous error:-</p>
<ol>
<li>Goto this path in your windows explorer :<br />
<span style="color: #3366ff;">C:\Program Files\Microsoft Visual Studio 10.0\Common7\IDE</span></li>
<li>Open the <span style="color: #339966;"><strong>devenv.exe.config </strong></span>file in notepad or any editor of your choice.</li>
<li>Search for this element closing tag in the file:<br />
<span style="color: #3366ff;">&lt;/</span><span style="color: #800000;">runtime</span><span style="color: #3366ff;">&gt;</span></li>
<li><span style="color: #333333;">Before this element closing tag, Copy and paste the below configuration switch<br />
</span><span style="color: #3366ff;">&lt;</span><span style="color: #800000;">loadFromRemoteSources </span><span style="color: #ff0000;">enabled</span>=&#8221;<span style="color: #3366ff;">true</span><span style="color: #3366ff;">&#8220;/&gt;</span></li>
<li><span style="color: #333333;">Save and close the config file</span></li>
<li><span style="color: #333333;">It&#8217;s done !!</span></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/10/how-to-solve-loadfromremotesources-error-in-vs-2010/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Web service software factory in visual studio 2010</title>
		<link>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/</link>
		<comments>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/#comments</comments>
		<pubDate>Fri, 03 Sep 2010 14:34:23 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[VS 2010]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=249</guid>
		<description><![CDATA[It is very cool to use WSSF modeling edition as it helps applying proper pattern for your architecture. But when you migrate from Visual Studio 2008 to Visual Studio 2010 (ultimate in my case), the very first thing you note is something like this: VS2010 failed to load the Software service Factory modeling project (.ssfproduct)]]></description>
			<content:encoded><![CDATA[<p>It is very cool to use WSSF modeling edition as it helps applying proper pattern for your architecture. But when you migrate from Visual Studio 2008 to Visual Studio 2010 (ultimate in my case), the very first thing you note is something like this:</p>
<p style="text-align: center;"><span style="color: #ff0000;"><strong> VS2010 failed to load the Software service Factory modeling project (.ssfproduct) into the solution !!</strong></span></p>
<p>This is all because we need to install new and updated version for the factory. But still there is lot to do in order to make it working, as the new VS1010 needs to have the following things:</p>
<ul>
<li> <a href="http://visualstudiogallery.msdn.microsoft.com/en-us/25e4b5e9-65e4-4950-967d-5f1e6a9dcbeb">Guidance Automation Extensions 2010</a></li>
<li> <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=47305cf4-2bea-43c0-91cd-1b853602dcc5&amp;displaylang=en">Microsoft Visual Studio 2010 SDK</a></li>
<li><a href="http://visualstudiogallery.msdn.microsoft.com/en-us/8c6ea683-acf2-4881-bb05-3c3252992bfe">Web Service Software Factory 2010</a></li>
</ul>
<p>Install in the same order and enjoy the web service software factory : modeling edition without any issues <img src='http://www.sehajpal.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<div id="attachment_250" class="wp-caption alignleft" style="width: 310px"><a href="http://www.sehajpal.com/wp-content/uploads/2010/09/extension_manager.jpg"><img class="size-medium wp-image-250" title="VS2010 Extension Manager" src="http://www.sehajpal.com/wp-content/uploads/2010/09/extension_manager-300x207.jpg" alt="" width="300" height="207" /></a><p class="wp-caption-text">VS2010 Extension Manager</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/09/web-service-software-factory-in-visual-studio-2010/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to pass InitParameters to Silverlight in HTML object control</title>
		<link>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/</link>
		<comments>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/#comments</comments>
		<pubDate>Wed, 03 Mar 2010 08:21:21 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Init Parameters]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=74</guid>
		<description><![CDATA[There are three different ways in which we can pass parameters to Silverlight from the HTML side: 1. Pass parameters using the HTML object control. This may be the case using pure HTML page to call silverlight control in it or may be the simple ASp.Net page as usual.  &#60;object width=&#8221;100%&#8221; height=&#8221;100%&#8221;&#62;    &#60;param  name=&#8221;source&#8221;  value=&#8221;ClientBin/SomethingFunny.xap&#8221;]]></description>
			<content:encoded><![CDATA[<p>There are three different ways in which we can pass parameters to Silverlight from the HTML side:</p>
<p><strong>1. Pass parameters using the HTML object control.</strong></p>
<p>This may be the case using pure HTML page to call silverlight control in it or may be the simple ASp.Net page as usual.</p>
<blockquote><p> &lt;object width=&#8221;100%&#8221; height=&#8221;100%&#8221;&gt;<br />
   &lt;param  name=&#8221;source&#8221;  value=&#8221;ClientBin/SomethingFunny.xap&#8221; /&gt;<br />
   &lt;!&#8211; you can pass InitParameters to it. Pass anything like EndPointURI, EndPointName or Even StartPage &#8211;&gt;<br />
   &lt;param name=&#8221;InitParameters&#8221; value=&#8221;startPage=UnRegisteredLandingPage, EndPointURI=http://www.sehajpal.com/testservice.svc&#8221; /&gt;<br />
 &lt;/object&gt;</p></blockquote>
<p><strong>2. Using ASP.Net page to call silverlight control in it</strong>, we can easily pass parameters to it in anyway. One of the old tricks is to have an asp-literal control on the HTML side i.e. MarkUp side, and set its text to the desired HTML output fom code behind.</p>
<blockquote><p><strong>In the markup:<br />
</strong>  &lt;asp:Literal ID=&#8221;litParam&#8221; runat=&#8221;server&#8221; /&gt;</p>
<p><strong>In the code behind:</strong><br />
  this.litParam.Text = String.Format(&#8220;&lt;param name=\&#8221;ParamInitParameters\&#8221; value=\&#8221;{0}\&#8221; /&gt;&#8221;, sInitParms);</p></blockquote>
<p><strong>3. Using asp-silverlight control</strong> to host Silverlight application in an ASP.net website as usual. This is pretty neat approach in terms of playing around with parameters and properties of control hosting the Silverlight app.</p>
<blockquote><p><strong>In the markup:<br />
</strong>  &lt;asp:Silverlight ID=&#8221;SLControl&#8221; runat=&#8221;server&#8221; Width=&#8221;100%&#8221; Height=&#8221;100%&#8221; /&gt;<br />
<strong>In the code behind:</strong><br />
   SLControl.InitParameters = &#8220;EndPointURI=&#8221; + endPointURI + &#8220;,EndPointName=commonservice, UserCredentials=&#8221; + CredentialString;</p></blockquote>
<p> </p>
<p>Hope it works for you in different scenarios.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/03/how-to-pass-initparameters-to-silverlight-in-html-object-control/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Bind with Enum in Silverlight</title>
		<link>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 14:54:51 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Bind with Enum]]></category>
		<category><![CDATA[SilverLight]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=62</guid>
		<description><![CDATA[Silverlight doesn&#8217;t have any kind of ObjEctDataProvider with it. So the famous example of binding the controls with an ObjectDataProvider doesn&#8217;t work with silverlight as it works with WPF &#60;UserControl.Resources&#62; &#60;ObjectDataProvider MethodName=&#8220;GetValues&#8221; ObjectType=&#8221;{x:Type sys:Enum}&#8220;  x:Key=&#8220;AlignmentValues&#8221;&#62;   &#60;ObjectDataProvider.MethodParameters&#62;           &#60;x:Type TypeName=&#8220;HorizontalAlignment&#8221; /&#62;    &#60;/ObjectDataProvider.MethodParameters&#62; &#60;/ObjectDataProvider&#62; This can be done via code behind in the Silverlight.  Just]]></description>
			<content:encoded><![CDATA[<p>Silverlight doesn&#8217;t have any kind of ObjEctDataProvider with it. So the famous example of binding the controls with an ObjectDataProvider doesn&#8217;t work with silverlight as it works with WPF <img src='http://www.sehajpal.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p><span style="color: #5f5fd8;">&lt;UserControl.Resources&gt;<br />
</span><span style="color: #5f5fd8;">&lt;ObjectDataProvider</span><span style="color: #c7c7f1;"> MethodName</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;GetValues&#8221; </span><span style="color: #c7c7f1;">ObjectType</span><span style="color: #5f5fd8;">=&#8221;{</span><span style="color: #a31515;">x</span><span style="color: #5f5fd8;">:</span><span style="color: #a31515;">Type</span><span style="color: #5f5fd8;"> sys:Enum}</span><span style="color: #60ff60;">&#8220;  </span><span style="color: #c7c7f1;">x</span><span style="color: #5f5fd8;">:</span><span style="color: #c7c7f1;">Key</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;AlignmentValues&#8221;</span><span style="color: #5f5fd8;">&gt;</span><span style="color: #60ff60;"> </span><span style="color: #5f5fd8;">  &lt;ObjectDataProvider.MethodParameters&gt;<br />
    </span><span style="color: #60ff60;">      </span><span style="color: #5f5fd8;">&lt;x:Type</span><span style="color: #c7c7f1;"> TypeName</span><span style="color: #5f5fd8;">=</span><span style="color: #60ff60;">&#8220;HorizontalAlignment&#8221;</span><span style="color: #5f5fd8;"> /&gt;<br />
</span><span style="color: #60ff60;">   </span><span style="color: #5f5fd8;">&lt;/ObjectDataProvider.MethodParameters&gt;<br />
</span><span style="color: #5f5fd8;">&lt;/ObjectDataProvider&gt;</span></p>
<p><span style="color: #5f5fd8;"><span style="color: #000000;">This can be done via code behind in the Silverlight.  Just add a reference to the Reflection assembly.<br />
</span></span><span style="color: #8080c0;">using </span><span style="color: #3366ff;">System</span><span style="color: #e0e0e0;">.</span><span style="color: #3366ff;">Reflection</span><span style="color: #e0e0e0;">;</span></p>
<p><span style="color: #000000;">Use this simple function to get IEnumerable collection out of Enum type.</p>
<p>        public IEnumerable&lt;Enum&gt; GetEnumValues(Enum enumeration)<br />
        {<br />
            return from gField in enumeration.GetType().GetFields(BindingFlags.Static | BindingFlags.Public)<br />
                   select (Enum)gField.GetValue(enumeration);<br />
        }</span></p>
<p><span style="color: #000000;">Just bind the results of this function with your control and its done !</span></p>
<p> ComboFrom.ItemsSource = GetEnumValues(new SehajService.Currency());</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/bind-with-enum-in-silverlight/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
		</item>
		<item>
		<title>Currency amount in words in indian format using T-SQL Stored Procedure</title>
		<link>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 15:53:03 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Amount in words]]></category>
		<category><![CDATA[SQL]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=59</guid>
		<description><![CDATA[I know it is not that much crucial but neither easy to get rid of financial application’s requirements as clients demand more and more facilities even they are small in size. Here is one that kinda SQL Script that every finance domain expert looks for. That is the currency writer in WORDS instead of digits.]]></description>
			<content:encoded><![CDATA[<p>I know it is not that much crucial but neither easy to get rid of financial application’s requirements as clients demand more and more facilities even they are small in size.</p>
<p>Here is one that kinda SQL Script that every finance domain expert looks for. That is the currency writer in WORDS instead of digits.</p>
<p><span style="color: #0000ff;">CREATE FUNCTION</span> dbo.AMOUNT_IN_WORDS<br />
(<br />
 @Amount <span style="color: #0000ff;">INT</span>,<br />
 @PAISE <span style="color: #0000ff;">INT</span><br />
)<br />
<span style="color: #0000ff;">RETURNS int</span></p>
<p><span style="color: #0000ff;">BEGIN</span></p>
<p><span style="color: #0000ff;">DECLARE</span><br />
<span style="color: #339966;">&#8211;Step 1:<br />
&#8211;Here we define the temporary tables to hold the WORDs representation of possible digits/amounts</span></p>
<p><span style="color: #0000ff;">DECLARE</span> @INNTBL_01 <span style="color: #0000ff;">TABLE</span> (RECNO <span style="color: #0000ff;">INT IDENTITY</span>(1, 1), MTEXT <span style="color: #0000ff;">NVARCHAR</span>(50))</p>
<p><span style="color: #0000ff;">DECLARE</span> @INNTBL_02 <span style="color: #0000ff;">TABLE</span> (RECNO <span style="color: #0000ff;">INT</span> <span style="color: #0000ff;">IDENTITY</span>(1, 1), MTEXT <span style="color: #0000ff;">NVARCHAR</span>(50))</p>
<p><span style="color: #339966;">&#8211;Step 2:<br />
&#8211;Now add up the salt and pepper onto table  i.e. insert the WORDs into it</span></p>
<p><span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;ONE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWO&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THREE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FOUR&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIVE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIX&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHT&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;ELEVEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWELVE&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THIRTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FOURTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIFTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIXTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVENTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHTEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINETEEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_01 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWENTY&#8217;<span style="color: #339966;">&#8211;Similary, insert the multiples</span></span></p>
<p><span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TEN&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;TWENTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;THIRTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FORTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;FIFTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SIXTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;SEVENTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;EIGHTY&#8217;</span><br />
<span style="color: #0000ff;">INSERT INTO</span> @INNTBL_02 <span style="color: #0000ff;">SELECT</span> <span style="color: #ff0000;">&#8216;NINETY&#8217;</span></p>
<p><span style="color: #339966;">&#8211;Step 3:<br />
&#8211;Check for the limit of the amount i.e. what is the place value of digits &#8211; LACs, Thousands or Hundreds</span><br />
<span style="color: #0000ff;">DECLARE</span> @WORD <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SELECT</span> @WORD = &#8221;</p>
<p><span style="color: #0000ff;">DECLARE</span> @M_AMT01  <span style="color: #0000ff;">INT</span>, @M_AMT02 <span style="color: #0000ff;">INT</span></p>
<p><span style="color: #0000ff;">IF</span> @AMOUNT &lt; 10000000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 100000 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SELECT</span> @AMOUNT = ( @AMOUNT % 100000 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 100000<br />
<span style="color: #0000ff;">DECLARE</span> @WORD1 <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @WORD1 = &#8221;<br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt; 100 <span style="color: #0000ff;">AND</span> @M_AMT01 &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = @M_AMT01<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 % 10)<br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = ( @M_AMT02 &#8211; @M_AMT01 ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT02 )<br />
<span style="color: #0000ff;">END<br />
</span><br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt;= 20 <span style="color: #0000ff;">AND</span> @M_AMT01 &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + @WORD1 + &#8216; <span style="color: #ff0000;">LAC</span> &#8216;<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 100000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 1000 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 1000 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 1000<br />
<span style="color: #0000ff;">SET</span> @WORD1 = &#8221;<br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt; 100 <span style="color: #0000ff;">AND</span> @M_AMT01 &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = @M_AMT01<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 % 10 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT02 = ( @M_AMT02 &#8211; @M_AMT01 ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT + &#8216; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT02 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @M_AMT01 &lt;= 20 <span style="color: #0000ff;">AND</span> @M_AMT01 &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @WORD1 = ( <span style="color: #0000ff;">SELECT</span> @WORD1 + MTEXT +&#8217; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + @WORD1 + &#8216; <span style="color: #ff0000;">THOUSAND</span> &#8216;<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 1000 <span style="color: #0000ff;">AND</span> @AMOUNT &gt; = 100 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 100 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 100<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + &#8216; &#8216; +MTEXT + &#8216; HUNDRED &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01</p>
<p>)<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt; 100 <span style="color: #0000ff;">AND</span> @AMOUNT &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = @AMOUNT<br />
<span style="color: #0000ff;">SET</span> @AMOUNT = ( @AMOUNT % 10 )<br />
<span style="color: #0000ff;">SET</span> @M_AMT01 = ( @M_AMT01 &#8211; @AMOUNT ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + MTEXT + &#8216; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @M_AMT01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @AMOUNT &lt;= 20 <span style="color: #0000ff;">AND</span> @AMOUNT &gt;= 1 BEGIN<br />
<span style="color: #0000ff;">SET</span> @WORD = ( <span style="color: #0000ff;">SELECT</span> @WORD + MTEXT +&#8217; &#8216; <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @AMOUNT )<br />
<span style="color: #0000ff;">END</span></p>
<p>&#8211;STEP 4:<br />
&#8211;Calculate the paise also.<br />
<span style="color: #0000ff;">DECLARE</span> @WORDP <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @WORDP = &#8221;<br />
<span style="color: #0000ff;">IF</span> @PAISE &lt;&gt; 0 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">IF</span> @PAISE &lt; 100 <span style="color: #0000ff;">AND</span> @PAISE &gt; 20 <span style="color: #0000ff;">BEGIN</span><br />
<span style="color: #0000ff;">DECLARE</span> @PAISE_01 <span style="color: #0000ff;">VARCHAR</span>(300)<br />
<span style="color: #0000ff;">SET</span> @PAISE_01 = @PAISE<br />
<span style="color: #0000ff;">SET</span> @PAISE = ( @PAISE % 10 )<br />
<span style="color: #0000ff;">SET</span> @PAISE_01 = ( @PAISE_01 &#8211; @PAISE ) / 10<br />
<span style="color: #0000ff;">SET</span> @WORDP = ( <span style="color: #0000ff;">SELECT</span> @WORDP + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_02 <span style="color: #0000ff;">WHERE</span> RECNO = @PAISE_01 )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">IF</span> @PAISE &lt;= 20 <span style="color: #0000ff;">AND</span> @PAISE &gt;= 1 BEGIN<br />
<span style="color: #0000ff;">SET</span> @WORDP = ( <span style="color: #0000ff;">SELECT</span> @WORDP + MTEXT <span style="color: #0000ff;">FROM</span> @INNTBL_01 <span style="color: #0000ff;">WHERE</span> RECNO = @PAISE )<br />
<span style="color: #0000ff;">END</span><br />
<span style="color: #0000ff;">SET</span> @WORD = @WORD + <span style="color: #ff0000;">&#8216;AND</span> &#8216; + @WORDP + &#8216; <span style="color: #ff0000;">PAISE&#8217;</span><br />
<span style="color: #0000ff;">END</span></p>
<p><span style="color: #339966;">&#8211;STEP 5:<br />
&#8211;Time to return answer from the function.</span><br />
<span style="color: #0000ff;">RETURN</span> (<span style="color: #ff00ff;">REPLACE</span>(@WORD, &#8216;  &#8216;, &#8216; &#8216;))</p>
<p><span style="color: #339966;">&#8211;Its done dude. Try by yourself.</span><br />
<span style="color: #0000ff;">END</span></p>
<p>Now when you need to use this function, simply call it inline to any select statement.</p>
<p><strong>CALLING THE FUNCTION</strong></p>
<p><span style="color: #0000ff;">Select</span> dbo.AMOUNT_IN_WORDS(IM.GRAND_TOTAL, 0) <span style="color: #0000ff;">AS</span> words <span style="color: #0000ff;">from</span> TBL_INVOICE_MAIN IM</p>
<p>Here, it will convert <strong>GRAND_TOTAL</strong> field from the table <strong>TBL_INVOICE_MAIN</strong>.</p>
<p>or more simply,</p>
<p>Select dbo.AMOUNT_IN_WORDS(654321, 0)</p>
<p>Isn&#8217;t it simple enough !</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/indian-fromat-currency-amount-using-t-sql-stored-procedure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Create Word Document with Hyperlinks in it with C# code</title>
		<link>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/</link>
		<comments>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 13:59:13 +0000</pubDate>
		<dc:creator>Ashish Sehajpal</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[Create Word Document]]></category>

		<guid isPermaLink="false">http://www.sehajpal.com/?p=56</guid>
		<description><![CDATA[First of all you need to add reference to COM library in project. Add reference to Microsoft word 11.0 word library under COM reference tab Add this in the code behind “using” section using Microsoft.Office.Interop.Word; private void CreateWordDocument() { // create annonymous object to be referenced throughout object oMissingReference = System.Reflection.Missing.Value; object Visible=true; // define]]></description>
			<content:encoded><![CDATA[<p>First of all you need to add reference to COM library in project.<br />
Add reference to Microsoft word 11.0 word library under COM reference tab Add this in the code behind “using” section</p>
<p>using <span style="color: #0000ff;">Microsoft.Office.Interop.Word</span>;<br />
private void CreateWordDocument()<br />
{<br />
<span style="color: #99cc00;">// create annonymous object to be referenced throughout<br />
</span>object oMissingReference = System.Reflection.Missing.Value;<br />
object Visible=true;<br />
<span style="color: #99cc00;">// define arbitrary starting point for defining range object.</span><br />
object oStartRange = 0;<br />
object oEndRange = 0;<br />
<span style="color: #99cc00;">// create instance of application class</span><br />
ApplicationClass WordApp = new ApplicationClass();<br />
<span style="color: #99cc00;">// create document instance</span><br />
Document docObject = WordApp.Documents.Add(ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference );<br />
<span style="color: #99cc00;">// select a range to add some text/image there</span><br />
Range rng=docObject.Range(ref oStartRange,ref oMissingReference );<br />
rng.Font.Name=”Arial”;<br />
rng.InsertAfter(”Ashish Sehajpal”);<br />
<span style="color: #99cc00;">// create Hyperlink object and assign address, screen tip to it</span><br />
Object address = @”http://www.sehajpal.com”;<br />
Object screenTip = “Welcome to sehajpal.com”;<br />
<span style="color: #99cc00;">// adding Hyperlink to the text “Ashish Sehajpal“<br />
</span>rng.Hyperlinks.Add(rng, ref address, ref oMissingReference , ref screenTip, ref oMissingReference , ref oMissingReference );<br />
<span style="color: #99cc00;">// give file name to it so as to save the document<br />
</span>object filename = @”C:\createdbycsharp.doc”;<br />
docObject.<span style="color: #0000ff;">SaveAs</span>(ref filename, ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference ,ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference , ref oMissingReference );</p>
<p>WordApp.Visible=true;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://www.sehajpal.com/index.php/2010/02/create-word-document-with-hyperlinks-in-it-with-csharp-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

