<?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1113941468315876880</atom:id><lastBuildDate>Wed, 01 Oct 2014 06:47:11 +0000</lastBuildDate><category>Tips and Tricks</category><category>Asp.net</category><category>SQL Server</category><category>Javascript</category><category>T-SQL</category><category>Interview</category><category>Sandeep Prajapati</category><category>C#</category><category>CSS</category><category>Error Handling</category><category>GridView</category><category>Payment Gateway</category><category>Security</category><category>Android</category><category>IIS</category><category>Image</category><category>NuGet</category><category>Push Notification</category><category>Stored Procedure</category><category>Ajax Toolkit</category><category>Applicationpool</category><category>CTE</category><category>Datalist</category><category>DateTime</category><category>DateTime.ParseExact</category><category>Excel</category><category>LINQ</category><category>NopCommerce</category><category>PHP</category><category>PayU</category><category>Performance</category><category>Repeater</category><category>SSRS</category><category>ViewState</category><category>WCF</category><category>Web Service</category><category>iOS</category><category>jquery</category><category>json</category><category>usercontrol</category><title>Sandeep Prajapati - Asp.net</title><description>Asp.net, Sql Server, Jquery, WCF, Web Service, Telerik, json, XML etc. Expert (Microsoft Technology Practice)</description><link>http://blog.sandeepprajapati.in/</link><managingEditor>noreply@blogger.com (Sandeep Prajapati)</managingEditor><generator>Blogger</generator><openSearch:totalResults>41</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7306420318632917325</guid><pubDate>Mon, 22 Sep 2014 17:35:00 +0000</pubDate><atom:updated>2014-09-22T23:10:18.508+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">NopCommerce</category><category domain="http://www.blogger.com/atom/ns#">Payment Gateway</category><category domain="http://www.blogger.com/atom/ns#">PayU</category><category domain="http://www.blogger.com/atom/ns#">Sandeep Prajapati</category><title>PAYU Plugin for NopCommerce</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://www.nopcommerce.com/App_Themes/darkOrange/images/logo.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://www.nopcommerce.com/App_Themes/darkOrange/images/logo.png&quot; /&gt;&lt;/a&gt;&lt;a href=&quot;http://www.nopcommerce.com/images/thumbs/0003410_200.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: right; display: inline !important; margin-bottom: 1em; margin-left: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://www.nopcommerce.com/images/thumbs/0003410_200.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hello&lt;br /&gt;&lt;br /&gt;Download &lt;a href=&quot;http://www.nopcommerce.com/&quot; target=&quot;_blank&quot;&gt;NopCommerce&lt;/a&gt; PayU plugin from&amp;nbsp;&lt;a href=&quot;http://www.nopcommerce.com/p/1556/payu-india-inr.aspx&quot;&gt;http://www.nopcommerce.com/p/1556/payu-india-inr.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;To get the Plugin Please mail on &lt;a href=&quot;mailto:prajapatisandeepk@gmail.com&quot;&gt;prajapatisandeepk@gmail.com&lt;/a&gt;&amp;nbsp;with Subject &quot;PayU Plugin&quot;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2014/09/payu-plugin-for-nopcommerce.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7855593714067984771</guid><pubDate>Mon, 23 Dec 2013 08:30:00 +0000</pubDate><atom:updated>2013-12-23T14:09:31.991+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">iOS</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><category domain="http://www.blogger.com/atom/ns#">Push Notification</category><title>Nuget Package for Push Notification on Android and iOS</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Continue to &lt;a href=&quot;http://blog.sandeepprajapati.in/2013/11/push-notification-for-android.html&quot; target=&quot;_blank&quot;&gt;my previous post&lt;/a&gt; for Push Notification, I have generated a simplified process to implement Push notification for iOS and Android.&lt;br /&gt;&lt;br /&gt;Anyone can download my Nuget package from &lt;a href=&quot;https://www.nuget.org/packages/EasyPushNotification/&quot;&gt;https://www.nuget.org/packages/EasyPushNotification/&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;background-color: white; color: #333333; font-family: &#39;Segoe UI&#39;, &#39;Trebuchet MS&#39;, Verdana, Helvetica, sans-serif; font-size: 14px; line-height: 1.538em; margin-bottom: 1em;&quot;&gt;&lt;span style=&quot;line-height: 1.538em;&quot;&gt;To install Push Notification for Android and iOS, run the following command in the&lt;/span&gt;&lt;span style=&quot;line-height: 1.538em;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;http://docs.nuget.org/docs/start-here/using-the-package-manager-console&quot; style=&quot;color: #0071bc; line-height: 1.538em; outline: none; text-decoration: none;&quot;&gt;Package Manager Console&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;nuget-badge&quot; style=&quot;background-color: white; color: #333333; font-family: &#39;Segoe UI&#39;, &#39;Trebuchet MS&#39;, Verdana, Helvetica, sans-serif; font-size: 14px;&quot;&gt;&lt;div style=&quot;line-height: 1.538em; margin-bottom: 1em;&quot;&gt;&lt;code style=&quot;background-color: #202020; border-bottom-left-radius: 5px; border-bottom-right-radius: 5px; border-top-left-radius: 5px; border-top-right-radius: 5px; border: 4px solid silver; box-shadow: rgb(110, 110, 110) 2px 2px 3px; color: #e2e2e2; display: block; font-family: &#39;andale mono&#39;, &#39;lucida console&#39;, monospace; font-size: 1.5em; line-height: 1.5em; overflow: auto; padding: 15px;&quot;&gt;PM&amp;gt; Install-Package EasyPushNotification&lt;/code&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;b&gt;&lt;u&gt;Web.config settings &lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Add following keys into AppSettings into web.config file. &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: xhtml;&quot;&gt;&amp;lt;appSettings&amp;gt;&lt;br /&gt;        &amp;lt;add key=&quot;APIKey&quot; value=&quot;SOME_API_KEY&quot;/&amp;gt;&lt;br /&gt;        &amp;lt;add key=&quot;ApnsCertPath&quot; value=&quot;CERTIFICATE_PATH&quot;/&amp;gt;&lt;br /&gt;        &amp;lt;add key=&quot;ApnsCertPassword&quot; value=&quot;CERT_PASSWORD&quot;/&amp;gt;&lt;br /&gt;&amp;lt;/appSettings&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 13.0pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;For Android&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-left: .5in;&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;APIKey&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;is API key provided by GCM server. Follow the steps from &lt;a href=&quot;http://developer.android.com/google/gcm/gs.html&quot;&gt;here&lt;/a&gt; to generate project and obtain API key. The generated Project ID will be used to generate Device Token from Android devices. &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 13.0pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;For iOS&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpFirst&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;ApnsCertPath&lt;/span&gt; is the physical path where iOS apns certificate is stored. This should be a located into server and the path should be something like &lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;&quot;&lt;span style=&quot;color: blue;&quot;&gt;~/Certificate_Folder/Certificate_Name.p12” &lt;/span&gt;&lt;/span&gt;follow the steps from &lt;a href=&quot;http://arashnorouzi.wordpress.com/2011/04/01/sending-apple-push-notifications-in-asp-net-%E2%80%93-part-2-generating-apns-certificates/&quot;&gt;here&lt;/a&gt; to generate certificate. (iOS developer might have better ideas how to generate certificate.)&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class=&quot;MsoListParagraphCxSpMiddle&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;MsoListParagraphCxSpLast&quot;&gt;&lt;span style=&quot;color: blue; font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;ApnsCertPassword&lt;/span&gt; is password for certificate generate from above step.&lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;Call Method&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt; Use below code block to raise push notification.&lt;br /&gt;&lt;pre class=&quot;brush: c#;&quot;&gt;string DeviceID = string.Empty;&lt;br /&gt;string Message = string.Empty;&lt;br /&gt;DeviceType DeviceType = DeviceType.Android;&lt;br /&gt;&lt;br /&gt;NotificationInfo objNotificationInfo = new NotificationInfo();&lt;br /&gt;bool result = objNotificationInfo.SendNotification(DeviceID, Message, DeviceType);&lt;br /&gt;&lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 13.0pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;Parameters:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;DeviceID&lt;/span&gt;&lt;/u&gt;is Device token generate using phone and stored into database table using a service call.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;Message&lt;/span&gt;&lt;/u&gt;is string variable. The message is to be displayed as notification.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt; line-height: 115%;&quot;&gt;DeviceType&lt;/span&gt;&lt;/u&gt;is an Enum variable to decide whether the device is Android or iOS device. Fetch Device type from database which as stored with DeviceToken using service.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot;&gt;&lt;b&gt;&lt;u&gt;&lt;span style=&quot;font-size: 13.0pt; line-height: 115%; mso-bidi-font-size: 11.0pt;&quot;&gt;Returns: &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;Method will return Boolean result as success or failed.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;ProcessResult &lt;/span&gt;&lt;/u&gt;will provide handled exception message.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;MsoNormal&quot; style=&quot;margin-bottom: 0.0001pt; text-indent: 0.5in;&quot;&gt;&lt;u&gt;&lt;span style=&quot;font-family: Consolas; font-size: 9.5pt;&quot;&gt;isError&lt;/span&gt;&lt;/u&gt; is Boolean variable to indicate any error occurs.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;Happy Mobilizing..&amp;nbsp;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2013/12/nuget-package-for-push-notification-on.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-6497766025358099039</guid><pubDate>Tue, 19 Nov 2013 10:11:00 +0000</pubDate><atom:updated>2013-11-19T15:48:54.117+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Android</category><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">NuGet</category><category domain="http://www.blogger.com/atom/ns#">Push Notification</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Push Notification for Android</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello,&lt;br /&gt;&lt;br /&gt;Now a Days in era of smart phones and mobile app developments, a very important feature is &quot;Push Notification&quot;.&lt;br /&gt;&lt;br /&gt;For any Mobile app (Android, iPhone, Blackberry, etc.) Push Notification is part of requirement and complete project.&lt;br /&gt;To know more about Push notifications please Google !! here is a quick Wikipedia &lt;a href=&quot;http://en.wikipedia.org/wiki/Push_technology&quot; target=&quot;_blank&quot;&gt;link&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-gpnvhcgpI7E/Uos647Gf5YI/AAAAAAAAAvA/QLTbreObkaI/s1600/PusnNotificationArchitecure.jpg&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;322&quot; src=&quot;http://4.bp.blogspot.com/-gpnvhcgpI7E/Uos647Gf5YI/AAAAAAAAAvA/QLTbreObkaI/s400/PusnNotificationArchitecure.jpg&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;In this post I am going to demonstrate Push notification for Android phones. As of now I don&#39;t have any Android device connected with my machine so can&#39;t get snapshots of result but one can trust me that whatever I have implemented is fully working.&lt;br /&gt;&lt;br /&gt;OK.. So Let&#39;s Start ..........&lt;br /&gt;&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&amp;nbsp;Create an Asp.net application .(whatever you like..MVC, or anything)&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; I hope you are aware about NuGet Package Manager. if not refer official website of &lt;a href=&quot;http://www.nuget.org/&quot; target=&quot;_blank&quot;&gt;NuGet&lt;/a&gt;. visual Studio 2010 + comes up with inbuilt support of NuGet Packages. still can&#39;t find NuGet Packages into your Visual Studio &lt;a href=&quot;http://docs.nuget.org/docs/start-here/installing-nuget&quot; target=&quot;_blank&quot;&gt;Install from Website&lt;/a&gt;.&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Once You are done with Above step, Right click on Solution of project. and Select &quot;Manage NuGet Packages for Solution..&quot; &lt;br /&gt;&lt;br /&gt;&lt;table align=&quot;center&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; class=&quot;tr-caption-container&quot; style=&quot;margin-left: auto; margin-right: auto; text-align: center;&quot;&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td style=&quot;text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-F8oxzupV7EU/UostBguSQcI/AAAAAAAAAuE/5FogbMBUy0g/s1600/PushNotificationNuget.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: auto; margin-right: auto;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;300&quot; src=&quot;http://4.bp.blogspot.com/-F8oxzupV7EU/UostBguSQcI/AAAAAAAAAuE/5FogbMBUy0g/s400/PushNotificationNuget.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/li&gt;&lt;li&gt;&quot;Manage NuGet Package&quot; window will appear.&amp;nbsp;&lt;/li&gt;&lt;li&gt;&amp;nbsp;Thanks to &quot;Redth&quot;, who has provided us a very useful NuGet Package Named &quot;&lt;a href=&quot;https://www.nuget.org/packages/PushSharp/2.0.4&quot; target=&quot;_blank&quot;&gt;PushSharp&lt;/a&gt;&quot;search from Right top search window for &quot;PushSharp&quot;&amp;nbsp; and Select the First Package.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://2.bp.blogspot.com/-AdxD11bI-m0/UosuejsFOlI/AAAAAAAAAuQ/Z_KoLsiLJSw/s1600/PushNotificationPushSharp.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;267&quot; src=&quot;http://2.bp.blogspot.com/-AdxD11bI-m0/UosuejsFOlI/AAAAAAAAAuQ/Z_KoLsiLJSw/s400/PushNotificationPushSharp.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;Click on &quot;Install&quot; Button. If Prompts to &quot;Select Project&quot;, Select the Projects in which you would like to add reference of PushSharp library.Click OK.&lt;/li&gt;&lt;li&gt;Here we go.. Nuget Package Installation will start and wait until is completes.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-_hhhKP6L1qE/UosvbTNRMgI/AAAAAAAAAuc/_mPau0B9MWI/s1600/PushNotificationPushSharpInstall.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;263&quot; src=&quot;http://4.bp.blogspot.com/-_hhhKP6L1qE/UosvbTNRMgI/AAAAAAAAAuc/_mPau0B9MWI/s400/PushNotificationPushSharpInstall.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&lt;li&gt;Close all other open window. you can track output windows whether installation completed successfully. You can check in Project Reference, whether new references of PushSharp are assigned or not. If everything is good then let&#39;s move ahead Or feel free to post your problem. I will try my best to support you.&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;blockquote class=&quot;tr_bq&quot;&gt;Now It&#39;s Time to create Project for Android Push Notification.&lt;/blockquote&gt;&lt;br /&gt;Please Follow the article to Create and Configure &lt;a href=&quot;http://developer.android.com/google/gcm/gs.html&quot;&gt;http://developer.android.com/google/gcm/gs.html&lt;/a&gt; (you might find some changes as recently Google has changed API Console UI. So try to push more efforts to understand)&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;/div&gt;&lt;div&gt;Alright, I hope You have successfully Created Android API Project. It&#39;s very important part for Android push notification.&amp;nbsp;&lt;/div&gt;&lt;div&gt;You might have come across two important Key works while creating Project.&lt;/div&gt;&lt;div&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;Project Number&lt;/b&gt; : is used to generate Device Token from Android Device. The Project number keeps track of the notification raised for particular device consumes for which Project ID. You have to provide the Project number to Android phone developer. They will use the project number and Provide &lt;b&gt;Device Token&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-7xkUbdmTuiw/UoszocuNtnI/AAAAAAAAAuo/UKVLeI2_3to/s1600/PushNotificationProjectNo.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;110&quot; src=&quot;http://3.bp.blogspot.com/-7xkUbdmTuiw/UoszocuNtnI/AAAAAAAAAuo/UKVLeI2_3to/s400/PushNotificationProjectNo.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;API key&lt;/b&gt; : API key secured key mandatory to pass while processing notifications. &lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://1.bp.blogspot.com/-O-AYeDn1My8/UoszoTa0a7I/AAAAAAAAAus/Qexeq5JiJ94/s1600/PushNotificationAPIKey.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;190&quot; src=&quot;http://1.bp.blogspot.com/-O-AYeDn1My8/UoszoTa0a7I/AAAAAAAAAus/Qexeq5JiJ94/s400/PushNotificationAPIKey.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;Keep this information somewhere stored.&lt;br /&gt;&lt;br /&gt;Now There are three important credentials&amp;nbsp; required to accomplish Push notification for Android.&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&lt;b&gt;Device Token&lt;/b&gt; : using Project Number, Android Phone developer can provide the Device Token. I have no Idea how they does..&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;b&gt;API Key&lt;/b&gt; : The API key provided by Project.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Message&lt;/b&gt;: The message to be passed on as Push Notification.&lt;/li&gt;&lt;/ol&gt;Basically, Some implicit or explicit action required to raise the Notification. In My Case I used to created a &lt;a href=&quot;http://msdn.microsoft.com/en-us/magazine/dd315413.aspx&quot; target=&quot;_blank&quot;&gt;WCF Restful service&lt;/a&gt; (&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd203052.aspx&quot; target=&quot;_blank&quot;&gt;Sample Application&lt;/a&gt;). We had a message with minor database parameters to be passed. So Whenever the notification was supposed to raise, phone developers were making a request on my WCF service with &lt;b&gt;Device Token&lt;/b&gt; as &lt;b&gt;Parameter&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;Here is code block to raise notification. Very short and simple !! :)&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c#;&quot;&gt;var push = new PushBroker();            &lt;br /&gt;push.RegisterGcmService(new GcmPushChannelSettings(&lt;span style=&quot;background-color: yellow;&quot;&gt;APIKey&lt;/span&gt;));            &lt;br /&gt;push.QueueNotification(new GcmNotification().ForDeviceRegistrationId(&lt;span style=&quot;background-color: yellow;&quot;&gt;DeviceTokenID&lt;/span&gt;)&lt;br /&gt;                .WithJson(&quot;{\&quot;message\&quot;:\&quot;&quot; + &lt;span style=&quot;background-color: yellow;&quot;&gt;Message &lt;/span&gt;+ &quot;\&quot;}&quot;)); &lt;/pre&gt;&lt;div&gt;&lt;br /&gt;&lt;br /&gt;That&#39;s all. Done..&lt;br /&gt;&lt;br /&gt;I have done few more push notification also using PushSharp.&lt;br /&gt;Please feel free to contact me for any kind of assistance. &lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2013/11/push-notification-for-android.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://4.bp.blogspot.com/-gpnvhcgpI7E/Uos647Gf5YI/AAAAAAAAAvA/QLTbreObkaI/s72-c/PusnNotificationArchitecure.jpg" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-4394159983652100075</guid><pubDate>Wed, 21 Aug 2013 08:01:00 +0000</pubDate><atom:updated>2013-12-09T14:25:04.743+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">jquery</category><category domain="http://www.blogger.com/atom/ns#">PHP</category><category domain="http://www.blogger.com/atom/ns#">Sandeep Prajapati</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Custom Message box and Confirm window all in one</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello,&lt;br /&gt;I have created a custom message box and confirm window which can be used in all programming languages and all platforms. &lt;br /&gt;syntex :&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;AlertCust([Control], {Message Title}, [Message Text], {IconType}, {PromptType}, [OnOk], [OnCancel]);&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre { font-size: small; color: black; font-family: consolas, &quot;Courier New&quot;, courier, monospace; background-color: #ffffff; /*white-space: pre;*/ } .csharpcode pre { margin: 0em; } .csharpcode .rem { color: #008000; } .csharpcode .kwrd { color: #0000ff; } .csharpcode .str { color: #006080; } .csharpcode .op { color: #0000c0; } .csharpcode .preproc { color: #cc6633; } .csharpcode .asp { background-color: #ffff00; } .csharpcode .html { color: #800000; } .csharpcode .attr { color: #ff0000; } .csharpcode .alt  { background-color: #f4f4f4; width: 100%; margin: 0em; } .csharpcode .lnum { color: #606060; } &lt;/style&gt;&lt;br /&gt;&lt;br /&gt;Description :&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;b&gt;[Control]&lt;/b&gt; : &lt;b&gt;Optional, &lt;/b&gt;Pass the control which raises the prompt. in Confirm or Alert window when click ‘OK’ button is clicked, the default server event will be executed, if value is passed. if null, clicking on ‘OK’ the prompt window will be closed, no further action. &lt;/li&gt;&lt;li&gt;&lt;b&gt;{Message Title} : Required, &lt;/b&gt;Message Title. Title will appear in bold font. &lt;/li&gt;&lt;li&gt;&lt;b&gt;[Message Text] : Optional, &lt;/b&gt;Message text in second line, in normal fonts. &lt;/li&gt;&lt;li&gt;&lt;b&gt;{IconType} : Required, &lt;/b&gt;Enum values. pass icon type to display icon specific to message. options Error, Warning, Information &lt;/li&gt;&lt;li&gt;&lt;b&gt;{PromptType} : Required,&lt;/b&gt;&amp;nbsp; This property helps to decide what kind of prompt we need. e.g. Validation, MessageBox(OkOnly), OKCancel, YesNo. &lt;/li&gt;&lt;li&gt;&lt;b&gt;[OnOk] : Optional, &lt;/b&gt;To provided custom callback method, set javascript method name, will be executed when clicked ‘OK’. &lt;/li&gt;&lt;li&gt;&lt;b&gt;[OnCancel] : Optional, &lt;/b&gt;To provided custom callback method, set javascript method name, will be executed when clicked ‘Cancel’.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh3.ggpht.com/-xrEB80WD8Z8/Ubr44k86TAI/AAAAAAAAAqk/Ea3spnkYsrc/s1600-h/Message%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;Message&quot; border=&quot;0&quot; height=&quot;219&quot; src=&quot;http://lh3.ggpht.com/-aXP1j7OkbcE/Ubr46NJ0LtI/AAAAAAAAAqs/yD9JPpWtz9c/Message_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Message&quot; width=&quot;477&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;anyone can download code from &lt;a href=&quot;https://drive.google.com/folderview?id=0B68W20_N-VtMWGstaWRla3dRMTg&amp;amp;usp=sharing&quot;&gt; Here&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2013/08/custom-message-box-and-confirm-window.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-aXP1j7OkbcE/Ubr46NJ0LtI/AAAAAAAAAqs/yD9JPpWtz9c/s72-c/Message_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-9153823473141791343</guid><pubDate>Thu, 01 Nov 2012 15:28:00 +0000</pubDate><atom:updated>2012-11-01T20:59:41.402+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">Error Handling</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Sandeep Prajapati</category><category domain="http://www.blogger.com/atom/ns#">Security</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>JavaScriptStringEncode : Javascript Compitable encoding</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello,&lt;br /&gt;&lt;br /&gt;Recently I was facing very interesting issue. and the solution for the issue was introduced in the new updates in asp.net framework 4.0.&lt;br /&gt;&lt;br /&gt;Generally when we try to render HTML content on page clientside/ by javascript, it gives error of Potential dangerous content error.&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms972967.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/ms972967.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;There are lot&#39;s solutions but have to compromise security of page.&lt;br /&gt;by setting&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: html&quot;&gt;&amp;lt;%@ Page Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeFile=&quot;default.aspx.cs&quot;&lt;br /&gt;    Inherits=&quot;_default&quot; ValidateRequest=&quot;false&quot;%&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;But now we have perfect solution which is introduced in .net framework 4.0&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HttpUtility.JavaScriptStringEncode Method&lt;/b&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;URL encoding makes sure that all browsers correctly encodes text in URL strings. Few Characters such as a question mark (?), ampersand (&amp;amp;), slash (/), and spaces might be truncated or corrupted by some browsers. Therefore, these characters must be encoded in a elements or in query strings where the strings can be re-sent by a browser in a request string.&lt;br /&gt;&lt;br /&gt;refer following&amp;nbsp; MSDN link&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/system.web.httputility.javascriptstringencode%28v=vs.100%29.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/system.web.httputility.javascriptstringencode%28v=vs.100%29.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://msdn.microsoft.com/en-us/library/dd991914%28v=vs.100%29.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/dd991914%28v=vs.100%29.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope this helps &lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/11/javascriptstringencode-javascript.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-2365800545868552635</guid><pubDate>Tue, 16 Oct 2012 18:08:00 +0000</pubDate><atom:updated>2013-12-09T14:26:23.681+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Sandeep Prajapati</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Disable Server Validation Control from ClientSide/ Javascript - ValidatorEnable</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello Friends,&lt;br /&gt;&lt;br /&gt;Recently I required to disable server validation control (RequiredFieldValidator, CompareValidator, CustomValidator, RangeValidator, RagularExpressionValidator, etc) from clientside/ Javascript.&lt;br /&gt;There are few patches to accomplish the&amp;nbsp; requirement by I liked an approach which is perfect for ClientSide handling.&lt;br /&gt;&lt;br /&gt;ValidatorEnable is a javascript mathod lying at asp.net framework javascriptscript &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: js&quot;&gt;ValidatorEnable(document.getElementById(myVal), Status);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;Thanks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/10/disable-server-validation-control-from.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-6428523222135320983</guid><pubDate>Sat, 04 Aug 2012 11:02:00 +0000</pubDate><atom:updated>2013-12-09T14:28:34.058+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">DateTime</category><category domain="http://www.blogger.com/atom/ns#">DateTime.ParseExact</category><category domain="http://www.blogger.com/atom/ns#">Sandeep Prajapati</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>DateTime.ParseExact - culturewise Date Comparision</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello..&lt;br /&gt;&lt;br /&gt;Whenever dealing with cultures, DateTime format is always a headache to handle.&lt;br /&gt;&lt;br /&gt;to the date format&amp;nbsp; in Textbox sometimes does not meet the format of culture.&lt;br /&gt;in that case &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/w2sa9yss.aspx&quot; target=&quot;_blank&quot;&gt;DateTime.ParseExact&lt;/a&gt; is good option to handle.&lt;br /&gt;&lt;br /&gt;convert the date into current culture format from display culture format using&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;public static DateTime ParseExact( string str, string Dateformat, IFormatProvider provider)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4 class=&quot;subHeading&quot;&gt;Parameters&lt;/h4&gt;&lt;dl&gt;&lt;dt&gt;&lt;b&gt;&lt;span class=&quot;parameter&quot;&gt;s&lt;/span&gt;tr &lt;/b&gt;&lt;/dt&gt;&lt;dt&gt;Type: System.String&lt;/dt&gt;&lt;dt&gt;A string that contains a date and time to convert. &lt;/dt&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt;&lt;b&gt;&lt;span class=&quot;parameter&quot;&gt;Dateformat&lt;/span&gt;&lt;/b&gt;&amp;nbsp;&lt;/dt&gt;&lt;dt&gt;Type: System.String&lt;/dt&gt;&lt;dt&gt;A format specifier that defines the required format of &lt;span class=&quot;parameter&quot;&gt;s&lt;/span&gt;. &lt;/dt&gt;&lt;/dl&gt;&lt;dl&gt;&lt;dt&gt;&lt;b&gt;&lt;span class=&quot;parameter&quot;&gt;provider&lt;/span&gt;&amp;nbsp;&lt;/b&gt;&lt;/dt&gt;&lt;dt&gt;Type: System.IFormatProvider&lt;/dt&gt;&lt;dt&gt;An object that supplies &lt;a href=&quot;http://en.wikipedia.org/wiki/Date_format_by_country&quot; target=&quot;_blank&quot;&gt;culture-specific format information&lt;/a&gt; about &lt;span class=&quot;parameter&quot;&gt;s&lt;/span&gt;. &lt;/dt&gt;&lt;/dl&gt;example&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;DateTime sessionDate = DateTime.ParseExact(txtDate.Text, &quot;M-d-yyyy&quot;, provider);&lt;br /&gt;&lt;/pre&gt;here provide is&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;CultureInfo provider = CultureInfo.InvariantCulture;&lt;br /&gt;&lt;/pre&gt;this will get txtDate.Text (Date) into &lt;a href=&quot;http://en.wikipedia.org/wiki/Date_format_by_country&quot; target=&quot;_blank&quot;&gt;culture wise date format&lt;/a&gt; to compare with database formatted datetime.&lt;br /&gt;&lt;br /&gt;Hope this Helps&lt;br /&gt;&lt;br /&gt;All the best.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/08/datetimeparseexact-culturewise-date.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-4908646797806751289</guid><pubDate>Tue, 14 Feb 2012 12:47:00 +0000</pubDate><atom:updated>2012-02-14T18:17:56.020+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error Handling</category><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Handle Devide By Zero Error</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi .. &lt;br /&gt;set Arithaboth and Ansi_Warnings as OFF to handle devide by Zero or any kind of arithmatic errors&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;SET ARITHABORT OFF&lt;br /&gt;SET ANSI_WARNINGS OFF&lt;br /&gt;Declare @Denominator int =0&lt;br /&gt;Declare @Numerator int =5&lt;br /&gt;SELECT isnull(@Numerator / @Denominator,0) as Result&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;happy coding....&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/02/handle-devide-by-zero-error.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>2</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-6098526953876142634</guid><pubDate>Sat, 07 Jan 2012 06:51:00 +0000</pubDate><atom:updated>2012-01-07T12:21:25.575+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">Performance</category><category domain="http://www.blogger.com/atom/ns#">Stored Procedure</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Improve Performance by using OUTPUT in Insert Or Update Statement in single query</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello friends,&lt;br /&gt;&lt;br /&gt;recently I needed to fire a single SQL statement for Insert and Update and using the single statement I also needed to return the result of all Inserted/Updated Records details..&lt;br /&gt;&lt;br /&gt;after searching a lot ... I came to know a very interesting way to perform both statement in single Query.&lt;br /&gt;&lt;br /&gt;Generally for the scenario I got lots of suggestions to use Stored Procedure, but which was difficult for my scenario.&lt;br /&gt;&lt;br /&gt;so I must get solution for it.&lt;br /&gt;&lt;br /&gt;ok ok... let&#39;s come to point.&lt;br /&gt;&lt;br /&gt;let&#39;s we have created a sample Table using the query&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;Create Table Table_1(Id Int Identity,Name nvarchar(100))&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;to insert records and get its generated Id &lt;br /&gt;basically we perform like this&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;Insert into Table_1(Name) &lt;br /&gt;Select &#39;Sandeep&#39;&lt;br /&gt;Select @@IDENTITY&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;and same way for update&lt;br /&gt;here the Updated value comes from other process which is not available Directly&lt;br /&gt;[My case is only For Insert. but the concept we can use in Update also]&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;Declare @NewValue nvarchar(100)=&#39;Sandeep Prajapati&#39;&lt;br /&gt;Declare @ID int=1&lt;br /&gt;&lt;br /&gt;Update Table_1&lt;br /&gt;set Name=@NewValue&lt;br /&gt;Where Id=@ID&lt;br /&gt;&lt;br /&gt;select @ID as ID,@NewValue as Name&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Now We can use OUTPUT key word to select the inserted/Updated Value to get affected rows in single query which also helps to improve performance.&lt;br /&gt;&lt;br /&gt;Here is query for Insert&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;Insert Into Table_1(Name)&lt;br /&gt;OutPut Inserted.Id,Inserted.Name&lt;br /&gt;values(&#39;Sandeep&#39;)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;after execution of the query the output is&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-e0WFjaLkFuo/Twfp2SwLzMI/AAAAAAAAAm4/SB7XjyvWGus/s1600/Updated.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-e0WFjaLkFuo/Twfp2SwLzMI/AAAAAAAAAm4/SB7XjyvWGus/s1600/Updated.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Same way for Update&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;pre class=&quot;brush: sql&quot;&gt;Update Table_1&lt;br /&gt;set Name=&#39;Sandeep Prajapati&#39;&lt;br /&gt;OutPut inserted.ID,inserted.Name&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://3.bp.blogspot.com/-e0WFjaLkFuo/Twfp2SwLzMI/AAAAAAAAAm4/SB7XjyvWGus/s1600/Updated.png&quot; imageanchor=&quot;1&quot; style=&quot;clear: left; float: left; margin-bottom: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;http://3.bp.blogspot.com/-e0WFjaLkFuo/Twfp2SwLzMI/AAAAAAAAAm4/SB7XjyvWGus/s1600/Updated.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Hope this helps...&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;Happy Coding...&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/01/improve-performance-by-using-output-in.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-e0WFjaLkFuo/Twfp2SwLzMI/AAAAAAAAAm4/SB7XjyvWGus/s72-c/Updated.png" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7208602508776973132</guid><pubDate>Mon, 02 Jan 2012 12:07:00 +0000</pubDate><atom:updated>2012-01-02T17:43:22.833+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">json</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">WCF</category><title>Sample for WCF using json</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Here is a sample for start WCF using json&lt;br /&gt;in aspx page&lt;br /&gt;&lt;pre class=&quot;brush: html&quot;&gt;  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;        function ajaxService2() {&lt;br /&gt;            serviceUrl = &quot;http://localhost/WCFS/Service1.svc/GetData&quot;;&lt;br /&gt;            var time = new Object();&lt;br /&gt;            time.value = &quot;1&quot;;&lt;br /&gt;            $.ajax({&lt;br /&gt;                type: &quot;POST&quot;,&lt;br /&gt;                url: serviceUrl,&lt;br /&gt;                data: JSON.stringify(time),&lt;br /&gt;                contentType: &quot;application/json; charset=utf-8&quot;,&lt;br /&gt;                dataType: &quot;json&quot;,&lt;br /&gt;                success: function (transport) {&lt;br /&gt;                    var string = transport;&lt;br /&gt;                    $(&quot;#&amp;lt;%= Text2.ClientID %&amp;gt;&quot;).val(string);&lt;br /&gt;                },&lt;br /&gt;                error: function (ex) {&lt;br /&gt;                    alert(&quot;error&quot; + ex.responseText);&lt;br /&gt;                }&lt;br /&gt;            });&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        function ajaxService1() {&lt;br /&gt;            serviceUrl = &quot;http://localhost/WCFS/Service1.svc/GetAllProducts&quot;;&lt;br /&gt;            $.ajax({&lt;br /&gt;                type: &quot;GET&quot;,&lt;br /&gt;                url: serviceUrl,&lt;br /&gt;                contentType: &quot;application/json; charset=utf-8&quot;,&lt;br /&gt;                dataType: &quot;json&quot;,&lt;br /&gt;                success: function (transport) {&lt;br /&gt;                    var string = transport;&lt;br /&gt;                    $(&quot;#&amp;lt;%= Text1.ClientID %&amp;gt;&quot;).val(string);&lt;br /&gt;                },&lt;br /&gt;                error: function (ex) {&lt;br /&gt;                    alert(&quot;error&quot; + ex);&lt;br /&gt;                }&lt;br /&gt;            });&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;    &amp;lt;h2&amp;gt;&lt;br /&gt;        Welcome to ASP.NET!&lt;br /&gt;    &amp;lt;/h2&amp;gt;&lt;br /&gt;    &amp;lt;p&amp;gt;&lt;br /&gt;        &amp;lt;p&amp;gt;&lt;br /&gt;            &amp;lt;input id=&quot;Button2&quot; onclick=&quot;ajaxService1()&quot; value=&quot;Ajax call service 1&quot; type=&quot;button&quot;&amp;gt;&lt;br /&gt;            &amp;lt;asp:textbox id=&quot;Text1&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/p&amp;gt;&lt;br /&gt;        &amp;lt;p&amp;gt;&lt;br /&gt;            &amp;lt;input id=&quot;Button3&quot; onclick=&quot;ajaxService2()&quot; value=&quot;Ajax call service 2&quot; type=&quot;button&quot;&amp;gt;&lt;br /&gt;            &amp;lt;asp:textbox id=&quot;Text2&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;/p&amp;gt;&lt;br /&gt;    &lt;/pre&gt;&lt;br /&gt;Web.config Settings for WCF and json in WCF’s Web.config&lt;br /&gt;&lt;pre class=&quot;brush: xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;    &amp;lt;system.web&amp;gt;&lt;br /&gt;        &amp;lt;compilation debug=&quot;true&quot; targetFramework=&quot;4.0&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/system.web&amp;gt;&lt;br /&gt;    &amp;lt;system.serviceModel&amp;gt;&lt;br /&gt;        &amp;lt;services&amp;gt;&lt;br /&gt;            &amp;lt;service name=&quot;WCFS.Service1&quot;&amp;gt;&lt;br /&gt;                &amp;lt;endpoint&lt;br /&gt;                address=&quot;&quot; binding=&quot;webHttpBinding&quot;&lt;br /&gt;                behaviorConfiguration=&quot;EndBehave&quot;&lt;br /&gt;                contract=&quot;WCFS.IService1&quot;/&amp;gt;&lt;br /&gt;            &amp;lt;/service&amp;gt;&lt;br /&gt;        &amp;lt;/services&amp;gt;&lt;br /&gt;        &amp;lt;behaviors&amp;gt;&lt;br /&gt;            &amp;lt;endpointBehaviors&amp;gt;&lt;br /&gt;                &amp;lt;behavior name=&quot;EndBehave&quot;&amp;gt;&lt;br /&gt;                    &amp;lt;webHttp/&amp;gt;&lt;br /&gt;                &amp;lt;/behavior&amp;gt;&lt;br /&gt;            &amp;lt;/endpointBehaviors&amp;gt;&lt;br /&gt;            &amp;lt;serviceBehaviors&amp;gt;&lt;br /&gt;                &amp;lt;behavior&amp;gt;&lt;br /&gt;                    &amp;lt;serviceMetadata httpGetEnabled=&quot;true&quot;  /&amp;gt;&lt;br /&gt;                    &amp;lt;serviceDebug  includeExceptionDetailInFaults=&quot;false&quot; /&amp;gt;&lt;br /&gt;                &amp;lt;/behavior&amp;gt;&lt;br /&gt;            &amp;lt;/serviceBehaviors&amp;gt;&lt;br /&gt;        &amp;lt;/behaviors&amp;gt;&lt;br /&gt;        &amp;lt;serviceHostingEnvironment multipleSiteBindingsEnabled=&quot;true&quot; aspNetCompatibilityEnabled=&quot;true&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/system.serviceModel&amp;gt;&lt;br /&gt;    &amp;lt;system.webServer&amp;gt;&lt;br /&gt;        &amp;lt;modules runAllManagedModulesForAllRequests=&quot;true&quot;/&amp;gt;&lt;br /&gt;    &amp;lt;/system.webServer&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;in WCF Interface&lt;br /&gt;&lt;pre class=&quot;brush: csharp&quot;&gt; // NOTE: You can use the &quot;Rename&quot; command on the &quot;Refactor&quot; menu to change the interface name &quot;IService1&quot; in both code and config file together.&lt;br /&gt;    [ServiceContract]&lt;br /&gt;    public interface IService1&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        [OperationContract]&lt;br /&gt;        [WebInvoke( ResponseFormat = WebMessageFormat.Json, Method = &quot;POST&quot;, BodyStyle = WebMessageBodyStyle.WrappedRequest)]&lt;br /&gt;        string GetData(int value);&lt;br /&gt;&lt;br /&gt;        [OperationContract]&lt;br /&gt;        CompositeType GetDataUsingDataContract(CompositeType composite);&lt;br /&gt;&lt;br /&gt;        [OperationContract]&lt;br /&gt;        [WebInvoke(UriTemplate = &quot;/GetAllProducts&quot;, ResponseFormat = WebMessageFormat.Json, Method = &quot;GET&quot;)]&lt;br /&gt;        List&amp;lt;product&amp;gt; GetAllProducts();&lt;br /&gt;        // TODO: Add your service operations here&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    [DataContract]&lt;br /&gt;    public class Product&lt;br /&gt;    {&lt;br /&gt;        [DataMember]&lt;br /&gt;        public int ProdId { get; set; }&lt;br /&gt;        [DataMember]&lt;br /&gt;        public string PropName { get; set; }&lt;br /&gt;        [DataMember]&lt;br /&gt;        public int Quantity { get; set; }&lt;br /&gt;        [DataMember]&lt;br /&gt;        public int Price { get; set; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    // Use a data contract as illustrated in the sample below to add composite types to service operations.&lt;br /&gt;    [DataContract]&lt;br /&gt;    public class CompositeType&lt;br /&gt;    {&lt;br /&gt;        bool boolValue = true;&lt;br /&gt;        string stringValue = &quot;Hello &quot;;&lt;br /&gt;&lt;br /&gt;        [DataMember]&lt;br /&gt;        public bool BoolValue&lt;br /&gt;        {&lt;br /&gt;            get { return boolValue; }&lt;br /&gt;            set { boolValue = value; }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        [DataMember]&lt;br /&gt;        public string StringValue&lt;br /&gt;        {&lt;br /&gt;            get { return stringValue; }&lt;br /&gt;            set { stringValue = value; }&lt;br /&gt;        }&lt;br /&gt;    }&lt;/product&gt;&lt;/pre&gt;&lt;br /&gt;Service Class&lt;br /&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] &lt;br /&gt;    public class Service1 : IService1&lt;br /&gt;    {&lt;br /&gt;        public List&amp;lt;product&amp;gt; GetAllProducts()&lt;br /&gt;        {&lt;br /&gt;            return new List&amp;lt;product&amp;gt;&lt;br /&gt;            {&lt;br /&gt;                 new Product() {ProdId=101,PropName=&quot;Laptop&quot;,Quantity=200,Price=45000},&lt;br /&gt;                 new Product() {ProdId=102,PropName=&quot;Desktop&quot;,Quantity=300,Price=35000},&lt;br /&gt;            };&lt;br /&gt;        }&lt;br /&gt;        public string GetData(int value)&lt;br /&gt;        {&lt;br /&gt;            return string.Format(&quot;You entered: {0}&quot;, value.ToString());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public CompositeType GetDataUsingDataContract(CompositeType composite)&lt;br /&gt;        {&lt;br /&gt;            if (composite == null)&lt;br /&gt;            {&lt;br /&gt;                throw new ArgumentNullException(&quot;composite&quot;);&lt;br /&gt;            }&lt;br /&gt;            if (composite.BoolValue)&lt;br /&gt;            {&lt;br /&gt;                composite.StringValue += &quot;Suffix&quot;;&lt;br /&gt;            }&lt;br /&gt;            return composite;&lt;br /&gt;        }&lt;br /&gt;    }&lt;/product&gt;&lt;/product&gt;&lt;/pre&gt;&lt;br /&gt;Happy Coding….&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2012/01/sample-for-wcf-using-json.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7287428731948838323</guid><pubDate>Wed, 21 Dec 2011 10:04:00 +0000</pubDate><atom:updated>2013-12-09T14:29:56.966+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Applicationpool</category><category domain="http://www.blogger.com/atom/ns#">IIS</category><title>Session Timeout in IIS 7 - Worker Process of ApplicationPool</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;b&gt;&lt;u&gt;Problem&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;Recently while testing my application, I was facing problem of Session time out. &lt;br /&gt;By Default Session time is 20 mins and I wanted to extend it&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;u&gt;Attempts&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;if we want to extend it we can set in web.config within System.web tag&lt;br /&gt;&amp;lt;sessionState mode=&quot;InProc&quot; timeout=&quot;30&quot;&amp;gt;&amp;lt;/sessionState&amp;gt;&lt;br /&gt;that I already have done.&lt;br /&gt;I set it as 30 mins.&lt;br /&gt;but still my session was getting timed out after 20 min.&lt;br /&gt;So I doubt that it doesn’t apply to my Code so I set It by code also like&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;System.Web.HttpContext.Current.Session.Timeout = 30;&lt;/pre&gt;&lt;br /&gt;still no progress&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;&lt;u&gt;Resolutions&lt;/u&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;after a long invastigation I came to know Its because Of Default Settings of ApplicationPool for the application in IIS.&lt;br /&gt;&lt;br /&gt;There is a setting for Worker process of IIS which will set memory and resource to allot to application application wide.&lt;br /&gt;&lt;br /&gt;in my case I was testing my application alone. So application was being idle for more than 20 min to check weather session is alive or not..&lt;br /&gt;&lt;br /&gt;To open the settings refer the steps&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Type “inetmgr” in run window to open IIS&lt;/li&gt; &lt;li&gt;from left pane “Connections” select your application.&lt;/li&gt; &lt;li&gt;right click on your application and refer the image to open “Advanced Settings” of application(to check which ApplicationPool is referred by application )&lt;a href=&quot;http://lh4.ggpht.com/-rMErHLSiTCA/TtoAwwMWU0I/AAAAAAAAAmA/9qzW3GuqLVw/s1600-h/1%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;1&quot; border=&quot;0&quot; height=&quot;166&quot; src=&quot;http://lh3.ggpht.com/-MzpRHBvGknI/TtoAysb6vfI/AAAAAAAAAmI/Mjsuaoo8sSE/1_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;1&quot; width=&quot;270&quot; /&gt;&lt;/a&gt;&lt;/li&gt; &lt;li&gt;from “Application Settings” window you can see the Name of ApplicationPool. like &lt;b&gt;Asp.net V4.0, DefaultAppPool, Asp.net V4.0 Classic.&lt;/b&gt;&lt;/li&gt; &lt;li&gt;now close both opened windows.&lt;/li&gt; &lt;li&gt;from left pan double click on &lt;b&gt;“Application Pools”, &lt;/b&gt;a list of created application pools will be displayed. if you want to create new application pool for specific application refer &lt;a href=&quot;http://technet.microsoft.com/en-us/library/cc731784%28WS.10%29.aspx&quot; target=&quot;_blank&quot;&gt;this&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Right click on the ApplicationPool that was assigned to your Application and click on &quot;Advanced Settings....&quot;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-LT5IJRMZY2Y/TvGrcswmuGI/AAAAAAAAAmU/mszw0iIowYU/s1600/AdvanceSettings.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;234&quot; src=&quot;http://4.bp.blogspot.com/-LT5IJRMZY2Y/TvGrcswmuGI/AAAAAAAAAmU/mszw0iIowYU/s320/AdvanceSettings.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;li&gt;&amp;nbsp;in the popup window ... check the Idle time out for ... that cause the timeout while web application is idle.&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;http://4.bp.blogspot.com/-ZzfSxTR59FI/TvGtbmEYkeI/AAAAAAAAAmc/vht4AGHWSK8/s1600/Output.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;320&quot; src=&quot;http://4.bp.blogspot.com/-ZzfSxTR59FI/TvGtbmEYkeI/AAAAAAAAAmc/vht4AGHWSK8/s320/Output.png&quot; width=&quot;261&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/li&gt;&lt;/ol&gt;Here are the steps to set Idle time..&lt;br /&gt;&lt;br /&gt;Happy Deploying...&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/12/session-timeout-in-iis-7-worker-process.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/-MzpRHBvGknI/TtoAysb6vfI/AAAAAAAAAmI/Mjsuaoo8sSE/s72-c/1_thumb%25255B1%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-4841923401374842483</guid><pubDate>Thu, 15 Dec 2011 14:51:00 +0000</pubDate><atom:updated>2011-12-15T20:24:04.787+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">SSRS</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Steps to Remove Menu options in Export for Report Page in SSRS</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi,&lt;br /&gt;In SSRS(Sql Server Reporting Service), I wanted to remove extra options to export my report.&lt;br /&gt;&lt;br /&gt;Here are the steps to remove option to export like (word, Excel, PDF, MHTML etc...) in SSRS (Sql Server Reporting Service)&lt;br /&gt;&lt;br /&gt;Installation folder may be different from MSSQL.1, can be MSSQL.x (search for rsreportserver.config under Program Files\Microsoft SQL Server if not found)&lt;br /&gt;Here are the steps for Disabling Excel Export Option in Reporting Services -&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Go to Database server where reporting services is installed, open the rsreportserver.config file located at&lt;span style=&quot;font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10pt; line-height: 115%;&quot;&gt; &amp;lt;Drive Letter&amp;gt;:\&lt;/span&gt;&lt;drive letter=&quot;&quot;&gt;Program Files\Microsoft SQL Server\MSSQL.3\Reporting Services\ReportServer&lt;/drive&gt;&lt;drive letter=&quot;&quot;&gt;&amp;nbsp;&lt;/drive&gt;&lt;/li&gt;&lt;li&gt;&lt;drive letter=&quot;&quot;&gt;Go to &lt;configuration&gt; &lt;render&gt; section. &lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;drive letter=&quot;&quot;&gt;&lt;configuration&gt;&lt;render&gt;&amp;nbsp;&lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;/li&gt;&lt;li&gt;&lt;drive letter=&quot;&quot;&gt;&lt;configuration&gt;&lt;render&gt;Change this entry &lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot;&gt; to&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot; visible=&quot;false&quot;&gt; i.e. add Visible=&quot;false&quot; for Excel rendering extension&lt;/extension&gt;&lt;/extension&gt;&lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;drive letter=&quot;&quot;&gt;&lt;configuration&gt;&lt;render&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot;&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot; visible=&quot;false&quot;&gt;&amp;nbsp;&lt;/extension&gt;&lt;/extension&gt;&lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;/li&gt;&lt;li&gt;&lt;drive letter=&quot;&quot;&gt;&lt;configuration&gt;&lt;render&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot;&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot; visible=&quot;false&quot;&gt;Same for PDF.&amp;nbsp;&amp;nbsp;&lt;/extension&gt;&lt;/extension&gt;&lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;/li&gt;&lt;/ol&gt;&lt;drive letter=&quot;&quot;&gt;&lt;configuration&gt;&lt;render&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot;&gt;&lt;extension name=&quot;EXCEL&quot; type=&quot;Microsoft.ReportingServices.Rendering.ExcelRenderer.ExcelRenderer,Microsoft.ReportingServices.ExcelRendering&quot; visible=&quot;false&quot;&gt;Happy Reporting &lt;/extension&gt;&lt;/extension&gt;&lt;/render&gt;&lt;/configuration&gt;&lt;/drive&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/12/steps-to-remove-menu-options-in-export.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-2238299926162411627</guid><pubDate>Sat, 19 Nov 2011 04:56:00 +0000</pubDate><atom:updated>2011-11-19T10:27:52.692+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Excel</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Create Excel File From DataTable</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello Friends,&lt;br /&gt;Many times we need to create Excel files in our application using existing Data.&lt;br /&gt;I have figured out a class which will help to create excel file by just passing DataTable and preferred location to generate on server.&lt;br /&gt;please download the cs file from &lt;a href=&quot;https://skydrive.live.com/?cid=552998535cb9985d&amp;amp;sc=documents&amp;amp;uc=1&amp;amp;id=552998535CB9985D%21127#&quot;&gt;here&lt;/a&gt; .. and use it :)&lt;br /&gt;&lt;iframe frameborder=&quot;0&quot; marginheight=&quot;0&quot; marginwidth=&quot;0&quot; scrolling=&quot;no&quot; src=&quot;https://skydrive.live.com/embedicon.aspx/.Public/ExcelHelper.cs?cid=552998535cb9985d&amp;amp;sc=documents&quot; style=&quot;background-color: #fcfcfc; height: 115px; padding: 0; width: 98px;&quot; title=&quot;Preview&quot;&gt;&lt;/iframe&gt;&lt;br /&gt;here is full code&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Xml;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    public class ExcelHelper&lt;br /&gt;    {&lt;br /&gt;        private static readonly ExcelHelper _instance = new ExcelHelper();&lt;br /&gt;&lt;br /&gt;        public static ExcelHelper Instance&lt;br /&gt;        {&lt;br /&gt;            get { return _instance; }&lt;br /&gt;        }&lt;br /&gt;        /// &amp;lt;summary&amp;gt;&lt;br /&gt;        /// Create one Excel-XML-Document with SpreadsheetML from a DataTable&lt;br /&gt;        /// &amp;lt;/summary&amp;gt;&lt;br /&gt;        /// &amp;lt;param name=&quot;dataSource&quot;&amp;gt;Datasource which would be exported in Excel&amp;lt;/param&amp;gt;&lt;br /&gt;        /// &amp;lt;param name=&quot;fileName&quot;&amp;gt;Name of exported file&amp;lt;/param&amp;gt;&lt;br /&gt;        public void Create(DataTable dtSource, string strFileName)&lt;br /&gt;        {&lt;br /&gt;            // Create XMLWriter&lt;br /&gt;            using (XmlTextWriter xtwWriter = new XmlTextWriter(strFileName, Encoding.UTF8))&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                //Format the output file for reading easier&lt;br /&gt;                xtwWriter.Formatting = Formatting.Indented;&lt;br /&gt;&lt;br /&gt;                // &amp;lt;?xml version=&quot;1.0&quot;?&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartDocument();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;?mso-application progid=&quot;Excel.Sheet&quot;?&amp;gt;&lt;br /&gt;                xtwWriter.WriteProcessingInstruction(&quot;mso-application&quot;, &quot;progid=\&quot;Excel.Sheet\&quot;&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Workbook xmlns=&quot;urn:schemas-microsoft-com:office:spreadsheet &amp;gt;&quot;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Workbook&quot;, &quot;urn:schemas-microsoft-com:office:spreadsheet&quot;);&lt;br /&gt;&lt;br /&gt;                //Write definition of namespace&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;xmlns&quot;, &quot;o&quot;, null, &quot;urn:schemas-microsoft-com:office:office&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;xmlns&quot;, &quot;x&quot;, null, &quot;urn:schemas-microsoft-com:office:excel&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;xmlns&quot;, &quot;ss&quot;, null, &quot;urn:schemas-microsoft-com:office:spreadsheet&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;xmlns&quot;, &quot;html&quot;, null, &quot;http://www.w3.org/TR/REC-html40&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;DocumentProperties xmlns=&quot;urn:schemas-microsoft-com:office:office&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;DocumentProperties&quot;, &quot;urn:schemas-microsoft-com:office:office&quot;);&lt;br /&gt;&lt;br /&gt;                // Write document properties&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Author&quot;, &quot;Sandeep Prajapati&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;LastAuthor&quot;, &quot;Sandeep Prajapati&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Created&quot;, DateTime.Now.ToString(&quot;u&quot;) + &quot;Z&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Company&quot;, &quot;XXXXXXXXXX&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Version&quot;, &quot;12&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/DocumentProperties&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;ExcelWorkbook xmlns=&quot;urn:schemas-microsoft-com:office:excel&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;ExcelWorkbook&quot;, &quot;urn:schemas-microsoft-com:office:excel&quot;);&lt;br /&gt;&lt;br /&gt;                // Write settings of workbook&lt;br /&gt;                xtwWriter.WriteElementString(&quot;WindowHeight&quot;, &quot;8010&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;WindowWidth&quot;, &quot;14805&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;WindowTopX&quot;, &quot;240&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;WindowTopY&quot;, &quot;105&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ProtectStructure&quot;, &quot;False&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ProtectWindows&quot;, &quot;False&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/ExcelWorkbook&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Styles&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Styles&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Style ss:ID=&quot;Default&quot; ss:Name=&quot;Normal&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Style&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;ID&quot;, null, &quot;Default&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Name&quot;, null, &quot;Normal&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Alignment ss:Vertical=&quot;Bottom&quot;/&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Alignment&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Vertical&quot;, null, &quot;Bottom&quot;);&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // Write null on the other properties&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Borders&quot;, null);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Font&quot;, null);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Interior&quot;, null);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;NumberFormat&quot;, null);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Protection&quot;, null);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Style&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                //&amp;lt;Style ss:ID=&quot;s16&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Style&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;ID&quot;, null, &quot;s16&quot;);&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Font&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Bold&quot;, null, &quot;1&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Size&quot;, null, &quot;11&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Underline&quot;, null, &quot;Single&quot;);&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Style&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Styles&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Worksheet ss:Name=&quot;xxx&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Worksheet&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Name&quot;, null, dtSource.TableName);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Table ss:ExpandedColumnCount=&quot;2&quot; ss:ExpandedRowCount=&quot;3&quot; x:FullColumns=&quot;1&quot; x:FullRows=&quot;1&quot; ss:DefaultColumnWidth=&quot;60&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Table&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;ExpandedColumnCount&quot;, null, dtSource.Columns.Count.ToString());&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;ExpandedRowCount&quot;, null, (dtSource.Rows.Count + 1).ToString());&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;FullColumns&quot;, null, &quot;1&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;FullRows&quot;, null, &quot;1&quot;);&lt;br /&gt;                //xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;DefaultColumnWidth&quot;, null, &quot;60&quot;);&lt;br /&gt;&lt;br /&gt;                // Run through all rows of data source&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Row&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Row&quot;);&lt;br /&gt;                foreach (DataColumn Header in dtSource.Columns)&lt;br /&gt;                {&lt;br /&gt;                    // &amp;lt;Cell&amp;gt;&lt;br /&gt;                    xtwWriter.WriteStartElement(&quot;Cell&quot;);&lt;br /&gt;                    xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;StyleID&quot;, null, &quot;s16&quot;);&lt;br /&gt;&lt;br /&gt;                    // &amp;lt;Data ss:Type=&quot;String&quot;&amp;gt;xxx&amp;lt;/Data&amp;gt;&lt;br /&gt;                    xtwWriter.WriteStartElement(&quot;Data&quot;);&lt;br /&gt;                    xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Type&quot;, null, &quot;String&quot;);&lt;br /&gt;                    // Write content of cell&lt;br /&gt;                    xtwWriter.WriteValue(Header.ColumnName);&lt;br /&gt;&lt;br /&gt;                    // &amp;lt;/Data&amp;gt;&lt;br /&gt;                    xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                    // &amp;lt;/Cell&amp;gt;&lt;br /&gt;                    xtwWriter.WriteEndElement();&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;                foreach (DataRow row in dtSource.Rows)&lt;br /&gt;                {&lt;br /&gt;                    // &amp;lt;Row&amp;gt;&lt;br /&gt;                    xtwWriter.WriteStartElement(&quot;Row&quot;);&lt;br /&gt;&lt;br /&gt;                    // Run through all cell of current rows&lt;br /&gt;                    foreach (object cellValue in row.ItemArray)&lt;br /&gt;                    {&lt;br /&gt;                        // &amp;lt;Cell&amp;gt;&lt;br /&gt;                        xtwWriter.WriteStartElement(&quot;Cell&quot;);&lt;br /&gt;                        //if (cnt == 0)&lt;br /&gt;                        //    xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;StyleID&quot;, null, &quot;s16&quot;);&lt;br /&gt;&lt;br /&gt;                        // &amp;lt;Data ss:Type=&quot;String&quot;&amp;gt;xxx&amp;lt;/Data&amp;gt;&lt;br /&gt;                        xtwWriter.WriteStartElement(&quot;Data&quot;);&lt;br /&gt;                        xtwWriter.WriteAttributeString(&quot;ss&quot;, &quot;Type&quot;, null, &quot;String&quot;);&lt;br /&gt;                        // Write content of cell&lt;br /&gt;                        string strcellValue = (cellValue == System.DBNull.Value ? string.Empty : (string)cellValue);&lt;br /&gt;                        xtwWriter.WriteValue(strcellValue);&lt;br /&gt;&lt;br /&gt;                        // &amp;lt;/Data&amp;gt;&lt;br /&gt;                        xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                        // &amp;lt;/Cell&amp;gt;&lt;br /&gt;                        xtwWriter.WriteEndElement();&lt;br /&gt;                    }&lt;br /&gt;                    // &amp;lt;/Row&amp;gt;&lt;br /&gt;                    xtwWriter.WriteEndElement();&lt;br /&gt;                }&lt;br /&gt;                // &amp;lt;/Table&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;WorksheetOptions xmlns=&quot;urn:schemas-microsoft-com:office:excel&quot;&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;WorksheetOptions&quot;, &quot;urn:schemas-microsoft-com:office:excel&quot;);&lt;br /&gt;&lt;br /&gt;                // Write settings of page&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;PageSetup&quot;);&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Header&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Margin&quot;, null, &quot;0.4921259845&quot;);&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Footer&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Margin&quot;, null, &quot;0.4921259845&quot;);&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;PageMargins&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Bottom&quot;, null, &quot;0.984251969&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Left&quot;, null, &quot;0.78740157499999996&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Right&quot;, null, &quot;0.78740157499999996&quot;);&lt;br /&gt;                xtwWriter.WriteAttributeString(&quot;x&quot;, &quot;Top&quot;, null, &quot;0.984251969&quot;);&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Selected/&amp;gt;&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Selected&quot;, null);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Panes&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Panes&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;Pane&amp;gt;&lt;br /&gt;                xtwWriter.WriteStartElement(&quot;Pane&quot;);&lt;br /&gt;&lt;br /&gt;                // Write settings of active field&lt;br /&gt;                xtwWriter.WriteElementString(&quot;Number&quot;, &quot;1&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ActiveRow&quot;, &quot;1&quot;);&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ActiveCol&quot;, &quot;1&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Pane&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Panes&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;ProtectObjects&amp;gt;False&amp;lt;/ProtectObjects&amp;gt;&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ProtectObjects&quot;, &quot;False&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;ProtectScenarios&amp;gt;False&amp;lt;/ProtectScenarios&amp;gt;&lt;br /&gt;                xtwWriter.WriteElementString(&quot;ProtectScenarios&quot;, &quot;False&quot;);&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/WorksheetOptions&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Worksheet&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // &amp;lt;/Workbook&amp;gt;&lt;br /&gt;                xtwWriter.WriteEndElement();&lt;br /&gt;&lt;br /&gt;                // Write file on hard disk&lt;br /&gt;                xtwWriter.Flush();&lt;br /&gt;                xtwWriter.Close();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;Write me if help full &lt;br /&gt;Happy Coding.. &lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/11/create-excel-file-from-datatable.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>1</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7732933990273164966</guid><pubDate>Fri, 18 Nov 2011 06:31:00 +0000</pubDate><atom:updated>2011-11-19T09:59:19.183+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">GridView</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Scroll to particular record in GridView</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello Friends,&lt;br /&gt;here is a tip to scroll the gridview to particular record.&lt;br /&gt;the basic concept is html scrolling. to scroll at particular position create an anchor tag with name as address (eg. #ScrollPoint &#39;# is must&#39;)&lt;br /&gt;&lt;br /&gt;now redirect the page to the location using javascript call&lt;br /&gt;&lt;pre class=&quot;brush: html&quot;&gt;window.location.href = &quot;#ScrollPoint&quot;;&lt;/pre&gt;&lt;br /&gt;&amp;nbsp;&lt;br /&gt;same thing can be achieved by anchorlink href&lt;br /&gt;here is sample code &lt;br /&gt; &lt;br /&gt;&lt;b&gt;HTML Page&lt;/b&gt;&lt;br /&gt;&lt;pre class=&quot;brush: html&quot;&gt;&amp;lt;asp:TextBox ID=&quot;TextBox2&quot; runat=&quot;server&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;&amp;lt;asp:Button ID=&quot;Button1&quot; runat=&quot;server&quot; Text=&quot;Button&quot; OnClientClick=&quot;return MoveTo();&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;div style=&quot;height: 100px; overflow: auto;&quot;&amp;gt;&lt;br /&gt;        &amp;lt;asp:GridView ID=&quot;GridView1&quot; runat=&quot;server&quot; AutoGenerateColumns=&quot;false&quot;&amp;gt;&lt;br /&gt;            &amp;lt;Columns&amp;gt;&lt;br /&gt;                &amp;lt;asp:TemplateField HeaderText=&quot;ID&quot; SortExpression=&quot;ID&quot;&amp;gt;&lt;br /&gt;                    &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;                        &amp;lt;asp:TextBox ID=&quot;TextBox1&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Bind(&quot;ID&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;                    &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;                    &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                        &amp;lt;a name=&#39;&amp;lt;%# Eval(&quot;ID&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/a&amp;gt;&lt;br /&gt;                        &amp;lt;asp:Label ID=&quot;Label1&quot; runat=&quot;server&quot; Text=&#39;&amp;lt;%# Bind(&quot;ID&quot;) %&amp;gt;&#39;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                    &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;                &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;                &amp;lt;asp:BoundField DataField=&quot;Name&quot; HeaderText=&quot;Name&quot; SortExpression=&quot;Name&quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/Columns&amp;gt;&lt;br /&gt;        &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;    &amp;lt;/div&amp;gt;  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;        function MoveTo() {&lt;br /&gt;            window.location.href = &quot;#&quot; + document.getElementById(&#39;&amp;lt;%= TextBox2.ClientID %&amp;gt;&#39;).value;&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;b&gt;Code Behind&lt;/b&gt;&lt;br /&gt;&lt;pre class=&quot;brush: csharp&quot;&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (!IsPostBack)&lt;br /&gt;            {&lt;br /&gt;                BindControls();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private void BindControls()&lt;br /&gt;        {&lt;br /&gt;            DataTable dt = new DataTable();&lt;br /&gt;            dt.Columns.Add(&quot;ID&quot;);&lt;br /&gt;            dt.Columns.Add(&quot;Name&quot;);&lt;br /&gt;            for (int i = 0; i &amp;lt; 200; i++)&lt;br /&gt;            {&lt;br /&gt;                AddRow(dt);    &lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            GridView1.DataSource = dt;&lt;br /&gt;            GridView1.DataBind();&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private static void AddRow(DataTable dt)&lt;br /&gt;        {&lt;br /&gt;            DataRow dr = dt.NewRow();&lt;br /&gt;            dr[&quot;ID&quot;] = dt.Rows.Count + 1;&lt;br /&gt;            dr[&quot;Name&quot;] = &quot;Sandeep&quot; + dt.Rows.Count + 1;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;/pre&gt;Happy Coding...&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/11/scroll-to-particular-record-in-gridview.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>2</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-4007398616960607466</guid><pubDate>Wed, 14 Sep 2011 11:15:00 +0000</pubDate><atom:updated>2011-12-21T16:48:14.092+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CTE</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Power of common table expression (CTE)</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello friends,&lt;br /&gt;Recently I came across a case where I was supposed to generate report for Customer based on services availed to him and for that I used A common table expression (CTE) and it really impressed.&lt;br /&gt;initially I referred this great document of MSDN &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/ms190766.aspx&quot; title=&quot;http://msdn.microsoft.com/en-us/library/ms190766.aspx&quot;&gt;http://msdn.microsoft.com/en-us/library/ms190766.aspx&lt;/a&gt;&lt;br /&gt;here is my Table of data.(Actual Tables are not like this, I have managed a simplified Table for the Demo.) &lt;br /&gt;&lt;a href=&quot;http://lh3.ggpht.com/-hQ58LF0IRIQ/TnCMtXLtt7I/AAAAAAAAAlg/L5POk7vwjTU/s1600-h/Original-Table-Sandeep4.png&quot;&gt;&lt;img alt=&quot;Original Table Sandeep&quot; border=&quot;0&quot; height=&quot;183&quot; src=&quot;http://lh6.ggpht.com/-sFSG4IB9NK8/TnCMuZDcbKI/AAAAAAAAAlk/AFXtfn9BtY4/Original-Table-Sandeep_thumb2.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Original Table Sandeep&quot; width=&quot;433&quot; /&gt;&lt;/a&gt;&lt;br /&gt;Here is query to generate Table&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;declare @t table (id int identity,CustID int, AgreementName varchar(100), ServDate Datetime,Price float)&lt;br /&gt;insert @t select 70       ,&#39;First Agreement&#39;,CONVERT(datetime,&#39;2011-01-05&#39;),10&lt;br /&gt;insert @t select 70       ,&#39;Second Agreement&#39;,CONVERT(datetime,&#39;2011-01-06&#39;),10&lt;br /&gt;insert @t select 75       ,&#39;First Agreement&#39;,CONVERT(datetime,&#39;2011-03-14&#39;),10&lt;br /&gt;insert @t select 70       ,&#39;Second Agreement&#39;,CONVERT(datetime,&#39;2011-01-05&#39;),30&lt;br /&gt;insert @t select 75       ,&#39;Third Agreement&#39;,CONVERT(datetime,&#39;2011-01-05&#39;),10&lt;br /&gt;insert @t select 90       ,&#39;Third Agreement&#39;,CONVERT(datetime,&#39;2011-04-16&#39;),20&lt;br /&gt;insert @t select 75       ,&#39;Third Agreement&#39;,CONVERT(datetime,&#39;2011-05-05&#39;),10&lt;br /&gt;insert @t select 90       ,&#39;Third Agreement&#39;,CONVERT(datetime,&#39;2011-02-20&#39;),90&lt;br /&gt;select * from @t&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The scenario is to display Customer’s total bill based on the services availed to him according to Service Agreement and Date..&lt;br /&gt;&lt;br /&gt;And Expect out put is as follow&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh6.ggpht.com/-80h87WbOg3Q/TnCMu6rOWlI/AAAAAAAAAlo/EXjqOnSREIM/s1600-h/Output%252520Table%252520Sandeep%25255B4%25255D.png&quot;&gt;&lt;img alt=&quot;Output Table Sandeep&quot; border=&quot;0&quot; height=&quot;89&quot; src=&quot;http://lh5.ggpht.com/-pGcmOiHjYfM/TnCMvkHKR9I/AAAAAAAAAls/J0zMw6cnrRs/Output%252520Table%252520Sandeep_thumb%25255B2%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom-width: 0px; border-left-width: 0px; border-right-width: 0px; border-top-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Output Table Sandeep&quot; width=&quot;416&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;For that I used the following query&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;&lt;br /&gt;;with cteTable(CustID,combined,inx,price)&lt;br /&gt;as&lt;br /&gt;(&lt;br /&gt;select CustID,  AgreementName + &#39; [&#39;+ CONVERT(varchar,ServDate,106)+&#39;]&#39;                        &lt;br /&gt;, inx=ROW_NUMBER() over (PARTITION by CustID order by AgreementName, ServDate),Price&lt;br /&gt;from @t t&lt;br /&gt;)&lt;br /&gt;,cteConcate(CustID,finalstatus,inx,Price1)&lt;br /&gt;as&lt;br /&gt;(&lt;br /&gt;select CustID, convert(varchar(max),combined), 1,(price) from cteTable where inx=1&lt;br /&gt;union all&lt;br /&gt;select cteConcate.CustID, convert(varchar(max),cteConcate.finalstatus+&#39;, &#39;+cteTable.combined), cteConcate.inx+1, cteTable.price&lt;br /&gt;from cteConcate&lt;br /&gt;inner join cteTable on cteTable.CustID = cteConcate.CustID and cteTable.inx=cteConcate.inx+1&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;select CustID, MAX(finalstatus) Description ,sum(Price1) Price from cteConcate group by CustID&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;if have any query please let me know.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Happy Coding….&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/09/power-of-common-table-expression-cte.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/-sFSG4IB9NK8/TnCMuZDcbKI/AAAAAAAAAlk/AFXtfn9BtY4/s72-c/Original-Table-Sandeep_thumb2.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-181711155352138020</guid><pubDate>Fri, 10 Jun 2011 10:47:00 +0000</pubDate><atom:updated>2011-06-10T20:22:11.983+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><category domain="http://www.blogger.com/atom/ns#">usercontrol</category><title>Access UserControl from Page</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;Hi..&lt;br /&gt;To perform some reparative operation in application, its preferred to use UserControls.&lt;br /&gt;Not necessary to have same display and bindings at everyplace. In that case we need to set values or call methods or pass values accordingly.&lt;br /&gt;Here I have tried to figure out three cases, Hope it is helpful.&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Pass Table to Usercontrol and Set dynamically value to Controls&lt;/li&gt;&lt;li&gt;Set Properties of control&lt;/li&gt;&lt;li&gt;Call Usercontrol&#39;s Methods&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Pass Table to Usercontrol and Set dynamically value to Controls&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Here in my case, I am passing Table to a Predefined Usercontrol, Which contains a GridView And on top a Label which is passed as Property of UserControl&lt;br /&gt;It will look like this&lt;br /&gt;&lt;a href=&quot;http://lh6.ggpht.com/-GvNrHJwuKn0/TfHvlnvyJ9I/AAAAAAAAAho/92hsv5U_hgA/s1600-h/1%25255B4%25255D.png&quot;&gt;&lt;img alt=&quot;1&quot; border=&quot;0&quot; height=&quot;240&quot; src=&quot;http://lh5.ggpht.com/-cErqyr5rlss/TfHvm9900lI/AAAAAAAAAhs/RaNqyQv5P-k/1_thumb%25255B2%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;1&quot; width=&quot;629&quot; /&gt;&lt;/a&gt;&lt;br /&gt;to code it try like this&lt;br /&gt;Create a new Usercontrol page e.g. (DisplayControl.ascx)&lt;br /&gt;The HTML will look like this&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:6d2d5fe1-b301-491f-9246-7748f4d440de&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&amp;lt;%@ Control Language=&quot;C#&quot; AutoEventWireup=&quot;true&quot; CodeBehind=&quot;DisplayControl.ascx.cs&quot;&lt;br /&gt;    Inherits=&quot;UserControlSample.Controls.DisplayControl&quot; %&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&lt;br /&gt;    &amp;lt;%= strTitle %&amp;gt;&amp;lt;/center&amp;gt;&lt;br /&gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;center&amp;gt;&lt;br /&gt;    &amp;lt;asp:GridView ID=&quot;grdDisplay&quot; runat=&quot;server&quot; CellPadding=&quot;4&quot; ForeColor=&quot;#333333&quot;&lt;br /&gt;        GridLines=&quot;None&quot;&amp;gt;&lt;br /&gt;        &amp;lt;AlternatingRowStyle BackColor=&quot;White&quot; ForeColor=&quot;#284775&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;EditRowStyle BackColor=&quot;#999999&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;FooterStyle BackColor=&quot;#5D7B9D&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;HeaderStyle BackColor=&quot;#5D7B9D&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;White&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;PagerStyle BackColor=&quot;#284775&quot; ForeColor=&quot;White&quot; HorizontalAlign=&quot;Center&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;RowStyle BackColor=&quot;#F7F6F3&quot; ForeColor=&quot;#333333&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;SelectedRowStyle BackColor=&quot;#E2DED6&quot; Font-Bold=&quot;True&quot; ForeColor=&quot;#333333&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;SortedAscendingCellStyle BackColor=&quot;#E9E7E2&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;SortedAscendingHeaderStyle BackColor=&quot;#506C8C&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;SortedDescendingCellStyle BackColor=&quot;#FFFDF8&quot; /&amp;gt;&lt;br /&gt;        &amp;lt;SortedDescendingHeaderStyle BackColor=&quot;#6F8DAE&quot; /&amp;gt;&lt;br /&gt;    &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&amp;lt;/center&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;in DisplayControl.ascx.cs file code will be like this&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a7d91d02-f8ac-4dde-9b12-ec1f69ec9ed0&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (!IsPostBack)&lt;br /&gt;            {                &lt;br /&gt;                BindGrid();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private void BindGrid()&lt;br /&gt;        {&lt;br /&gt;            grdDisplay.DataSource = DtTable;&lt;br /&gt;            grdDisplay.DataBind();&lt;br /&gt;        }&lt;br /&gt;        public string strTitle { get; set; }&lt;br /&gt;        public DataTable DtTable { get; set; }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now on Page where the Usercontrol is going to be displayed.&lt;br /&gt;&lt;br /&gt;Here &lt;b&gt;strTitle=&quot;Display Page&quot; &lt;/b&gt;sets Title for UserControl&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:ebf34b96-75b0-42a1-845e-1951fadfb8e8&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: text;&quot;&gt;&amp;lt;%@ Page Title=&quot;Home Page&quot; Language=&quot;C#&quot; MasterPageFile=&quot;~/Site.master&quot; AutoEventWireup=&quot;true&quot;&lt;br /&gt;    CodeBehind=&quot;Default.aspx.cs&quot; Inherits=&quot;UserControlSample._Default&quot; %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Register Src=&quot;Controls/DisplayControl.ascx&quot; TagName=&quot;DisplayControl&quot; TagPrefix=&quot;uc1&quot; %&amp;gt;&lt;br /&gt;&amp;lt;%@ Register Src=&quot;Controls/SetProperties.ascx&quot; TagName=&quot;SetProperties&quot; TagPrefix=&quot;uc2&quot; %&amp;gt;&lt;br /&gt;&amp;lt;%@ Register Src=&quot;Controls/AccessMethods.ascx&quot; TagName=&quot;AccessMethods&quot; TagPrefix=&quot;uc3&quot; %&amp;gt;&lt;br /&gt;&amp;lt;asp:Content ID=&quot;HeaderContent&quot; runat=&quot;server&quot; ContentPlaceHolderID=&quot;HeadContent&quot;&amp;gt;&lt;br /&gt;&amp;lt;/asp:Content&amp;gt;&lt;br /&gt;&amp;lt;asp:Content ID=&quot;BodyContent&quot; runat=&quot;server&quot; ContentPlaceHolderID=&quot;MainContent&quot;&amp;gt;&lt;br /&gt;    &amp;lt;h1&amp;gt;&lt;br /&gt;        Pass Table to Usercontrol and Set dynamically value to Controls&amp;lt;/h1&amp;gt;&lt;br /&gt;    &amp;lt;hr /&amp;gt;&lt;br /&gt;    &amp;lt;uc1:DisplayControl ID=&quot;DisplayControl1&quot; runat=&quot;server&quot; strTitle=&quot;Display Page&quot; /&amp;gt;&lt;br /&gt;  &lt;br /&gt;&amp;lt;/asp:Content&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;on Code behind&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:7a23effb-1b01-4146-bf59-963b040a73e0&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: css;&quot;&gt;  protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (!IsPostBack)&lt;br /&gt;            {&lt;br /&gt;                DisplayControl1.DtTable = GetTable();            &lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private DataTable GetTable()&lt;br /&gt;        {&lt;br /&gt;            DataTable dt = new DataTable();&lt;br /&gt;            dt.Columns.Add(&quot;ID&quot;);&lt;br /&gt;            dt.Columns.Add(&quot;Name&quot;);&lt;br /&gt;&lt;br /&gt;            DataRow dr = dt.NewRow();&lt;br /&gt;            dr[&quot;ID&quot;] = dt.Rows.Count + 1;&lt;br /&gt;            dr[&quot;Name&quot;] = &quot;Sandeep&quot;;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;            dr = dt.NewRow();&lt;br /&gt;            dr[&quot;ID&quot;] = dt.Rows.Count + 1;&lt;br /&gt;            dr[&quot;Name&quot;] = &quot;Nilesh&quot;;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;            dr = dt.NewRow();&lt;br /&gt;            dr[&quot;ID&quot;] = dt.Rows.Count + 1;&lt;br /&gt;            dr[&quot;Name&quot;] = &quot;Kamal&quot;;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;            dr = dt.NewRow();&lt;br /&gt;            dr[&quot;ID&quot;] = dt.Rows.Count + 1;&lt;br /&gt;            dr[&quot;Name&quot;] = &quot;Esha&quot;;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;&lt;br /&gt;            return dt;&lt;br /&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Set Properties of control&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Now Lets change property of any control of Usercontrol&lt;br /&gt;&lt;br /&gt;Here we will change the orientation of Login Control as “Vertical” / “Horizontal”&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh4.ggpht.com/-iPP5vpa2w1I/TfHzkk-wUxI/AAAAAAAAAhw/FVoCyUAZevY/s1600-h/2%25255B4%25255D.png&quot;&gt;&lt;img alt=&quot;2&quot; border=&quot;0&quot; height=&quot;110&quot; src=&quot;http://lh4.ggpht.com/-SL6ikFcyPqo/TfHzoIeu33I/AAAAAAAAAh0/PdCOPH0IXrI/2_thumb%25255B2%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; border-right: 0px; border-top: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;2&quot; width=&quot;661&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;The code on page where the control is called is &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:d9de5edb-9d7f-48dc-a03c-528e1f92c0fe&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&amp;lt;uc2:SetProperties ID=&quot;SetProperties1&quot; runat=&quot;server&quot; CtrlOrientation=&quot;Horizontal&quot; /&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Here CtrlOrientation is Property which will expect value of Orientation Class that is “Vertical” / “Horizontal”&lt;br /&gt;&lt;br /&gt;and on Usercontrol Drop &lt;b&gt;“Login”&lt;/b&gt; Control &lt;br /&gt;&lt;br /&gt;and in code &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:2fff7970-84f7-4562-9cad-4234ea5cfc7d&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            if (!IsPostBack)&lt;br /&gt;                Login1.Orientation = CtrlOrientation;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public Orientation CtrlOrientation { get; set; }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Call Usercontrol&#39;s Methods&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Call method of Usercontrol from Page.&lt;br /&gt;&lt;br /&gt;Here I am binding same grid from Page.&lt;br /&gt;&lt;br /&gt;to achive this in Usercontrol cs page&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:0e0edf11-2108-4b2e-a6ee-2038e525187a&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt; public void BindGrid()&lt;br /&gt;        {&lt;br /&gt;            grdDisplay.DataSource = GetTable();&lt;br /&gt;            grdDisplay.DataBind();&lt;br /&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;here BindGrid() Method is public so we can access it from Page with Control.&lt;br /&gt;&lt;br /&gt;like &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:967bdada-4cd5-4fb5-a947-672a456b69a1&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt;AccessMethods1.BindGrid();&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Download The &lt;a href=&quot;https://cid-552998535cb9985d.office.live.com/self.aspx/.Public/UserControlSample.zip&quot;&gt;Source&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Hope this help you..&lt;br /&gt;&lt;br /&gt;Enjoy Coding&lt;img alt=&quot;Smile&quot; class=&quot;wlEmoticon wlEmoticon-smile&quot; src=&quot;http://lh3.ggpht.com/-dS1Hba_9ydM/TfH1oQuY4LI/AAAAAAAAAh4/qjCHPYp6hwY/wlEmoticon-smile%25255B2%25255D.png?imgmax=800&quot; style=&quot;border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none;&quot; /&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/06/access-usercontrol-from-page.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/-cErqyr5rlss/TfHvm9900lI/AAAAAAAAAhs/RaNqyQv5P-k/s72-c/1_thumb%25255B2%25255D.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-8714822338309470446</guid><pubDate>Mon, 06 Jun 2011 12:05:00 +0000</pubDate><atom:updated>2011-06-06T17:36:13.239+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Set Default Value as Function to column of a Table</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello,&lt;br /&gt;Generally we need to set default value to particular column in Database Table like &lt;i&gt;isActive &lt;/i&gt;is &lt;i&gt;true, IsDeleted &lt;/i&gt;is &lt;i&gt;false.&lt;/i&gt;&lt;br /&gt;same way many times we set &lt;i&gt;CreatedOn &lt;/i&gt;Date as CurrentDate and that is by query of insert &lt;i&gt;GetDate().&lt;/i&gt;&lt;br /&gt;&lt;i&gt;&lt;/i&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Static Values : &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Its very easy to set some static value as Default value for column and that is as follow :&lt;br /&gt;&lt;a href=&quot;http://lh3.ggpht.com/-Q4t-uiuaPKs/TezCTJmWyxI/AAAAAAAAAhM/u8gd2NODvXo/s1600-h/Static5.png&quot;&gt;&lt;img alt=&quot;Static&quot; border=&quot;0&quot; height=&quot;218&quot; src=&quot;http://lh4.ggpht.com/-Kd5ryf_wzEM/TezCUWNOh0I/AAAAAAAAAhQ/ysaJq8lYoh0/Static_thumb3.png?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Static&quot; width=&quot;428&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Functions :&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Set Default Date for &lt;i&gt;Createdon&lt;/i&gt; Field as Follow :&lt;br /&gt;&lt;a href=&quot;http://lh6.ggpht.com/-2_Yuk7OUYCU/TezCVnLrrEI/AAAAAAAAAhU/rLCb9W_cHLM/s1600-h/Date%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;Date&quot; border=&quot;0&quot; height=&quot;214&quot; src=&quot;http://lh3.ggpht.com/-4ZORUMEiwSQ/TezCXKtq2QI/AAAAAAAAAhY/Yi83hwYypfw/Date_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Date&quot; width=&quot;429&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;b&gt;&lt;span style=&quot;font-size: small;&quot;&gt;User Defined Functions : &lt;/span&gt;&lt;/b&gt;&lt;br /&gt;Set User Defined function as Default Value as follow:&lt;br /&gt;In my case I am supposed to get Random Hexa Code for Color. so I Have created an User Defined function for that&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:c18ef657-3311-436c-834a-aefd2c153b14&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: sql;collapse:true;&quot;&gt;CREATE FUNCTION [dbo].[GetRandomColorCode]&lt;br /&gt;( &lt;br /&gt;)&lt;br /&gt;RETURNS varchar(6)&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;Declare @Color varchar(6)&lt;br /&gt; RETURN (SELECT MyNewID FROM dbo.MyNewID)&lt;br /&gt;END&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now set the function in columns as follow :&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh5.ggpht.com/-yDUlqHlnFDo/TezCYgL6JuI/AAAAAAAAAhc/e8CrEvmNAHM/s1600-h/UserDefined%25255B3%25255D.png&quot;&gt;&lt;img alt=&quot;UserDefined&quot; border=&quot;0&quot; height=&quot;188&quot; src=&quot;http://lh3.ggpht.com/-fabZm86hLoo/TezCa0Y3ByI/AAAAAAAAAhg/nI0K_-PfyrU/UserDefined_thumb%25255B1%25255D.png?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;UserDefined&quot; width=&quot;424&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;If this do not allow us to set Default value try following query to set&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:bb2b6884-144d-4090-96eb-9b60d4fa0daf&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: sql;&quot;&gt;ALTER TABLE dbo.Table_1 ADD CONSTRAINT&lt;br /&gt; DF_Table_1_ColorCode DEFAULT ([dbo].[GetRandomColorCode]()) FOR ColorCode&lt;br /&gt;GO&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;All the best&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Happy Coding..&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/06/set-default-value-as-function-to-column.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh4.ggpht.com/-Kd5ryf_wzEM/TezCUWNOh0I/AAAAAAAAAhQ/ysaJq8lYoh0/s72-c/Static_thumb3.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-5187263985005064850</guid><pubDate>Thu, 26 May 2011 13:42:00 +0000</pubDate><atom:updated>2011-05-26T19:13:42.431+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Error Handling</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Track Error in Javascript Page</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;Hi &lt;br /&gt;Many times we have faced problems to find what is javascript errors and exactly where??&lt;br /&gt;To track javascript error, It is a good practice to write code in &lt;b&gt;Try..Catch&lt;/b&gt;&lt;br /&gt;but sometimes some small syntax error are not allowing to execute the whole js file.&lt;br /&gt;so to track such error during development, we can track by this sample code&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:60a3e2a4-052b-4ff1-b114-51a3a5fd69a9&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: javascript;&quot;&gt;  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;        onerror = CallOnError;&lt;br /&gt;        function CallOnError(msg, url, line) {&lt;br /&gt;            var strErrMessage = &quot;&quot;;&lt;br /&gt;            strErrMessage += &quot;Message: &quot; + msg + &quot;\n&quot;;&lt;br /&gt;            strErrMessage += &quot;Page: &quot; + url + &quot;\n&quot;;&lt;br /&gt;            strErrMessage += &quot;Line Number: &quot; + line + &quot;\n\n&quot;;&lt;br /&gt;            alert(strErrMessage);&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;  &lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Here is a sample error &lt;br /&gt;&lt;br /&gt;try to put on your page &lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:132dc33b-58b9-449f-91a7-e378c03a8c37&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: javascript;&quot;&gt;  &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;            alert(&#39;This is First Test Page);&lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Enjoy Coding&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/05/track-error-in-javascript-page.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-6799579164619616644</guid><pubDate>Mon, 16 May 2011 09:29:00 +0000</pubDate><atom:updated>2011-05-16T14:59:18.422+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Interview</category><category domain="http://www.blogger.com/atom/ns#">SQL Server</category><category domain="http://www.blogger.com/atom/ns#">T-SQL</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Second Highest Salary- Sql Query</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a3d8bcb7-fb6c-4018-836d-1358f667d6a9&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: sql;collapse:true;&quot;&gt;Create Table #Emp(id int identity primary key,&lt;br /&gt;    Emp varchar(100),&lt;br /&gt;    Salary int)&lt;br /&gt;&lt;br /&gt;insert into #Emp&lt;br /&gt;select &#39;XXXX&#39;,17000 union all&lt;br /&gt;select &#39;DDDD&#39;,21000 union all&lt;br /&gt;select &#39;WWWW&#39;,30000 union All&lt;br /&gt;Select &#39;HHHH&#39;,21000 union All&lt;br /&gt;select &#39;CCCC&#39;,30000 union All&lt;br /&gt;Select &#39;TTTT&#39;,21000 union All&lt;br /&gt;SElect &#39;PPPP&#39;,21000&lt;br /&gt;&lt;br /&gt;select * from #Emp&lt;br /&gt;&lt;br /&gt;select #Emp.* &lt;br /&gt;from (select ROW_NUMBER() over (order by salary desc) as RowNumber, Salary&lt;br /&gt;   from #Emp&lt;br /&gt;    group by Salary) as tempEmp inner join #Emp on tempEmp.Salary = #Emp.Salary&lt;br /&gt;   where tempEmp.RowNumber=2&lt;br /&gt;&lt;br /&gt;Drop Table #Emp&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Data Will Look like this&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh5.ggpht.com/_-7eTu68KmOU/Tcu9dDr9IXI/AAAAAAAAAgk/eYMDbHh2Tag/s1600-h/Data%5B2%5D.png&quot;&gt;&lt;img alt=&quot;Data&quot; border=&quot;0&quot; height=&quot;171&quot; src=&quot;http://lh5.ggpht.com/_-7eTu68KmOU/Tcu9eZEc-fI/AAAAAAAAAgo/YlO6VpgZ5s4/Data_thumb.png?imgmax=800&quot; style=&quot;background-image: none; border: 0px none; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Data&quot; width=&quot;180&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Output will be like this&lt;br /&gt;&lt;br /&gt;&lt;a href=&quot;http://lh4.ggpht.com/_-7eTu68KmOU/Tcu9fPnc56I/AAAAAAAAAgs/jkP-HOXuMJs/s1600-h/Output%5B2%5D.png&quot;&gt;&lt;img alt=&quot;Output&quot; border=&quot;0&quot; height=&quot;110&quot; src=&quot;http://lh4.ggpht.com/_-7eTu68KmOU/Tcu9gLMkfKI/AAAAAAAAAgw/IrOtvR9sdSI/Output_thumb.png?imgmax=800&quot; style=&quot;background-image: none; border: 0px none; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;Output&quot; width=&quot;179&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/05/second-highest-salary-sql-query.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_-7eTu68KmOU/Tcu9eZEc-fI/AAAAAAAAAgo/YlO6VpgZ5s4/s72-c/Data_thumb.png?imgmax=800" height="72" width="72"/><thr:total>1</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-4638136830728151269</guid><pubDate>Fri, 29 Apr 2011 12:30:00 +0000</pubDate><atom:updated>2011-05-02T15:40:35.100+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Image</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><category domain="http://www.blogger.com/atom/ns#">Security</category><category domain="http://www.blogger.com/atom/ns#">Tips and Tricks</category><title>Protect image from being copied</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello Friends,&lt;br /&gt;&lt;br /&gt;Many times I am asked to protect some copyrighted images over web,&lt;br /&gt;so finally I have found a better way to protect from being copied.&lt;br /&gt;There are some cases by which we can copy the image&lt;br /&gt;Here I have taken care of following cases&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Right click on image and Save the Image  &lt;/li&gt;&lt;li&gt;Save the Entire page and all images displayed on page will be downloaded to its Data Folder  &lt;/li&gt;&lt;li&gt;in mozila Firefox, We can save the media files by following steps  &lt;ol&gt;&lt;li&gt;Right click on Page, select “View Page Info”  &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://lh6.ggpht.com/_-7eTu68KmOU/TbqszVFK8YI/AAAAAAAAAgU/J5M81masBQw/s1600-h/ViewSourceSandeep%5B2%5D.png&quot;&gt;&lt;img alt=&quot;ViewSourceSandeep&quot; border=&quot;0&quot; height=&quot;244&quot; src=&quot;http://lh6.ggpht.com/_-7eTu68KmOU/Tbqs0RqSBXI/AAAAAAAAAgY/fHAq-_yAg0s/ViewSourceSandeep_thumb.png?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;ViewSourceSandeep&quot; width=&quot;193&quot; /&gt;&lt;/a&gt;  &lt;/li&gt;&lt;li&gt;It will open a window, Select “Media” tab, here a list of all files will be available  &lt;/li&gt;&lt;li&gt;select particular file and click on “Save As” button to save the media  &lt;/li&gt;&lt;li&gt;&lt;a href=&quot;http://lh3.ggpht.com/_-7eTu68KmOU/Tbqs15nVLcI/AAAAAAAAAgc/UeWUkTQlLUs/s1600-h/SavemediaSandeep%5B2%5D.png&quot;&gt;&lt;img alt=&quot;SavemediaSandeep&quot; border=&quot;0&quot; height=&quot;220&quot; src=&quot;http://lh3.ggpht.com/_-7eTu68KmOU/Tbqs3bKXV2I/AAAAAAAAAgg/meIe2CfhsBA/SavemediaSandeep_thumb.png?imgmax=800&quot; style=&quot;background-image: none; border-width: 0px; display: inline; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot; title=&quot;SavemediaSandeep&quot; width=&quot;244&quot; /&gt;&lt;/a&gt;&lt;/li&gt;&lt;/ol&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;Now Let’s Start our main topic,that is protect image from being copied&lt;br /&gt;There is a concept called &lt;a href=&quot;http://en.wikipedia.org/wiki/Data_URI_scheme&quot; target=&quot;_blank&quot; title=&quot;Data URI scheme&quot;&gt;Data URI scheme&lt;/a&gt;. &lt;br /&gt;Generally to display any image on page, we use Relative_URL and if we display image using this, the images can be easily copied.&lt;br /&gt;Here we will save image in database and retrieve the same &lt;br /&gt;To Create table &lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:6e22e35e-2d58-4523-93b5-1c78bcde8adb&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: sql;&quot;&gt;&lt;br /&gt;CREATE TABLE [dbo].[Images](&lt;br /&gt; [ImageID] [int] IDENTITY(1,1) NOT NULL,&lt;br /&gt; [ImageName] [varchar](50) NULL,&lt;br /&gt; [Image] [image] NULL,&lt;br /&gt; [ext] [varchar](50) NULL,&lt;br /&gt; CONSTRAINT [PK_Images] PRIMARY KEY CLUSTERED &lt;br /&gt;(&lt;br /&gt; [ImageID] ASC&lt;br /&gt;)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]&lt;br /&gt;) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;Now, &lt;br /&gt;&lt;br /&gt;the aspx page will be very simple like&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a name=&#39;more&#39;&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:92159899-4d11-44f9-8fec-5840d7849330&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: html;&quot;&gt;&amp;lt;asp:Content ID=&quot;BodyContent&quot; runat=&quot;server&quot; ContentPlaceHolderID=&quot;MainContent&quot;&amp;gt;&lt;br /&gt;    &amp;lt;table&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                Name&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:TextBox ID=&quot;txtName&quot; runat=&quot;server&quot; ValidationGroup=&quot;Uploadgrp&quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:RequiredFieldValidator ID=&quot;rfvdName&quot; runat=&quot;server&quot; ControlToValidate=&quot;txtName&quot;&lt;br /&gt;                    ValidationGroup=&quot;Uploadgrp&quot; ErrorMessage=&quot;*&quot;&amp;gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                Image&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:FileUpload ID=&quot;flImgUpload&quot; runat=&quot;server&quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;amp;nbsp;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;        &lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:Button ID=&quot;btnUpload&quot; ValidationGroup=&quot;Uploadgrp&quot; runat=&quot;server&quot; OnClick=&quot;btnUpload_Click&quot;&lt;br /&gt;                    Text=&quot;Upload &quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;amp;nbsp;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:Label ID=&quot;lblMessage&quot; runat=&quot;server&quot;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;amp;nbsp;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;    &amp;lt;/table&amp;gt;&lt;br /&gt;    &amp;lt;table&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;asp:Button ID=&quot;btnFetch&quot; runat=&quot;server&quot; OnClick=&quot;btnFetch_Click&quot; Text=&quot;Fetch the Last image&quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;        &amp;lt;tr&amp;gt;&lt;br /&gt;            &amp;lt;td&amp;gt;&lt;br /&gt;                &amp;lt;img oncontextmenu=&quot;return false;&quot; runat=&quot;server&quot; id=&quot;imgDisplay&quot; style=&quot;width: 400px; height: 400px;&quot; /&amp;gt;&lt;br /&gt;            &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;/tr&amp;gt;&lt;br /&gt;    &amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;/asp:Content&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;here&amp;nbsp; &lt;b&gt;oncontextmenu=&quot;return false;&quot; &lt;/b&gt;using this line of code you can prevent right click on image.&lt;br /&gt;&lt;br /&gt;This will protect image to save by right click&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:a7c9ff18-176c-4bf0-913f-6226052f819b&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Data;&lt;br /&gt;&lt;br /&gt;namespace TestRequest&lt;br /&gt;{&lt;br /&gt;    public partial class _Default : System.Web.UI.Page&lt;br /&gt;    {&lt;br /&gt;        protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        protected void btnFetch_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            SqlConnection con = new SqlConnection();&lt;br /&gt;            con.ConnectionString = ConfigurationManager.ConnectionStrings[&quot;TestBlogConnectionString1&quot;].ConnectionString;&lt;br /&gt;            SqlCommand cmd = new SqlCommand();&lt;br /&gt;            cmd.CommandText = &quot;Select top 1 ImageName,Image,ext From Images order by imageid desc &quot;;&lt;br /&gt;            cmd.CommandType = CommandType.Text;&lt;br /&gt;            cmd.Connection = con;&lt;br /&gt;            con.Open();&lt;br /&gt;            SqlDataReader rd = cmd.ExecuteReader();&lt;br /&gt;            rd.Read();&lt;br /&gt;            imgDisplay.Src = GetBase64Image((byte[])rd[&quot;Image&quot;], (string)rd[&quot;ext&quot;]);&lt;br /&gt;            con.Close();&lt;br /&gt;        }&lt;br /&gt;        protected void btnUpload_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            string strImageName = txtName.Text.ToString();&lt;br /&gt;            if (flImgUpload.PostedFile != null &amp;amp;&amp;amp; flImgUpload.PostedFile.FileName != &quot;&quot;)&lt;br /&gt;            {&lt;br /&gt;                byte[] imageSize = new byte[flImgUpload.PostedFile.ContentLength];&lt;br /&gt;                HttpPostedFile uploadedImage = flImgUpload.PostedFile;&lt;br /&gt;                string strext = flImgUpload.FileName.Substring(flImgUpload.FileName.LastIndexOf(&quot;.&quot;) + 1).ToLower();&lt;br /&gt;                uploadedImage.InputStream.Read(imageSize, 0, (int)flImgUpload.PostedFile.ContentLength);&lt;br /&gt;&lt;br /&gt;                SqlConnection con = new SqlConnection();&lt;br /&gt;                con.ConnectionString = ConfigurationManager.ConnectionStrings[&quot;TestBlogConnectionString1&quot;].ConnectionString;&lt;br /&gt;&lt;br /&gt;                SqlCommand cmd = new SqlCommand();&lt;br /&gt;                cmd.CommandText = &quot;INSERT INTO Images(ImageName,Image,Ext)  VALUES (@ImageName,@Image,@ext)&quot;;&lt;br /&gt;                cmd.CommandType = CommandType.Text;&lt;br /&gt;                cmd.Connection = con;&lt;br /&gt;&lt;br /&gt;                SqlParameter ImageName = new SqlParameter(&quot;@ImageName&quot;, SqlDbType.VarChar, 50);&lt;br /&gt;                ImageName.Value = strImageName.ToString();&lt;br /&gt;                cmd.Parameters.Add(ImageName);&lt;br /&gt;&lt;br /&gt;                SqlParameter UploadedImage = new SqlParameter(&quot;@Image&quot;, SqlDbType.Image, imageSize.Length);&lt;br /&gt;                UploadedImage.Value = imageSize;&lt;br /&gt;                cmd.Parameters.Add(UploadedImage);&lt;br /&gt;&lt;br /&gt;                SqlParameter Ext = new SqlParameter(&quot;@Ext&quot;, SqlDbType.VarChar, 50);&lt;br /&gt;                Ext.Value = strext;&lt;br /&gt;                cmd.Parameters.Add(Ext);&lt;br /&gt;&lt;br /&gt;                con.Open();&lt;br /&gt;                int result = cmd.ExecuteNonQuery();&lt;br /&gt;                con.Close();&lt;br /&gt;                if (result &amp;gt; 0)&lt;br /&gt;                    lblMessage.Text = &quot;File Uploaded&quot;;&lt;br /&gt;                txtName.Text = string.Empty;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;        private string GetBase64Image(byte[] data, string ext)&lt;br /&gt;        {&lt;br /&gt;            string binaryRepresenatation = string.Concat(&quot;data:image/&quot; + ext + &quot;;base64,&quot;, Convert.ToBase64String(data));&lt;br /&gt;            return binaryRepresenatation;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;the main game is &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;wlWriterSmartContent&quot; id=&quot;scid:f32c3428-b7e9-4f15-a8ea-c502c7ff2e88:fac28344-4b31-41ef-a89b-fb1a9846498c&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;&lt;pre class=&quot;brush: c#;&quot;&gt; private string GetBase64Image(byte[] data, string ext)&lt;br /&gt;        {&lt;br /&gt;            string binaryRepresenatation = string.Concat(&quot;data:image/&quot; + ext + &quot;;base64,&quot;, Convert.ToBase64String(data));&lt;br /&gt;            return binaryRepresenatation;&lt;br /&gt;        }&lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;it will generate base64 format of byte[] of Image. and using &lt;a href=&quot;http://en.wikipedia.org/wiki/Data_URI_scheme&quot; target=&quot;_blank&quot; title=&quot;Data URI scheme&quot;&gt;Data URI scheme&lt;/a&gt; it generates image by CSS…&lt;/div&gt;&lt;br /&gt;&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;this is very common to implement and will help to protect image &lt;br /&gt;&lt;br /&gt;click here to download the &lt;a href=&quot;https://cid-552998535cb9985d.office.live.com/self.aspx/.Public/TestRequest.zip&quot;&gt;source&lt;/a&gt;&lt;br /&gt;All the best &lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/04/protect-image-from-being-copied.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh6.ggpht.com/_-7eTu68KmOU/Tbqs0RqSBXI/AAAAAAAAAgY/fHAq-_yAg0s/s72-c/ViewSourceSandeep_thumb.png?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-545047745706069826</guid><pubDate>Mon, 04 Apr 2011 13:22:00 +0000</pubDate><atom:updated>2013-12-09T14:40:52.950+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">GridView</category><category domain="http://www.blogger.com/atom/ns#">LINQ</category><category domain="http://www.blogger.com/atom/ns#">Repeater</category><category domain="http://www.blogger.com/atom/ns#">Stored Procedure</category><title>Fetch Data from Control Without Loop- Best Use of LINQ</title><description>&lt;p&gt;Hi friends….&lt;/p&gt;&lt;p&gt;Many times I need to generate collection type Data from GridView or Repeater or any other control.. and in that case I used to loop through each rowitem of particular control..&lt;/p&gt;&lt;p&gt;here each row of repeater is listitem of LINQ query.&lt;/p&gt;&lt;p&gt;same way you can perform for all DataBound Controls like GridView, Repeater, DataList, DropDownlist, CheckboxList, Radiobuttonlist etc…&lt;/p&gt;&lt;p&gt;but after using &lt;a href=&quot;http://msdn.microsoft.com/en-us/netframework/aa904594&quot; target=&quot;_blank&quot;&gt;LINQ&lt;/a&gt;, I am able to do that very easily&lt;/p&gt;&lt;p&gt;here is sample of Repeater control to Get List of data &lt;/p&gt;&lt;pre class=&quot;brush: c#&quot;&gt;List&lt;ctrlinfo&gt; ctrls = (from item in rptctrlList.Items.Cast&lt;repeateritem&gt;()&lt;br /&gt;                                    where ((CheckBox)item.FindControl(&quot;chkctrl&quot;)).Checked&lt;br /&gt;                                    select new ctrlInfo()&lt;br /&gt;                                    {&lt;br /&gt;                                        ctrlId = Convert.ToInt32(((HiddenField)item.FindControl(&quot;hdnctrlId&quot;)).Value),&lt;br /&gt;                                        UserctrlId = Convert.ToInt64(((HiddenField)item.FindControl(&quot;hdnUserctrlId&quot;)).Value),&lt;br /&gt;                                    }).ToList();&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;now I can pass XML to database from this List&amp;lt;ctrlInfo&amp;gt; using&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;var ctrlXML = from ctrl in ctrls&lt;br /&gt;                          select new XElement(&quot;ctrl&quot;,&lt;br /&gt;                          new XElement(&quot;UserId&quot;, ctrl.UserId),&lt;br /&gt;                          new XElement(&quot;ctrlId&quot;, ctrl.ctrlId),&lt;br /&gt;                          new XElement(&quot;UserctrlId&quot;, ctrl.UserctrlId));&lt;br /&gt;            ctrlsXML.Add(ctrlXML);&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now…. You can pass the XML to Stored Procedure. and in Stored Procedure&lt;/p&gt;&lt;br /&gt;&lt;p&gt;using &lt;/p&gt;&lt;br /&gt;&lt;pre class=&quot;brush: sql&quot;&gt;SELECT &lt;br /&gt;c.value(&#39;ctrlId[1]&#39;,&#39;int&#39;) As ctrlId&lt;br /&gt;, c.value(&#39;UserId[1]&#39;,&#39;BigInt&#39;) As UserId&lt;br /&gt;, c.value(&#39;UserctrlId[1]&#39;,&#39;BigInt&#39;) As UserctrlId&lt;br /&gt;FROM @ctrlIdListXML.nodes(&#39;/ctrls/ctrl&#39;)e(c)&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;you can have Table of selected records of Repeater control.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;using &lt;a href=&quot;http://technet.microsoft.com/en-us/library/bb510625.aspx&quot; target=&quot;_blank&quot;&gt;merge statement&lt;/a&gt; you can perform operation.&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Hope this Helps &lt;/p&gt;&lt;br /&gt;&lt;p&gt;All the Best &lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/04/fetch-data-from-control-without-loop.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-8476118806050585423</guid><pubDate>Fri, 01 Apr 2011 05:00:00 +0000</pubDate><atom:updated>2013-12-09T14:47:34.528+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">Image</category><title>Apply Frame to Image with CSS</title><description>&lt;p&gt;Hello &lt;/p&gt;&lt;p&gt;Many times we need to display image like profile image or advertisements &lt;/p&gt;&lt;p&gt;and at that time we need to decorate it within frame…&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Here we have a simplest way to apply frame which will help to set frame to any size image and unique for all..&lt;/p&gt;&lt;br /&gt;here I have a sample code for it&lt;/p&gt;&lt;pre class=&quot;brush: xhtml&quot;&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;style&amp;gt;&lt;br /&gt;img {&lt;br /&gt;    background: url(&amp;quot;shadow.gif&amp;quot;) no-repeat scroll right bottom transparent;&lt;br /&gt;    border-color: #EEEEEE -moz-use-text-color -moz-use-text-color #EEEEEE;&lt;br /&gt;    border-right: medium none;&lt;br /&gt;    border-style: solid none none solid;&lt;br /&gt;    border-width: 1px medium medium 1px;&lt;br /&gt;    padding: 4px 10px 10px 4px;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;     &amp;lt;img src=&#39;http://4.bp.blogspot.com/-AopW7qPMKPg/TX_vr-QT8CI/AAAAAAAAAe4/MwMlaUa3-1g/s220/Sandeep.JPG&#39;&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;and the you can have any kind of frame image &lt;/p&gt;&lt;br /&gt;&lt;p&gt;here I am uploading a sample image&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://lh3.ggpht.com/_-7eTu68KmOU/TZVbzxem73I/AAAAAAAAAfY/SD9QPYaF-ZY/s1600-h/shadow%5B2%5D.gif&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;shadow&quot; border=&quot;0&quot; alt=&quot;shadow&quot; src=&quot;http://lh5.ggpht.com/_-7eTu68KmOU/TZVb09Q4-cI/AAAAAAAAAfc/vOezYkRBUB4/shadow_thumb.gif?imgmax=800&quot; width=&quot;244&quot; height=&quot;244&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;and the output you will get is&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;a href=&quot;http://lh6.ggpht.com/_-7eTu68KmOU/TZVcTjBKoJI/AAAAAAAAAfo/U8JzXeK9K3s/s1600-h/output%5B5%5D.png&quot;&gt;&lt;img style=&quot;background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px&quot; title=&quot;output&quot; border=&quot;0&quot; alt=&quot;output&quot; src=&quot;http://lh3.ggpht.com/_-7eTu68KmOU/TZVcUceI19I/AAAAAAAAAfs/Gr24OnNDf4o/output_thumb%5B1%5D.png?imgmax=800&quot; width=&quot;235&quot; height=&quot;244&quot;&gt;&lt;/a&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;All the Best&lt;/p&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/04/apply-frame-to-image-with-css.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh5.ggpht.com/_-7eTu68KmOU/TZVb09Q4-cI/AAAAAAAAAfc/vOezYkRBUB4/s72-c/shadow_thumb.gif?imgmax=800" height="72" width="72"/><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-6469359829051692892</guid><pubDate>Mon, 07 Mar 2011 11:40:00 +0000</pubDate><atom:updated>2011-04-01T10:44:53.664+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.net</category><category domain="http://www.blogger.com/atom/ns#">IIS</category><category domain="http://www.blogger.com/atom/ns#">Web Service</category><title>Publish webservice locally without separate hosting</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hi..&lt;br /&gt;&lt;br /&gt;here is a way to deploy web service withing project...&lt;br /&gt;Here are the steps for it&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;in your Project... right click on Project in Solution Explorer.&lt;br /&gt;&lt;div style=&quot;text-align: left;&quot;&gt;Click on Add new Item and Select &quot;Web Service&quot;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-aufx1MyU7ls/TXTPrtkAe9I/AAAAAAAAAeU/WOuStPoe97A/s1600/Add+Service.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;384&quot; src=&quot;https://lh3.googleusercontent.com/-aufx1MyU7ls/TXTPrtkAe9I/AAAAAAAAAeU/WOuStPoe97A/s640/Add+Service.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;Name it as per required... and Click on &quot;Add&quot; Button...&lt;br /&gt;&lt;br /&gt;now you have your web service ready in local environment...&lt;br /&gt;&lt;br /&gt;put you code in Web Service .Cs file&lt;br /&gt;&lt;br /&gt;Build the Source and make sure its error free...&lt;br /&gt;&lt;br /&gt;now Deployment Part&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Right click on &quot;References&quot; in Solution Exporer,&lt;br /&gt;&lt;br /&gt;You will find.. three Options like&lt;br /&gt;&lt;br /&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add Reference&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add Web Reference&lt;/li&gt;&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Add Service Reference&lt;/li&gt;&lt;/ul&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh4.googleusercontent.com/-5neL8ZEYdo0/TXTQHiQVk_I/AAAAAAAAAeY/uoGCrQNANWI/s1600/Reference.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://lh4.googleusercontent.com/-5neL8ZEYdo0/TXTQHiQVk_I/AAAAAAAAAeY/uoGCrQNANWI/s1600/Reference.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Select &quot;Add Web Reference&quot;,&lt;br /&gt;&lt;br /&gt;you will get a Pop up,&lt;br /&gt;&lt;br /&gt;in Below there are three links&lt;br /&gt;Browse to:&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Web services in this solution&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Web services on the local machine&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; * Browse UDDI Servers on the local network&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh4.googleusercontent.com/-TQebbPAno1A/TXTQdzSwKVI/AAAAAAAAAec/XktlPnyoD6I/s1600/Reference.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;https://lh4.googleusercontent.com/-TQebbPAno1A/TXTQdzSwKVI/AAAAAAAAAec/XktlPnyoD6I/s320/Reference.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;select &quot;Web services on the local machine &quot;&lt;br /&gt;&lt;br /&gt;You will get a list of Web Services existsing on your local machine&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-nOI0ceUW4oQ/TXTRnTIJ3XI/AAAAAAAAAeg/SFZKbzLNw8k/s1600/Rfe.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;https://lh3.googleusercontent.com/-nOI0ceUW4oQ/TXTRnTIJ3XI/AAAAAAAAAeg/SFZKbzLNw8k/s320/Rfe.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;select which one you created in current Project&lt;br /&gt;&lt;br /&gt;it will be something like&lt;br /&gt;&lt;br /&gt;http://localhost/TempProject/WebService1.asmx&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh4.googleusercontent.com/-rv66Z3jWH5k/TXTSD6i4psI/AAAAAAAAAek/9n-9KmmrmOs/s1600/Methods.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;https://lh4.googleusercontent.com/-rv66Z3jWH5k/TXTSD6i4psI/AAAAAAAAAek/9n-9KmmrmOs/s320/Methods.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;now you will get a list of your methods of the web Service..&lt;br /&gt;&lt;br /&gt;if till here everything is fine... that means you are going right....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Congratulations&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;At right side, in Web Reference Name if wish change the name , that name will be the Service name..&lt;br /&gt;&lt;br /&gt;now click on &quot;Add Reference&quot;&lt;br /&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/-heQYJzMttck/TXTTOA3KlkI/AAAAAAAAAeo/xTM9_Hi5JB0/s1600/ServiceName.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;222&quot; src=&quot;https://lh3.googleusercontent.com/-heQYJzMttck/TXTTOA3KlkI/AAAAAAAAAeo/xTM9_Hi5JB0/s320/ServiceName.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;now in your project you are able to run your service within your IIS.. without any external Deployment&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh4.googleusercontent.com/-c6Z_FAp_oRQ/TXTUN2j40qI/AAAAAAAAAes/vaL0uIosm-g/s1600/Access+Service.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;73&quot; src=&quot;https://lh4.googleusercontent.com/-c6Z_FAp_oRQ/TXTUN2j40qI/AAAAAAAAAes/vaL0uIosm-g/s400/Access+Service.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Now whenever you update the Source of Service class... before building the source one update the Service Reference by right click on Service in &lt;b&gt;Web reference Folder&lt;/b&gt; in solution explorer..&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;To change url of your Service...&lt;br /&gt;&lt;ol style=&quot;text-align: left;&quot;&gt;&lt;li&gt; Remove Url Value from Settings.&lt;/li&gt;&lt;/ol&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Steps&lt;/li&gt;&lt;/ul&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh4.googleusercontent.com/-3etn-EQkacA/TXTW00-Y2UI/AAAAAAAAAew/TvyuiP0tdgo/s1600/Settings+Path.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;56&quot; src=&quot;https://lh4.googleusercontent.com/-3etn-EQkacA/TXTW00-Y2UI/AAAAAAAAAew/TvyuiP0tdgo/s400/Settings+Path.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;In Solution Explorer, In &lt;b&gt;Properties Folder&lt;/b&gt;, double click on &lt;b&gt;Settings.settings&lt;/b&gt; file&lt;/li&gt;&lt;li&gt;remove the path.&lt;/li&gt;&lt;li&gt;Now in Web.Config file set your Server path Instead of &lt;b&gt;localhost&lt;/b&gt;&lt;/li&gt;&lt;li&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://lh3.googleusercontent.com/--QLRImQEOJg/TXTXVpKMH7I/AAAAAAAAAe0/-Ld7qcn7FkM/s1600/WebConfigPath.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;75&quot; src=&quot;https://lh3.googleusercontent.com/--QLRImQEOJg/TXTXVpKMH7I/AAAAAAAAAe0/-Ld7qcn7FkM/s400/WebConfigPath.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;Now world is yours...&lt;br /&gt;&lt;br /&gt;All The Best&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2011/03/publish-webservice-locally-without-iis.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://lh3.googleusercontent.com/-aufx1MyU7ls/TXTPrtkAe9I/AAAAAAAAAeU/WOuStPoe97A/s72-c/Add+Service.png" height="72" width="72"/><thr:total>3</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7154778798162920917</guid><pubDate>Sun, 17 Oct 2010 20:02:00 +0000</pubDate><atom:updated>2013-12-09T14:51:20.476+05:30</atom:updated><category domain="http://www.blogger.com/atom/ns#">CSS</category><category domain="http://www.blogger.com/atom/ns#">GridView</category><category domain="http://www.blogger.com/atom/ns#">Javascript</category><title>Select Multiple Checkbox with Shift key in Gridview by javascript</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;Hello Friends,&lt;br /&gt;Recently i was just looking at my Gridview where i have a checkbox in each row.. now i need to select all Check box.. for that lots of material is available on net..&lt;br /&gt;and all are enough so i am not going to deep in it&lt;br /&gt;check out this… &lt;a href=&quot;http://www.codeproject.com/KB/grid/GridCheckBox.aspx&quot; title=&quot;http://www.codeproject.com/KB/grid/GridCheckBox.aspx&quot;&gt;http://www.codeproject.com/KB/grid/GridCheckBox.aspx&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;but now my problem was that i wanted to select few rows but not all &lt;br /&gt;let’s say in my gridview the number of records are around 100.. and i want to check the checkbox of first 35 records&lt;br /&gt;in that case i had to click on checkbox of all 35 rows. &lt;br /&gt;i thought, like all mail accounts like gmail, yahoo, live and in may more…&lt;br /&gt;i should be able to select multiple records by shift key.&lt;br /&gt;means select the first record and pressing shift key select the 35st record so all the records in between will be selected..&lt;br /&gt;and for that i found lots of jquery or any other javascripts.&lt;br /&gt;but here i have tried to make something my own and i am happy to make it..&lt;br /&gt;&lt;a href=&quot;http://lh5.ggpht.com/_-7eTu68KmOU/TLtWWpPfv7I/AAAAAAAAAdI/c4YV92Vz2n0/s1600-h/First%20With%20Shift%5B2%5D.jpg&quot;&gt;&lt;img alt=&quot;First With Shift&quot; border=&quot;0&quot; height=&quot;244&quot; src=&quot;http://lh3.ggpht.com/_-7eTu68KmOU/TLtWYYDOGsI/AAAAAAAAAdM/F2xSRqP3mzA/First%20With%20Shift_thumb.jpg?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;First With Shift&quot; width=&quot;81&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://lh4.ggpht.com/_-7eTu68KmOU/TLtWarRikhI/AAAAAAAAAdQ/0HEbGObq-pQ/s1600-h/Secod%20with%20Shift%5B2%5D.jpg&quot;&gt;&lt;img alt=&quot;Secod with Shift&quot; border=&quot;0&quot; height=&quot;244&quot; src=&quot;http://lh4.ggpht.com/_-7eTu68KmOU/TLtWcrLS6VI/AAAAAAAAAdU/i-5ST2j5VFw/Secod%20with%20Shift_thumb.jpg?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;Secod with Shift&quot; width=&quot;100&quot; /&gt;&lt;/a&gt; &lt;a href=&quot;http://lh4.ggpht.com/_-7eTu68KmOU/TLtWefz3xMI/AAAAAAAAAdY/YchtvQfi3Zk/s1600-h/Selected%20with%20shift%5B2%5D.jpg&quot;&gt;&lt;img alt=&quot;Selected with shift&quot; border=&quot;0&quot; height=&quot;244&quot; src=&quot;http://lh6.ggpht.com/_-7eTu68KmOU/TLtWgNU6bjI/AAAAAAAAAdc/4O1JA5n6vv4/Selected%20with%20shift_thumb.jpg?imgmax=800&quot; style=&quot;border-width: 0px; display: inline;&quot; title=&quot;Selected with shift&quot; width=&quot;89&quot; /&gt;&lt;/a&gt;&lt;br /&gt;here is code &lt;br /&gt;&lt;br /&gt;on Page&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: xhtml&quot;&gt;&amp;lt;asp:GridView ID=&amp;quot;GridView1&amp;quot; runat=&amp;quot;server&amp;quot; AutoGenerateColumns=&amp;quot;False&amp;quot;&amp;gt;&lt;br /&gt;        &amp;lt;Columns&amp;gt;&lt;br /&gt;            &amp;lt;asp:BoundField DataField=&amp;quot;ID&amp;quot; HeaderText=&amp;quot;Id&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;asp:BoundField DataField=&amp;quot;Name&amp;quot; HeaderText=&amp;quot;Name&amp;quot; /&amp;gt;&lt;br /&gt;            &amp;lt;asp:TemplateField&amp;gt;&lt;br /&gt;                &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                    &amp;lt;asp:CheckBox ID=&amp;quot;CheckBox1&amp;quot; &lt;br /&gt;&lt;br /&gt;onclick=&amp;quot;CheckAllCheckbox(document.getElementById(&#39;ctl00_ContentPlaceHolder1_GridView1&#39;),this,event);&amp;quot;&lt;br /&gt;                        runat=&amp;quot;server&amp;quot; /&amp;gt;&lt;br /&gt;                &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;            &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;        &amp;lt;/Columns&amp;gt;&lt;br /&gt;    &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;on code Behind&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;brush: c#&quot;&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;   {&lt;br /&gt;       if (!IsPostBack)&lt;br /&gt;       {&lt;br /&gt;           DataTable dt = new DataTable();&lt;br /&gt;           dt.Columns.Add(&quot;ID&quot;);&lt;br /&gt;           dt.Columns.Add(&quot;Name&quot;);&lt;br /&gt;           DataRow dr;&lt;br /&gt;           for (int i = 1; i &lt; 130; i++)&lt;br /&gt;           {&lt;br /&gt;               dr = dt.NewRow();&lt;br /&gt;               dr[&quot;ID&quot;] = i;&lt;br /&gt;               dr[&quot;Name&quot;] = &quot;Record No&quot; + i.ToString();&lt;br /&gt;               dt.Rows.Add(dr);&lt;br /&gt;           }&lt;br /&gt;           GridView1.DataSource = dt;&lt;br /&gt;           GridView1.DataBind();&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;Javascript &lt;pre class=&quot;brush: js&quot;&gt;var lst = null;&lt;br /&gt;        function CheckAllCheckbox(ctrl, sValue, e) {&lt;br /&gt;            var chkName = sValue.id;&lt;br /&gt;            var arlstr = sValue.id.split(ctrl.id);&lt;br /&gt;            var id = arlstr[1].split(&#39;_&#39;)[1].substring(3);&lt;br /&gt;&lt;br /&gt;            var ee = (window.event) ? event : e;&lt;br /&gt;            if (ee.shiftKey) {&lt;br /&gt;                if (lst != null) {&lt;br /&gt;                    var First = 0, last = 0;&lt;br /&gt;                    if (parseInt(lst) &gt; parseInt(id)) {&lt;br /&gt;                        First = parseInt(id);&lt;br /&gt;                        last = parseInt(lst);&lt;br /&gt;                    }&lt;br /&gt;                    else {&lt;br /&gt;                        First = parseInt(lst);&lt;br /&gt;                        last = parseInt(id);&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    for (i = First; i &lt; last; i++) {                        &lt;br /&gt;                        var p = (i &lt;= 9 ? &#39;0&#39; + i : i);&lt;br /&gt;                        var ctrlnew = chkName.replace(&#39;ctl&#39; + id, &#39;ctl&#39; + p);                        &lt;br /&gt;                        document.getElementById(ctrlnew).checked = sValue.checked;&lt;br /&gt;                    }                    &lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            lst = id;&lt;br /&gt;        }&lt;br /&gt;&lt;/pre&gt;Here is the Source to Download    &lt;a href=&quot;http://cid-552998535cb9985d.office.live.com/self.aspx/.Public/SelectWithShift.rar&quot; title=&quot;http://cid-552998535cb9985d.office.live.com/self.aspx/.Public/SelectWithShift.rar&quot;&gt;http://cid-552998535cb9985d.office.live.com/self.aspx/.Public/SelectWithShift.rar&lt;/a&gt;  Thanks&lt;/div&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2010/10/select-multiple-checkbox-with-shift-key.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_-7eTu68KmOU/TLtWYYDOGsI/AAAAAAAAAdM/F2xSRqP3mzA/s72-c/First%20With%20Shift_thumb.jpg?imgmax=800" height="72" width="72"/><thr:total>2</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1113941468315876880.post-7171851102403313237</guid><pubDate>Fri, 03 Sep 2010 19:58:00 +0000</pubDate><atom:updated>2010-09-04T01:30:15.926+05:30</atom:updated><title>Epic Browser</title><description>&lt;p&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;&lt;strong&gt;Background of Epic&lt;/strong&gt;&lt;/font&gt;&lt;/p&gt;&lt;div class=&quot;data&quot;&gt;  &lt;p style=&quot;margin: 20px 10px;&quot;&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt; The Epic Browser is the first-ever web browser for India and the first product from the software company &lt;a href=&quot;http://www.hiddenreflex.com/&quot;&gt;Hidden Reflex.&lt;/a&gt;&lt;/font&gt;  &lt;/p&gt;  &lt;p style=&quot;margin: 20px 10px;&quot;&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Hidden Reflex is a software product startup founded by Alok Bhardwaj in 2007 and based in Bangalore. Alok, who was raised in the U.S., was inspired by the success of open source software and web 2.0 innovations. Hidden Reflex began as a team of three but soon progressed and now has dedicated teams working on two products simultaneously – the Epic Browser and NewsDrink. The company also has three patents pending related to its product innovations.&lt;/font&gt;  &lt;/p&gt;  &lt;p style=&quot;margin: 20px 10px;&quot;&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;The company’s vision is to become the first globally recognized, consumer-oriented software product company in India. According to Alok Bhardwaj, CEO and Founder of Hidden Reflex, “We want to prove that India can be a hub for innovation in software and technology.&quot;&lt;/font&gt;  &lt;/p&gt;  &lt;p style=&quot;margin: 20px 10px;&quot;&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Our mission with the Epic browser is to create the most secure, most productive and most “Indian” browsing experience of any web browser!&lt;/font&gt;  &lt;/p&gt;  &lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt; &lt;font size=&quot;3&quot;&gt;  &lt;br /&gt;&lt;/font&gt;&lt;/div&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;&lt;strong&gt;What Someone might need in a browser..&lt;/strong&gt;&lt;/font&gt;&lt;ul&gt;  &lt;li&gt; &lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;help to blog&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;news search&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;store personal data&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;upload data directly from browser that of our Hard Drive&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;multiple language&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;attractive theaming/background&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;faster   &lt;br /&gt;&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Various Social Networking sites updates&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Mails updates&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Antivirus&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Online News Channel&lt;/font&gt;&lt;/li&gt;  &lt;li&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;and lot more&lt;/font&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;all this available in a single 9MB application that is &lt;a title=&quot;Epic Browser&quot; target=&quot;_blank&quot; href=&quot;http://www.epicbrowser.com/&quot;&gt;&lt;strong&gt;Epic Browser&lt;/strong&gt;&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;p&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;&lt;strong&gt;&amp;nbsp;Interface&lt;/strong&gt;  &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;Please refer this page for mindblowing Interface &lt;a title=&quot;Epic Interface&quot; href=&quot;http://www.epicbrowser.com/press.html&quot;&gt;http://www.epicbrowser.com/press.html&lt;/a&gt;&lt;/font&gt;&lt;/p&gt;&lt;hr width=&quot;100%&quot; size=&quot;2&quot; /&gt;&lt;p&gt;&lt;font size=&quot;3&quot;&gt;Every one must try Once... &lt;/font&gt;&lt;/p&gt;&lt;p&gt; &lt;font size=&quot;3&quot;&gt;  &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;p&gt;&lt;font size=&quot;3&quot;&gt;&amp;nbsp; &lt;/font&gt;&lt;/p&gt;&lt;font face=&quot;times new roman,times,serif&quot; size=&quot;3&quot;&gt;&lt;br /&gt;&lt;/font&gt;&lt;div class=&quot;blogger-post-footer&quot;&gt;Sandeep Prajapati - Microsoft Technology Practice&lt;/div&gt;</description><link>http://blog.sandeepprajapati.in/2010/09/epic-browser.html</link><author>noreply@blogger.com (Sandeep Prajapati)</author><thr:total>0</thr:total><gd:extendedProperty name="commentSource" value="1"/><gd:extendedProperty name="commentModerationMode" value="FILTERED_POSTMOD"/></item></channel></rss>