<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" gd:etag="W/&quot;A0QCSHk-eCp7ImA9WhRRFE4.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662</id><updated>2011-11-27T16:16:09.750-08:00</updated><category term="Position" /><category term="Delegate" /><category term="StyleSheet" /><category term="Javascript" /><category term="Asp.Net" /><category term="Cookie" /><category term="SQL Server" /><category term="Paging" /><category term="Resize Image" /><category term="C#" /><category term="Remoting" /><category term="Encrypt Decrypt" /><category term="Datarow" /><category term="Trim" /><category term="Dataset" /><category term="Default Button" /><category term="Ration" /><category term="Questions" /><category term="Index" /><category term="Technique" /><category term="Validation" /><category term="Function" /><category term="Authentication" /><category term="Cursor" /><category term="Enum" /><category term="Regular Expression" /><category term="Event" /><category term="Excel" /><category term=".Net Framework" /><title>Abhishek Joshi</title><subtitle type="html">A new way to learn programming. All the way.</subtitle><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://abhimjoshi.blogspot.com/" /><link rel="next" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default?start-index=26&amp;max-results=25&amp;redirect=false&amp;v=2" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>45</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/atom+xml" href="http://feeds.feedburner.com/AbhishekJoshi" /><feedburner:info uri="abhishekjoshi" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><entry gd:etag="W/&quot;C0MGSX8yeCp7ImA9WxJUFE8.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-6895378002390023106</id><published>2008-11-18T09:54:00.000-08:00</published><updated>2009-07-12T10:57:08.190-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2009-07-12T10:57:08.190-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server" /><title>PadLeft and PadRight SQL Functions</title><content type="html">&lt;pre class="code" style="font-family: trebuchet ms"&gt;&lt;span style="font-size: 100%"&gt;&lt;span style="font-weight: bold"&gt;PadLeft Function&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;=================&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FUNCTION&lt;/span&gt; dbo.PadLeft&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;(@String &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100), --&lt;span style="color: #0000ff"&gt;Input&lt;/span&gt; string &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; be padded&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt; @Length &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;, --Length &lt;span style="color: #0000ff"&gt;of&lt;/span&gt; final string&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt; @PadChar &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;(1) --Padding &lt;span style="color: #0000ff"&gt;character&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;RETURNS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;WHILE&lt;/span&gt; LEN(@String + &lt;span style="color: #006080"&gt;'z'&lt;/span&gt;) &amp;lt;= @Length &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; @String = @PadChar + @String&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt; @String&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;GO&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" style="font-family: trebuchet ms"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: 130%"&gt;&lt;span style="font-weight: bold"&gt;PadRight Function&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;=====================&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div id="codeSnippetWrapper"&gt;&lt;br /&gt;  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;CREATE&lt;/span&gt; &lt;span style="color: #0000ff"&gt;FUNCTION&lt;/span&gt; dbo.PadRight&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;(@String &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100), --&lt;span style="color: #0000ff"&gt;Input&lt;/span&gt; string &lt;span style="color: #0000ff"&gt;to&lt;/span&gt; be padded&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt; @Length &lt;span style="color: #0000ff"&gt;int&lt;/span&gt;,          --Length &lt;span style="color: #0000ff"&gt;of&lt;/span&gt; final string&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt; @PadChar &lt;span style="color: #0000ff"&gt;char&lt;/span&gt;(1)      --Padding &lt;span style="color: #0000ff"&gt;character&lt;/span&gt;)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;RETURNS&lt;/span&gt; &lt;span style="color: #0000ff"&gt;varchar&lt;/span&gt;(100)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;AS&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;BEGIN&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;    &lt;span style="color: #0000ff"&gt;WHILE&lt;/span&gt; LEN(@String + &lt;span style="color: #006080"&gt;'z'&lt;/span&gt;) &amp;lt;= @Length &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;        &lt;span style="color: #0000ff"&gt;SET&lt;/span&gt; @String = @String + @PadChar&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;RETURN&lt;/span&gt; @String&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span style="color: #0000ff"&gt;END&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class="code" style="font-family: trebuchet ms"&gt;&lt;br /&gt;&lt;br /&gt;Hope you will like it !!&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-6895378002390023106?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/6895378002390023106/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=6895378002390023106" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6895378002390023106?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6895378002390023106?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/egEjvlQJHXA/padleft-and-padright-sql-functions.html" title="PadLeft and PadRight SQL Functions" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/11/padleft-and-padright-sql-functions.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEcAQ344eip7ImA9WxRTEks.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-8352851908988804078</id><published>2008-09-01T03:42:00.000-07:00</published><updated>2008-09-01T03:47:22.032-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-09-01T03:47:22.032-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Store and retrieve file with SQL Server</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;// Store file in SQL Server&lt;br /&gt;&lt;br /&gt;FileStream objFileStream = new FileStream("[Path of File]", FileMode.Open);&lt;br /&gt;           byte[] Data = new byte[objFileStream.Length];&lt;br /&gt;           objFileStream.Read(Data, 0, Convert.ToInt32(objFileStream.Length));&lt;br /&gt;&lt;br /&gt;           SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["My"].ToString());&lt;br /&gt;           objConnection.Open();&lt;br /&gt;           SqlCommand objCommand = new SqlCommand("Bytes_Insert");&lt;br /&gt;           objCommand.Connection = objConnection;&lt;br /&gt;           objCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;           objCommand.Parameters.Add(new SqlParameter("@Data", Data));&lt;br /&gt;           objCommand.ExecuteNonQuery();&lt;br /&gt;           objConnection.Close();&lt;br /&gt;           objFileStream.Close();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Retrieve file from SQL Server&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;SqlConnection objConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["My"].ToString());&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            objConnection.Open();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            SqlCommand objCommand = new SqlCommand("Bytes_ListAll");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            objCommand.Connection = objConnection;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            objCommand.CommandType = CommandType.StoredProcedure;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            SqlDataAdapter adpt = new SqlDataAdapter(objCommand);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            DataSet ds = new DataSet();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            adpt.Fill(ds);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            byte[] Data = (byte[]) ds.Tables[0].Rows[0]["Data"];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            File.WriteAllBytes("[Path to store File]", Data);&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-8352851908988804078?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/8352851908988804078/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=8352851908988804078" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8352851908988804078?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8352851908988804078?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/hIXLDQqP00c/store-and-retrieve-file-with-sql-server.html" title="Store and retrieve file with SQL Server" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/09/store-and-retrieve-file-with-sql-server.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UCQX8yfyp7ImA9WxdUFUQ.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2818241785865643333</id><published>2008-08-01T06:59:00.000-07:00</published><updated>2008-08-01T07:01:00.197-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-08-01T07:01:00.197-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><title>Read Excel file in Asp.Net</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;Read Excel file with Excel object&lt;br /&gt;==================================&lt;br /&gt;&lt;br /&gt;using Microsoft.Office.Interop.Excel;&lt;br /&gt;&lt;br /&gt;private Excel.Application ExcelObj = null;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Create Object with File path&lt;br /&gt; Microsoft.Office.Interop.Excel.Workbook theWorkbook = ExcelObj.Workbooks.Open((Server.MapPath("..//Data") + "\\"&lt;br /&gt;                + fu.FileName), 0, true, 5, "", "", true, Microsoft.Office.Interop.Excel.XlPlatform.xlWindows, "\t", false, false, 0, true, true, true);&lt;br /&gt;&lt;br /&gt;            // get the collection of sheets in the workbook&lt;br /&gt;            Microsoft.Office.Interop.Excel.Sheets sheets = theWorkbook.Worksheets;&lt;br /&gt;&lt;br /&gt;            // get the first and only worksheet from the collection of worksheets&lt;br /&gt;            Microsoft.Office.Interop.Excel.Worksheet worksheet = (Microsoft.Office.Interop.Excel.Worksheet)sheets.get_Item(1);&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;            // Loop through total row count       &lt;br /&gt;            for (int i = 0; i &lt; worksheet.Rows.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                // Get value from ranges.&lt;br /&gt;                Microsoft.Office.Interop.Excel.Range range = worksheet.get_Range("A" + i.ToString(), "B" + i.ToString());&lt;br /&gt;&lt;br /&gt;                // In Array, You will get the cell value&lt;br /&gt;                System.Array myvalues = (System.Array)range.Cells.Value2;&lt;br /&gt;&lt;br /&gt;                // By Row, Column&lt;br /&gt;                string Value1 = myvalues.GetValue(1, 1) != null ? myvalues.GetValue(1, 1).ToString() : string.Empty;&lt;br /&gt;                string Value2 = myvalues.GetValue(1, 2) != null ? myvalues.GetValue(1, 2).ToString() : string.Empty;&lt;br /&gt;              &lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Read Excel File with out Excel Object&lt;br /&gt;=====================================&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;            string strConn;&lt;br /&gt;            strConn = "Provider=Microsoft.Jet.OLEDB.4.0;" +&lt;br /&gt;            "Data Source=" + Server.MapPath("&lt;excel&gt;") + ";" +&lt;br /&gt;            "Extended Properties=Excel 8.0;";&lt;br /&gt;            OleDbConnection con = new OleDbConnection(strConn);&lt;br /&gt;            con.Open();&lt;br /&gt;            if (con.State == ConnectionState.Open)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                OleDbDataAdapter adp = new OleDbDataAdapter("Select * From [test$A1:D65536]", con);&lt;br /&gt;                DataSet dsXLS = new DataSet();&lt;br /&gt;                adp.Fill(dsXLS);&lt;br /&gt;            }&lt;br /&gt;            con.Close()&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2818241785865643333?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2818241785865643333/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2818241785865643333" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2818241785865643333?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2818241785865643333?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/dF6s_Qogfm0/read-excel-file-in-aspnet.html" title="Read Excel file in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/08/read-excel-file-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DE4GQ30_eyp7ImA9WxdQEko.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-5429313742594572056</id><published>2008-06-12T06:21:00.000-07:00</published><updated>2008-06-12T06:22:02.343-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-06-12T06:22:02.343-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Excel" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Create and Export-Import Excel file in Asp.Net</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Create and Export-Import Excel file in Asp.Net&lt;br /&gt;=======================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;// This method create an Excel file and export it for download&lt;br /&gt;private void CreateExcelFileandDownload()&lt;br /&gt;{&lt;br /&gt;       &lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            // Create a new Excel file.&lt;br /&gt;&lt;br /&gt;            string[] connectStrings = new string[] {&lt;br /&gt;"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\TEMP\\TestExcel2003Output.xls\";Extended Properties=\"Excel 8.0;HDR=Yes;\";",&lt;br /&gt;"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=\"C:\\TEMP\\TestExcel2007Output.xlsx\";Extended Properties=\"Excel 12.0 Xml;HDR=Yes;\";"&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;            string dropTableStmt = "DROP TABLE [test]";&lt;br /&gt;            string createTableStmt = "CREATE TABLE [test] ( [Integer] int, [String] varchar(40), [Double] float, [Date] datetime, [Boolean] bit )";&lt;br /&gt;            string insertStmt = "INSERT INTO [test] ([Integer], [String], [Double], [Date], [Boolean]) VALUES ({0}, '{1}', {2}, '{3}', {4})";&lt;br /&gt;            object[] data = new object[] {&lt;br /&gt;&lt;br /&gt;new object[] { 2628013, "Anderson", 0.617715356, new DateTime( 2008, 5, 5 ), true },&lt;br /&gt;&lt;br /&gt;new object[] { 2628015, "Rainaud", 0.64933168, new DateTime( 2007, 4, 10 ), false },&lt;br /&gt;&lt;br /&gt;new object[] { 2628017, "Dennis", 0.62140731, new DateTime( 2006, 3, 15 ), true },&lt;br /&gt;&lt;br /&gt;new object[] { 2628019, "Schoenster", 0.599058708, new DateTime( 2005, 2, 20 ), false },&lt;br /&gt;&lt;br /&gt;new object[] { 2628041, "Ganun", 0.593402527, new DateTime( 2004, 1, 25 ), true }&lt;br /&gt;&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;            foreach (string connect in connectStrings)&lt;br /&gt;            {&lt;br /&gt;                OleDbConnection con = new OleDbConnection(connect);&lt;br /&gt;                con.Open();&lt;br /&gt;                if (con.State == ConnectionState.Open)&lt;br /&gt;                {&lt;br /&gt;                    OleDbCommand cmd = con.CreateCommand();&lt;br /&gt;                    cmd.CommandTimeout = 0;&lt;br /&gt;                    try&lt;br /&gt;                    {&lt;br /&gt;                        // Only need this on runs subsequent to first time&lt;br /&gt;                        cmd.CommandText = dropTableStmt;&lt;br /&gt;                        cmd.ExecuteNonQuery();&lt;br /&gt;                    }&lt;br /&gt;                    catch&lt;br /&gt;                    {&lt;br /&gt;                        // First run will cause exception because table (worksheet) doesn't exist&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    cmd.CommandText = createTableStmt;&lt;br /&gt;                    cmd.ExecuteNonQuery();&lt;br /&gt;                    foreach (object[] row in data)&lt;br /&gt;                    {&lt;br /&gt;                        cmd.CommandText = String.Format(insertStmt, row[0], row[1], row[2], row[3], row[4]);&lt;br /&gt;                        cmd.ExecuteNonQuery();&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    cmd.Dispose();&lt;br /&gt;                    if (con.State == ConnectionState.Open)&lt;br /&gt;                        con.Close();&lt;br /&gt;                    con.Dispose();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // Download Created File&lt;br /&gt;&lt;br /&gt;            // For Office 2007 format&lt;br /&gt;            string FileName  = @"C:\TEMP\TestExcel2007Output.xlsx";&lt;br /&gt;            // For Office 97 - 2003 format&lt;br /&gt;            string FileName2 = @"C:\TEMP\TestExcel2003Output.xls";&lt;br /&gt;&lt;br /&gt;            Response.Clear();&lt;br /&gt;            Response.ClearContent();&lt;br /&gt;            Response.ContentType = "application/vnd.xls";&lt;br /&gt;            Response.AddHeader("Content-Disposition", "attachment; filename=Name.xlsx;");&lt;br /&gt;&lt;br /&gt;            byte[] buffer = System.IO.File.ReadAllBytes(FileName);&lt;br /&gt;&lt;br /&gt;            System.IO.MemoryStream mem = new System.IO.MemoryStream();&lt;br /&gt;            mem.Write(buffer, 0, buffer.Length);&lt;br /&gt;&lt;br /&gt;            mem.WriteTo(Response.OutputStream);&lt;br /&gt;            Response.End();&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            // throw an exception&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-5429313742594572056?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/5429313742594572056/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=5429313742594572056" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/5429313742594572056?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/5429313742594572056?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/BITWiCt1viY/create-and-export-import-excel-file-in.html" title="Create and Export-Import Excel file in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/06/create-and-export-import-excel-file-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkUDRnY6cSp7ImA9WxdTEEs.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2342759960506009431</id><published>2008-05-06T01:50:00.000-07:00</published><updated>2008-05-06T01:57:57.819-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-05-06T01:57:57.819-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Paging" /><title>Use Custom paging for DataList, GridView in Asp.Net</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Use Custom paging for Datalist, GridView in Asp.Net&lt;br /&gt;=============================================&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suppose your HTML layout is like;&lt;/span&gt;&lt;br /&gt;------------------------------------------&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(102, 102, 0);"&gt;// Stylesheet&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;/* Start Pager 2 style */&lt;/span&gt;&lt;br /&gt;.Pager2 { border-collapse:collapse;}&lt;br /&gt;.Pager2 a { color:#0080C0; font-weight:bold; margin:1px; padding:2px 5px; border:1px solid white; text-decoration:none }&lt;br /&gt;.Pager2 a:hover { color:White; font-weight:bold; border:1px #0080C0 solid; background-color:#0080C0  }&lt;br /&gt;.Pager2     span { margin:1px; padding:2px 5px; background-color:#0080C0; color:White; border:1px #0080C0 solid}&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;/* End Pager 2 style */&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Page HTML layout&lt;/span&gt;&lt;br /&gt;&amp;lt;div&amp;gt;&lt;br /&gt;       Name : &amp;lt;asp:TextBox ID="txtName" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;  &amp;lt;asp:Button ID="btnGo" runat="server" Text="Go" OnClick="btnGo_Click" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;            &amp;lt;asp:DataList&lt;/span&gt; ID="dlCompanylist" RepeatColumns="1" RepeatDirection="Horizontal" runat="server"&amp;gt;&lt;br /&gt;           &amp;lt;ItemTemplate&lt;span style="font-weight: bold;"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;               &amp;lt;table width="200px" cellpadding="1" cellspacing="1" style="border-collapse:collapse"&amp;gt;&lt;br /&gt;                   &amp;lt;tr&amp;gt;&lt;br /&gt;                       &amp;lt;td valign="top" style="width:100px"&amp;gt;ID :&amp;lt;/td&amp;gt;&lt;br /&gt;                       &amp;lt;td&amp;gt;&amp;lt;%#Eval("ID").ToString() %&amp;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 valign="top" &amp;gt;Name&amp;lt;/td&amp;gt;&amp;lt;td&amp;gt;&amp;lt;%#Eval("Name").ToString() %&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 valign="top"&amp;gt;Date&amp;lt;/td&amp;gt;&lt;br /&gt;                       &amp;lt;td&amp;gt;&amp;lt;%#Eval("RegisterDate").ToString() %&amp;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 colspan="2" style="border-bottom:solid 1px gray"&amp;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;/ItemTemplate&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;            &amp;lt;/asp:DataList&amp;gt;&lt;/span&gt;&lt;br /&gt;       &amp;lt;br /&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;           &amp;lt;asp:Literal&lt;/span&gt; ID="ltPaging" runat="server"&amp;gt;&amp;lt;&lt;span style="font-weight: bold;"&gt;/asp:Literal&amp;gt;&lt;/span&gt;&lt;br /&gt;   &amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Javascript Method&lt;/span&gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;function next_prev_page(val)&lt;br /&gt;   {&lt;br /&gt; &lt;br /&gt;       location.href = "zzCustomPaging.aspx?page=" + val;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;   }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 102, 0);"&gt;// Code Behind Part&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;protected void Page_Load(object sender, EventArgs e)&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 0);"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;        if (!IsPostBack)&lt;br /&gt;       {&lt;br /&gt;           this.BindGrid();&lt;br /&gt;       }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void BindGrid()&lt;br /&gt;{&lt;br /&gt;   Company objCompany = new Company();&lt;br /&gt;&lt;br /&gt;   objCompany.name = txtName.Text.Trim();&lt;br /&gt;   objCompany.status = 3;&lt;br /&gt;   objCompany.SortBy = "Name";&lt;br /&gt;   objCompany.SortOrder = SortDirection.Ascending;&lt;br /&gt;   objCompany.PageNo = Request.QueryString["Page"] != null ? int.Parse(Request.QueryString["Page"].ToString()) - 1 : 0;&lt;br /&gt;   objCompany.PageSize = 5;&lt;br /&gt;&lt;br /&gt;   DataSet dsCompanyList = objCompany.GetCompanyRegisterListAll();&lt;br /&gt;&lt;br /&gt;   if (dsCompanyList != null &amp;amp;&amp;amp; dsCompanyList.Tables[0].Rows.Count &amp;gt; 0)&lt;br /&gt;   {&lt;br /&gt;       dlCompanylist.DataSource = dsCompanyList.Tables[0];&lt;br /&gt;       dlCompanylist.DataBind();&lt;br /&gt;&lt;br /&gt;       ltPaging.Text = this.Paging(objCompany.PageNo + 1, int.Parse(dsCompanyList.Tables[1].Rows[0][0].ToString()), objCompany.PageSize);&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private string Paging(int Page, int TotalRecords, int PageSize)&lt;br /&gt;{&lt;br /&gt;   int PageNo = 0;&lt;br /&gt;   string NextPage = "";&lt;br /&gt;   string PreviousPage = "";&lt;br /&gt;   string Print = "";&lt;br /&gt;   string Range = "";&lt;br /&gt;   string Pager = "";&lt;br /&gt;&lt;br /&gt;   int Start = 0;&lt;br /&gt;   int StartRange = 0;&lt;br /&gt;   int EndRange = 0;&lt;br /&gt;&lt;br /&gt;   if (TotalRecords &amp;gt; PageSize)&lt;br /&gt;   {&lt;br /&gt;       double RecordForPaging = Math.Ceiling((Convert.ToDouble(TotalRecords) / Convert.ToDouble(PageSize)));&lt;br /&gt;       double RecordPage, v;&lt;br /&gt;       int NewNo;&lt;br /&gt;&lt;br /&gt;       if (RecordForPaging &amp;gt; Math.Floor(RecordForPaging))&lt;br /&gt;       {&lt;br /&gt;           RecordPage = (Math.Floor(RecordForPaging)) + 1;&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;           RecordPage = RecordForPaging;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       if (RecordPage &amp;lt;= PageSize)&lt;br /&gt;           v = RecordPage;&lt;br /&gt;       else&lt;br /&gt;           v = 5;&lt;br /&gt;&lt;br /&gt;       if (Page != 1)&lt;br /&gt;           PreviousPage = "&amp;lt;div class='Pager2'&amp;gt;&amp;lt;a href=javascript:next_prev_page(" + (Page - 1) + ");&amp;gt;PREVIOUS&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;";&lt;br /&gt;       else&lt;br /&gt;           PreviousPage = "";&lt;br /&gt;&lt;br /&gt;       if (Page != RecordPage)&lt;br /&gt;           NextPage = "&amp;lt;div class='Pager2'&amp;gt;&amp;lt;a  href=javascript:next_prev_page(" + (Page + 1) + ");&amp;gt;NEXT&amp;lt;/a&amp;gt;&amp;lt;/div&amp;gt;";&lt;br /&gt;&lt;br /&gt;       Print = "";&lt;br /&gt;&lt;br /&gt;       if (Page == 1)&lt;br /&gt;       {&lt;br /&gt;           for (PageNo = 1; PageNo &amp;lt;= v; PageNo++)&lt;br /&gt;           {&lt;br /&gt;               if (RecordPage &amp;gt;= PageNo)&lt;br /&gt;               {&lt;br /&gt;                   if (PageNo == Page)&lt;br /&gt;                   {&lt;br /&gt;                       Print += " &amp;lt;b class='Pager2'&amp;gt;&amp;lt;span&amp;gt;" + PageNo + "&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;";&lt;br /&gt;                   }&lt;br /&gt;                   else&lt;br /&gt;                   {&lt;br /&gt;                       Print += "  &amp;lt;b class='Pager2'&amp;gt;&amp;lt;a  href=javascript:next_prev_page(" + PageNo + ");&amp;gt;" + PageNo + "&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt;";&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;       else if (Page &amp;lt;= RecordPage)&lt;br /&gt;       {&lt;br /&gt;           if (PageNo &amp;lt;= RecordPage)&lt;br /&gt;               NewNo = 2;&lt;br /&gt;           else&lt;br /&gt;               NewNo = Page - 5;&lt;br /&gt;&lt;br /&gt;           if (PageNo &amp;lt;= RecordPage)&lt;br /&gt;               NewNo = Page - 5;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;           for (PageNo = NewNo; PageNo &amp;lt;= Page + 5; PageNo++)&lt;br /&gt;           {&lt;br /&gt;               if (PageNo &amp;gt; 0)&lt;br /&gt;               {&lt;br /&gt;                   if (PageNo == Page)&lt;br /&gt;                       Print += " &amp;lt;b class='Pager2'&amp;gt;&amp;lt;span&amp;gt;" + PageNo + "&amp;lt;/span&amp;gt;&amp;lt;/b&amp;gt;";&lt;br /&gt;                   else&lt;br /&gt;                   {&lt;br /&gt;                       if (PageNo &amp;lt;= RecordPage)&lt;br /&gt;                           Print += " &amp;lt;b class='Pager2'&amp;gt;&amp;lt;a href=javascript:next_prev_page(" + PageNo + ");&amp;gt;" + PageNo + "&amp;lt;/a&amp;gt;&amp;lt;/b&amp;gt;";&lt;br /&gt;                   }&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       Start = (Page - 1) * PageSize;&lt;br /&gt;       StartRange = Start + 1;&lt;br /&gt;       EndRange = Start + PageSize;&lt;br /&gt;&lt;br /&gt;       if (EndRange &amp;gt;= TotalRecords)&lt;br /&gt;           EndRange = TotalRecords;        //end display&lt;br /&gt;       Range = StartRange + "-" + EndRange + " of " + TotalRecords;&lt;br /&gt;       Pager = "&amp;lt;table width='100%' border='0' style='border-collapse:collapse' &amp;gt;&amp;lt;tr&amp;gt;&amp;lt;TD ALIGN='right' width='20%'&amp;gt;&amp;lt;TABLE border='0'&amp;gt;&amp;lt;TR&amp;gt;";&lt;br /&gt;       Pager += "&amp;lt;td width='70px'&amp;gt;" + PreviousPage + "&amp;lt;/td&amp;gt;&amp;lt;td NOWRAP width='200px'&amp;gt; &amp;lt;div&amp;gt;" + Print + " &amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;td NOWRAP width='70px' align='left'&amp;gt;" + NextPage + "&amp;lt;/td&amp;gt;";&lt;br /&gt;       Pager += "&amp;lt;/TR&amp;gt;&amp;lt;/TABLE&amp;gt;&amp;lt;/TD&amp;gt;&amp;lt;td  WIDTH='80%' &amp;gt;&amp;lt;div align='left'&amp;gt;" + Range + "&amp;lt;/div&amp;gt;&amp;lt;/td&amp;gt;";&lt;br /&gt;       Pager += "&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;/table&amp;gt;";&lt;br /&gt;       return Pager;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   return string.Empty;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's It !&lt;br /&gt;Hope you will like it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2342759960506009431?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2342759960506009431/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2342759960506009431" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2342759960506009431?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2342759960506009431?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/CQvrzwkRklk/use-custom-paging-for-datalist-gridview.html" title="Use Custom paging for DataList, GridView in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/05/use-custom-paging-for-datalist-gridview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cNRnk5eip7ImA9WxZaGEQ.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-9166162400495049456</id><published>2008-05-02T03:46:00.000-07:00</published><updated>2008-05-04T04:04:57.722-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-05-04T04:04:57.722-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="StyleSheet" /><title>Use Dynamic stylesheet class for messages in Asp.Net</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;Hi,&lt;br /&gt;&lt;br /&gt;In the web application, some times we need to use a message style for&lt;br /&gt;only one Label, like, suppose if our data has been added successfully, we display&lt;br /&gt;message like 'Records has been added successfully'. So, depend on&lt;br /&gt;system's different situation, we have to display label message with style color&lt;br /&gt;combination.&lt;br /&gt;&lt;br /&gt;So, Here you can find the solution. By it, you can display your message&lt;br /&gt;with sytle as per your system's situation.&lt;br /&gt;&lt;br /&gt;Just copy and paste the style script and copy C# method in your page.&lt;br /&gt;&lt;br /&gt;You can find it here...&lt;br /&gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;&lt;br /&gt;.MessageSuccess&lt;br /&gt;{&lt;br /&gt;background: #EFF4EA url(images/icn_successful.gif) center no-repeat;&lt;br /&gt;background-position: 15px 5px; /* x-pos y-pos */&lt;br /&gt;font-weight:bold;&lt;br /&gt;text-align: left;&lt;br /&gt;padding: 5px 20px 5px 45px;&lt;br /&gt;border-top: 1px solid #1E8B18;&lt;br /&gt;border-bottom: 1px solid #1E8B18;&lt;br /&gt;color:#555555;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;.MessageInfo&lt;br /&gt;{&lt;br /&gt;background: #FFFFD2 url(images/icn_info.gif) center no-repeat;&lt;br /&gt;background-position: 15px 5px; /* x-pos y-pos */&lt;br /&gt;text-align: left;&lt;br /&gt;font-weight:bold;&lt;br /&gt;padding: 5px 20px 5px 45px;&lt;br /&gt;border-top: 1px solid #CACA00;&lt;br /&gt;border-bottom: 1px solid #CACA00;&lt;br /&gt;color:#555555;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;.MessageError&lt;br /&gt;{&lt;br /&gt;background: #FFEAEA url(images/icn_error.gif) center no-repeat;&lt;br /&gt;background-position: 15px 5px; /* x-pos y-pos */&lt;br /&gt;text-align: left;&lt;br /&gt;font-weight:bold;&lt;br /&gt;padding: 5px 20px 5px 45px;&lt;br /&gt;border-top: 1px solid #FF6F6F;&lt;br /&gt;border-bottom: 1px solid #FF6F6F;&lt;br /&gt;color:#555555;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;(Download these images for stylesheet)&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_U0UefTbnoMQ/SBrxj8oTCvI/AAAAAAAAAZA/8pYYO4otSWA/s1600-h/icn_error.gif"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_U0UefTbnoMQ/SBrxj8oTCvI/AAAAAAAAAZA/8pYYO4otSWA/s320/icn_error.gif" alt="" id="BLOGGER_PHOTO_ID_5195730719998151410" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_U0UefTbnoMQ/SBrxesoTCuI/AAAAAAAAAY4/yzcPoZEmB24/s1600-h/icn_info.gif"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_U0UefTbnoMQ/SBrxesoTCuI/AAAAAAAAAY4/yzcPoZEmB24/s320/icn_info.gif" alt="" id="BLOGGER_PHOTO_ID_5195730629803838178" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_U0UefTbnoMQ/SBrxVcoTCtI/AAAAAAAAAYw/ELMvO6FU-ww/s1600-h/icn_successful.gif"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_U0UefTbnoMQ/SBrxVcoTCtI/AAAAAAAAAYw/ELMvO6FU-ww/s320/icn_successful.gif" alt="" id="BLOGGER_PHOTO_ID_5195730470890048210" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;form id="form1" runat="server"&amp;gt;&lt;br /&gt;&amp;lt;asp:Label ID="lblMessage" runat="server" /&amp;gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;        lblMessage.Text = "Records has been Added Successfully.";&lt;br /&gt;        this.SetStyle(lblMessage, MessageType.Info);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void SetStyle(Label objLabel, MessageType msgType)&lt;br /&gt;{&lt;br /&gt;if (string.IsNullOrEmpty(objLabel.Text.Trim()))&lt;br /&gt;    objLabel.CssClass = "";&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;    switch (msgType)&lt;br /&gt;    {&lt;br /&gt;        case MessageType.Error:&lt;br /&gt;            objLabel.CssClass = "MessageError";&lt;br /&gt;            break;&lt;br /&gt;        case MessageType.Info:&lt;br /&gt;            objLabel.CssClass = "MessageInfo";&lt;br /&gt;            break;&lt;br /&gt;        case MessageType.Success:&lt;br /&gt;            objLabel.CssClass = "MessageSuccess";&lt;br /&gt;            break;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Define enum in the outer side of your page class.&lt;br /&gt;public enum MessageType&lt;br /&gt;{&lt;br /&gt;Success,&lt;br /&gt;Info,&lt;br /&gt;Error&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now, Run your page and check it.&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-9166162400495049456?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/9166162400495049456/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=9166162400495049456" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/9166162400495049456?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/9166162400495049456?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/yTVWNBCjvGE/use-dynamic-stylesheet-class-for.html" title="Use Dynamic stylesheet class for messages in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_U0UefTbnoMQ/SBrxj8oTCvI/AAAAAAAAAZA/8pYYO4otSWA/s72-c/icn_error.gif" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/05/use-dynamic-stylesheet-class-for.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEIFRn87eip7ImA9WxZbGEo.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-3278319133398398813</id><published>2008-04-22T06:53:00.000-07:00</published><updated>2008-04-22T06:55:17.102-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-22T06:55:17.102-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Remove HTML string - tag from specified string.</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Remove HTML string - tag from specified string.&lt;br /&gt;========================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;public static string RemoveHtml(string strSource)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        string pattern = @"&lt;(.|\n)*?&gt;";&lt;br /&gt;&lt;br /&gt;        strSource = Regex.Replace(strSource, pattern, string.Empty);&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;        return strSource;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;That's It !!&lt;br /&gt;Hope you will like it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-3278319133398398813?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/3278319133398398813/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=3278319133398398813" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3278319133398398813?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3278319133398398813?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/t_nv3y8e9wk/remove-html-string-tag-from-specified.html" title="Remove HTML string - tag from specified string." /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/04/remove-html-string-tag-from-specified.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CUAESXg4fCp7ImA9WxZbFUw.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-3146539038544970346</id><published>2008-04-18T03:13:00.000-07:00</published><updated>2008-04-18T03:15:08.634-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-18T03:15:08.634-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Validation" /><title>How to use Custom Validator in Asp.Net</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;How to use Custom Validator in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;---------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This is the HTML section of Custom Validator Control.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:CustomValidator ID="custVal" runat="Server" ValidationGroup="grpProductAdd"&lt;br /&gt;      Display="None" ErrorMessage="Please, Enter Product Amount." &lt;span style="font-weight: bold; font-style: italic;"&gt;ClientValidationFunction="CheckProduct"&lt;/span&gt;&amp;gt;&lt;br /&gt; &amp;lt;/asp:CustomValidator&amp;gt;&lt;br /&gt;&lt;br /&gt;We need a javascript function to use Custom Validation that return either 'true' or 'false' result.&lt;br /&gt;&lt;br /&gt; &amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt;        &lt;br /&gt;        // You must use this both parameter with your function, because by it Validator validate the result.&lt;br /&gt;        function CheckProduct(sender, args)&lt;br /&gt;        {&lt;br /&gt;        // This is the variable name by which we can identify true/false result.&lt;br /&gt;        var Check = 0;&lt;br /&gt;&lt;br /&gt;               &lt;br /&gt;                    var ProductVal = document.getElementById('txtProductVal').value;&lt;br /&gt;                    if (ProductVal = '')&lt;br /&gt;                    {&lt;br /&gt;                        Check = 0&lt;br /&gt;                    }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;            Check = 1&lt;br /&gt;            }&lt;br /&gt;              &lt;br /&gt;               &lt;br /&gt;        // If your condition become true&lt;br /&gt;                if (Check == '0' )&lt;br /&gt;                {&lt;br /&gt;                    args.IsValid = false;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    args.IsValid = true;&lt;br /&gt;                }&lt;br /&gt;    }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;That's It !&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-3146539038544970346?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/3146539038544970346/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=3146539038544970346" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3146539038544970346?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3146539038544970346?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/t8UoijnzfHk/how-to-use-custom-validator-in-aspnet.html" title="How to use Custom Validator in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/04/how-to-use-custom-validator-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEGRX8_cCp7ImA9WxZbFE8.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2627364523699535161</id><published>2008-04-17T01:52:00.000-07:00</published><updated>2008-04-17T01:57:04.148-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-17T01:57:04.148-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><title>Javascript to dynamically add styles and event to form Element.</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Javascript to dynamically add styles and event to form Element&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;=====================================================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&amp;lt;HTML&amp;gt;&lt;br /&gt;&amp;lt;HEAD&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;style type="text/css"&amp;gt;&lt;br /&gt;.OnFocus&lt;br /&gt;{&lt;br /&gt;   background-color : gray;&lt;br /&gt;}&lt;br /&gt;.OnBlur&lt;br /&gt;{&lt;br /&gt;   background-color : white;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/style&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt; &lt;br /&gt;   function SetStyle()&lt;br /&gt;   {&lt;br /&gt;       var elem = document.getElementById('frmMain').elements;&lt;br /&gt;&lt;br /&gt;       for(var i = 0; i &amp;lt; elem.length; i++)&lt;br /&gt;       {&lt;br /&gt;           // Assing style to each and every textbox on this page.&lt;br /&gt;           if (elem[i].type == "text")&lt;br /&gt;           {&lt;br /&gt;               elem[i].setAttribute("onfocus","this.className = 'OnFocus';");&lt;br /&gt;               elem[i].setAttribute("onblur","this.className = 'OnBlur';");&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;BODY &lt;span style="font-weight: bold; font-style: italic;"&gt;onload="javascript:SetStyle()"&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;form id="frmMain" &amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;input type="text" value="Hello 1" id="text1" /&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;   &amp;lt;input type="text" value="Hello 1" id="text2" /&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;   &amp;lt;input type="password" value="Hello 1" id="text1" /&amp;gt; &amp;lt;br/&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/form&amp;gt;&lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;That's It !&lt;br /&gt;Hope you will like it.&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2627364523699535161?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2627364523699535161/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2627364523699535161" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2627364523699535161?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2627364523699535161?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/9LISd0yhxAE/javascript-to-dynamically-add-styles.html" title="Javascript to dynamically add styles and event to form Element." /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/04/javascript-to-dynamically-add-styles.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkADRH48fip7ImA9WxZUGUU.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-173938678687670600</id><published>2008-04-11T23:10:00.000-07:00</published><updated>2008-04-11T23:12:55.076-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-04-11T23:12:55.076-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><category scheme="http://www.blogger.com/atom/ns#" term="Resize Image" /><title>How to create Image reflection in Asp.Net</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;How to create Image reflection in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;=======================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Method :&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;---------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;public Image DrawReflection(Image _Image, Color _BackgroundColor, int _Reflectivity)&lt;br /&gt;       {&lt;br /&gt;           // Calculate the size of the new image&lt;br /&gt;           int height = (int)(_Image.Height + (_Image.Height * ((float)_Reflectivity / 255)));&lt;br /&gt;           Bitmap newImage = new Bitmap(_Image.Width, height, PixelFormat.Format24bppRgb);&lt;br /&gt;           newImage.SetResolution(_Image.HorizontalResolution, _Image.VerticalResolution);&lt;br /&gt;&lt;br /&gt;           using (Graphics graphics = Graphics.FromImage(newImage))&lt;br /&gt;           {&lt;br /&gt;               // Initialize main graphics buffer&lt;br /&gt;               graphics.Clear(_BackgroundColor);&lt;br /&gt;               graphics.DrawImage(_Image, new Point(0, 0));&lt;br /&gt;               graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;&lt;br /&gt;               Rectangle destinationRectangle = new Rectangle(0, _Image.Size.Height, _Image.Size.Width, _Image.Size.Height);&lt;br /&gt;&lt;br /&gt;               // Prepare the reflected image&lt;br /&gt;               int reflectionHeight = (_Image.Height * _Reflectivity) / 255;&lt;br /&gt;               Image reflectedImage = new Bitmap(_Image.Width, reflectionHeight);&lt;br /&gt;&lt;br /&gt;               // Draw just the reflection on a second graphics buffer&lt;br /&gt;               using (Graphics gReflection = Graphics.FromImage(reflectedImage))&lt;br /&gt;               {&lt;br /&gt;                   gReflection.DrawImage(_Image, new Rectangle(0, 0, reflectedImage.Width, reflectedImage.Height),&lt;br /&gt;                   0, _Image.Height - reflectedImage.Height, reflectedImage.Width, reflectedImage.Height, GraphicsUnit.Pixel);&lt;br /&gt;               }&lt;br /&gt;               reflectedImage.RotateFlip(RotateFlipType.RotateNoneFlipY);&lt;br /&gt;               Rectangle imageRectangle = new Rectangle(destinationRectangle.X, destinationRectangle.Y,&lt;br /&gt;                   destinationRectangle.Width, (destinationRectangle.Height * _Reflectivity) / 255);&lt;br /&gt;&lt;br /&gt;               // Draw the image on the original graphics&lt;br /&gt;               graphics.DrawImage(reflectedImage, imageRectangle);&lt;br /&gt;&lt;br /&gt;               // Finish the reflection using a gradiend brush&lt;br /&gt;               LinearGradientBrush brush = new LinearGradientBrush(imageRectangle,&lt;br /&gt;                      Color.FromArgb(255 - _Reflectivity, _BackgroundColor),&lt;br /&gt;                       _BackgroundColor, 90, false);&lt;br /&gt;               graphics.FillRectangle(brush, imageRectangle);&lt;br /&gt;           }&lt;br /&gt;&lt;br /&gt;           return newImage;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How to Use It (Testing)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-----------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Response.ContentType = "image/jpeg";&lt;br /&gt;&lt;br /&gt;Image objImage = Image.FromFile(Server.MapPath("Image.jpg"));&lt;br /&gt;         &lt;br /&gt;Image objImage2 = this.DrawReflection(objImage, Color.White, 80);&lt;br /&gt;&lt;br /&gt;objImage2.Save(Response.OutputStream, ImageFormat.Jpeg);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-173938678687670600?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/173938678687670600/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=173938678687670600" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/173938678687670600?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/173938678687670600?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/Uh3fnlArHAg/how-to-create-image-reflaction-in.html" title="How to create Image reflection in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/04/how-to-create-image-reflaction-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkACRX4zcCp7ImA9WxZVFEk.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-7499714885394905253</id><published>2008-03-25T03:23:00.000-07:00</published><updated>2008-03-25T03:26:04.088-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-25T03:26:04.088-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="SQL Server" /><title>How to create Insert Script in SQL Server database</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;How to create Insert Script in SQL Server database&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;===========================================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;CREATE PROC sp_generate_inserts&lt;br /&gt;(&lt;br /&gt;    @table_name varchar(776),          -- The table/view for which the INSERT statements will be generated using the existing data&lt;br /&gt;    @target_table varchar(776) = NULL,     -- Use this parameter to specify a different table name into which the data will be inserted&lt;br /&gt;    @include_column_list bit = 1,        -- Use this parameter to include/ommit column list in the generated INSERT statement&lt;br /&gt;    @from varchar(800) = NULL,         -- Use this parameter to filter the rows based on a filter condition (using WHERE)&lt;br /&gt;    @include_timestamp bit = 0,         -- Specify 1 for this parameter, if you want to include the TIMESTAMP/ROWVERSION column's data in the INSERT statement&lt;br /&gt;    @debug_mode bit = 0,            -- If @debug_mode is set to 1, the SQL statements constructed by this procedure will be printed for later examination&lt;br /&gt;    @owner varchar(64) = NULL,        -- Use this parameter if you are not the owner of the table&lt;br /&gt;    @ommit_images bit = 0,            -- Use this parameter to generate INSERT statements by omitting the 'image' columns&lt;br /&gt;    @ommit_identity bit = 0,        -- Use this parameter to ommit the identity columns&lt;br /&gt;    @top int = NULL,            -- Use this parameter to generate INSERT statements only for the TOP n rows&lt;br /&gt;    @cols_to_include varchar(8000) = NULL,    -- List of columns to be included in the INSERT statement&lt;br /&gt;    @cols_to_exclude varchar(8000) = NULL,    -- List of columns to be excluded from the INSERT statement&lt;br /&gt;    @disable_constraints bit = 0,        -- When 1, disables foreign key constraints and enables them after the INSERT statements&lt;br /&gt;    @ommit_computed_cols bit = 0        -- When 1, computed columns will not be included in the INSERT statement&lt;br /&gt;   &lt;br /&gt;)&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;/***********************************************************************************************************&lt;br /&gt;&lt;br /&gt;NOTE:        This procedure may not work with tables with too many columns.&lt;br /&gt;        Results can be unpredictable with huge text columns or SQL Server 2000's sql_variant data types&lt;br /&gt;        Whenever possible, Use @include_column_list parameter to ommit column list in the INSERT statement, for better results&lt;br /&gt;        IMPORTANT: This procedure is not tested with internation data (Extended characters or Unicode). If needed&lt;br /&gt;        you might want to convert the datatypes of character variables in this procedure to their respective unicode counterparts&lt;br /&gt;        like nchar and nvarchar&lt;br /&gt;       &lt;br /&gt;&lt;br /&gt;Example 1:    To generate INSERT statements for table 'titles':&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts 'titles'&lt;br /&gt;&lt;br /&gt;Example 2:     To ommit the column list in the INSERT statement: (Column list is included by default)&lt;br /&gt;        IMPORTANT: If you have too many columns, you are advised to ommit column list, as shown below,&lt;br /&gt;        to avoid erroneous results&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts 'titles', @include_column_list = 0&lt;br /&gt;&lt;br /&gt;Example 3:    To generate INSERT statements for 'titlesCopy' table from 'titles' table:&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts 'titles', 'titlesCopy'&lt;br /&gt;&lt;br /&gt;Example 4:    To generate INSERT statements for 'titles' table for only those titles&lt;br /&gt;        which contain the word 'Computer' in them:&lt;br /&gt;        NOTE: Do not complicate the FROM or WHERE clause here. It's assumed that you are good with T-SQL if you are using this parameter&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts 'titles', @from = "from titles where title like '%Computer%'"&lt;br /&gt;&lt;br /&gt;Example 5:     To specify that you want to include TIMESTAMP column's data as well in the INSERT statement:&lt;br /&gt;        (By default TIMESTAMP column's data is not scripted)&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts 'titles', @include_timestamp = 1&lt;br /&gt;&lt;br /&gt;Example 6:    To print the debug information:&lt;br /&gt; &lt;br /&gt;        EXEC sp_generate_inserts 'titles', @debug_mode = 1&lt;br /&gt;&lt;br /&gt;Example 7:     If you are not the owner of the table, use @owner parameter to specify the owner name&lt;br /&gt;        To use this option, you must have SELECT permissions on that table&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts Nickstable, @owner = 'Nick'&lt;br /&gt;&lt;br /&gt;Example 8:     To generate INSERT statements for the rest of the columns excluding images&lt;br /&gt;        When using this otion, DO NOT set @include_column_list parameter to 0.&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts imgtable, @ommit_images = 1&lt;br /&gt;&lt;br /&gt;Example 9:     To generate INSERT statements excluding (ommiting) IDENTITY columns:&lt;br /&gt;        (By default IDENTITY columns are included in the INSERT statement)&lt;br /&gt;&lt;br /&gt;        EXEC sp_generate_inserts mytable, @ommit_identity = 1&lt;br /&gt;&lt;br /&gt;Example 10:     To generate INSERT statements for the TOP 10 rows in the table:&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts mytable, @top = 10&lt;br /&gt;&lt;br /&gt;Example 11:     To generate INSERT statements with only those columns you want:&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts titles, @cols_to_include = "'title','title_id','au_id'"&lt;br /&gt;&lt;br /&gt;Example 12:     To generate INSERT statements by omitting certain columns:&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts titles, @cols_to_exclude = "'title','title_id','au_id'"&lt;br /&gt;&lt;br /&gt;Example 13:    To avoid checking the foreign key constraints while loading data with INSERT statements:&lt;br /&gt;       &lt;br /&gt;        EXEC sp_generate_inserts titles, @disable_constraints = 1&lt;br /&gt;&lt;br /&gt;Example 14:     To exclude computed columns from the INSERT statement:&lt;br /&gt;        EXEC sp_generate_inserts MyTable, @ommit_computed_cols = 1&lt;br /&gt;***********************************************************************************************************/&lt;br /&gt;&lt;br /&gt;SET NOCOUNT ON&lt;br /&gt;&lt;br /&gt;--Making sure user only uses either @cols_to_include or @cols_to_exclude&lt;br /&gt;IF ((@cols_to_include IS NOT NULL) AND (@cols_to_exclude IS NOT NULL))&lt;br /&gt;    BEGIN&lt;br /&gt;        RAISERROR('Use either @cols_to_include or @cols_to_exclude. Do not use both the parameters at once',16,1)&lt;br /&gt;        RETURN -1 --Failure. Reason: Both @cols_to_include and @cols_to_exclude parameters are specified&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;--Making sure the @cols_to_include and @cols_to_exclude parameters are receiving values in proper format&lt;br /&gt;IF ((@cols_to_include IS NOT NULL) AND (PATINDEX('''%''',@cols_to_include) = 0))&lt;br /&gt;    BEGIN&lt;br /&gt;        RAISERROR('Invalid use of @cols_to_include property',16,1)&lt;br /&gt;        PRINT 'Specify column names surrounded by single quotes and separated by commas'&lt;br /&gt;        PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_include = "''title_id'',''title''"'&lt;br /&gt;        RETURN -1 --Failure. Reason: Invalid use of @cols_to_include property&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;IF ((@cols_to_exclude IS NOT NULL) AND (PATINDEX('''%''',@cols_to_exclude) = 0))&lt;br /&gt;    BEGIN&lt;br /&gt;        RAISERROR('Invalid use of @cols_to_exclude property',16,1)&lt;br /&gt;        PRINT 'Specify column names surrounded by single quotes and separated by commas'&lt;br /&gt;        PRINT 'Eg: EXEC sp_generate_inserts titles, @cols_to_exclude = "''title_id'',''title''"'&lt;br /&gt;        RETURN -1 --Failure. Reason: Invalid use of @cols_to_exclude property&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--Checking to see if the database name is specified along wih the table name&lt;br /&gt;--Your database context should be local to the table for which you want to generate INSERT statements&lt;br /&gt;--specifying the database name is not allowed&lt;br /&gt;IF (PARSENAME(@table_name,3)) IS NOT NULL&lt;br /&gt;    BEGIN&lt;br /&gt;        RAISERROR('Do not specify the database name. Be in the required database and just specify the table name.',16,1)&lt;br /&gt;        RETURN -1 --Failure. Reason: Database name is specified along with the table name, which is not allowed&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;--Checking for the existence of 'user table' or 'view'&lt;br /&gt;--This procedure is not written to work on system tables&lt;br /&gt;--To script the data in system tables, just create a view on the system tables and script the view instead&lt;br /&gt;&lt;br /&gt;IF @owner IS NULL&lt;br /&gt;    BEGIN&lt;br /&gt;        IF ((OBJECT_ID(@table_name,'U') IS NULL) AND (OBJECT_ID(@table_name,'V') IS NULL))&lt;br /&gt;            BEGIN&lt;br /&gt;                RAISERROR('User table or view not found.',16,1)&lt;br /&gt;                PRINT 'You may see this error, if you are not the owner of this table or view. In that case use @owner parameter to specify the owner name.'&lt;br /&gt;                PRINT 'Make sure you have SELECT permission on that table or view.'&lt;br /&gt;                RETURN -1 --Failure. Reason: There is no user table or view with this name&lt;br /&gt;            END&lt;br /&gt;    END&lt;br /&gt;ELSE&lt;br /&gt;    BEGIN&lt;br /&gt;        IF NOT EXISTS (SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = @table_name AND (TABLE_TYPE = 'BASE TABLE' OR TABLE_TYPE = 'VIEW') AND TABLE_SCHEMA = @owner)&lt;br /&gt;            BEGIN&lt;br /&gt;                RAISERROR('User table or view not found.',16,1)&lt;br /&gt;                PRINT 'You may see this error, if you are not the owner of this table. In that case use @owner parameter to specify the owner name.'&lt;br /&gt;                PRINT 'Make sure you have SELECT permission on that table or view.'&lt;br /&gt;                RETURN -1 --Failure. Reason: There is no user table or view with this name       &lt;br /&gt;            END&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;--Variable declarations&lt;br /&gt;DECLARE        @Column_ID int,        &lt;br /&gt;        @Column_List varchar(8000),&lt;br /&gt;        @Column_Name varchar(128),&lt;br /&gt;        @Start_Insert varchar(786),&lt;br /&gt;        @Data_Type varchar(128),&lt;br /&gt;        @Actual_Values varchar(8000),    --This is the string that will be finally executed to generate INSERT statements&lt;br /&gt;        @IDN varchar(128)        --Will contain the IDENTITY column's name in the table&lt;br /&gt;&lt;br /&gt;--Variable Initialization&lt;br /&gt;SET @IDN = ''&lt;br /&gt;SET @Column_ID = 0&lt;br /&gt;SET @Column_Name = ''&lt;br /&gt;SET @Column_List = ''&lt;br /&gt;SET @Actual_Values = ''&lt;br /&gt;&lt;br /&gt;IF @owner IS NULL&lt;br /&gt;    BEGIN&lt;br /&gt;        SET @Start_Insert = 'INSERT INTO ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'&lt;br /&gt;    END&lt;br /&gt;ELSE&lt;br /&gt;    BEGIN&lt;br /&gt;        SET @Start_Insert = 'INSERT ' + '[' + LTRIM(RTRIM(@owner)) + '].' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']'        &lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--To get the first column's ID&lt;br /&gt;&lt;br /&gt;SELECT    @Column_ID = MIN(ORDINAL_POSITION)    &lt;br /&gt;FROM    INFORMATION_SCHEMA.COLUMNS (NOLOCK)&lt;br /&gt;WHERE     TABLE_NAME = @table_name AND&lt;br /&gt;(@owner IS NULL OR TABLE_SCHEMA = @owner)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--Loop through all the columns of the table, to get the column names and their data types&lt;br /&gt;WHILE @Column_ID IS NOT NULL&lt;br /&gt;    BEGIN&lt;br /&gt;        SELECT     @Column_Name = QUOTENAME(COLUMN_NAME),&lt;br /&gt;        @Data_Type = DATA_TYPE&lt;br /&gt;        FROM     INFORMATION_SCHEMA.COLUMNS (NOLOCK)&lt;br /&gt;        WHERE     ORDINAL_POSITION = @Column_ID AND&lt;br /&gt;        TABLE_NAME = @table_name AND&lt;br /&gt;        (@owner IS NULL OR TABLE_SCHEMA = @owner)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        IF @cols_to_include IS NOT NULL --Selecting only user specified columns&lt;br /&gt;        BEGIN&lt;br /&gt;            IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_include) = 0&lt;br /&gt;            BEGIN&lt;br /&gt;                GOTO SKIP_LOOP&lt;br /&gt;            END&lt;br /&gt;        END&lt;br /&gt;&lt;br /&gt;        IF @cols_to_exclude IS NOT NULL --Selecting only user specified columns&lt;br /&gt;        BEGIN&lt;br /&gt;            IF CHARINDEX( '''' + SUBSTRING(@Column_Name,2,LEN(@Column_Name)-2) + '''',@cols_to_exclude) &amp;lt;&amp;gt; 0&lt;br /&gt;            BEGIN&lt;br /&gt;                GOTO SKIP_LOOP&lt;br /&gt;            END&lt;br /&gt;        END&lt;br /&gt;&lt;br /&gt;        --Making sure to output SET IDENTITY_INSERT ON/OFF in case the table has an IDENTITY column&lt;br /&gt;        IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsIdentity')) = 1&lt;br /&gt;        BEGIN&lt;br /&gt;            IF @ommit_identity = 0 --Determing whether to include or exclude the IDENTITY column&lt;br /&gt;                SET @IDN = @Column_Name&lt;br /&gt;            ELSE&lt;br /&gt;                GOTO SKIP_LOOP           &lt;br /&gt;        END&lt;br /&gt;       &lt;br /&gt;        --Making sure whether to output computed columns or not&lt;br /&gt;        IF @ommit_computed_cols = 1&lt;br /&gt;        BEGIN&lt;br /&gt;            IF (SELECT COLUMNPROPERTY( OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name),SUBSTRING(@Column_Name,2,LEN(@Column_Name) - 2),'IsComputed')) = 1&lt;br /&gt;            BEGIN&lt;br /&gt;                GOTO SKIP_LOOP                   &lt;br /&gt;            END&lt;br /&gt;        END&lt;br /&gt;       &lt;br /&gt;        --Tables with columns of IMAGE data type are not supported for obvious reasons&lt;br /&gt;        IF(@Data_Type in ('image'))&lt;br /&gt;            BEGIN&lt;br /&gt;                IF (@ommit_images = 0)&lt;br /&gt;                    BEGIN&lt;br /&gt;                        RAISERROR('Tables with image columns are not supported.',16,1)&lt;br /&gt;                        PRINT 'Use @ommit_images = 1 parameter to generate INSERTs for the rest of the columns.'&lt;br /&gt;                        PRINT 'DO NOT ommit Column List in the INSERT statements. If you ommit column list using @include_column_list=0, the generated INSERTs will fail.'&lt;br /&gt;                        RETURN -1 --Failure. Reason: There is a column with image data type&lt;br /&gt;                    END&lt;br /&gt;                ELSE&lt;br /&gt;                    BEGIN&lt;br /&gt;                    GOTO SKIP_LOOP&lt;br /&gt;                    END&lt;br /&gt;            END&lt;br /&gt;&lt;br /&gt;        --Determining the data type of the column and depending on the data type, the VALUES part of&lt;br /&gt;        --the INSERT statement is generated. Care is taken to handle columns with NULL values. Also&lt;br /&gt;        --making sure, not to lose any data from flot, real, money, smallmomey, datetime columns&lt;br /&gt;        SET @Actual_Values = @Actual_Values  +&lt;br /&gt;        CASE&lt;br /&gt;            WHEN @Data_Type IN ('char','varchar','nchar','nvarchar')&lt;br /&gt;                THEN&lt;br /&gt;                    'COALESCE('''''''' + REPLACE(RTRIM(' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'&lt;br /&gt;            WHEN @Data_Type IN ('datetime','smalldatetime')&lt;br /&gt;                THEN&lt;br /&gt;                    'COALESCE('''''''' + RTRIM(CONVERT(char,' + @Column_Name + ',109))+'''''''',''NULL'')'&lt;br /&gt;            WHEN @Data_Type IN ('uniqueidentifier')&lt;br /&gt;                THEN &lt;br /&gt;                    'COALESCE('''''''' + REPLACE(CONVERT(char(255),RTRIM(' + @Column_Name + ')),'''''''','''''''''''')+'''''''',''NULL'')'&lt;br /&gt;            WHEN @Data_Type IN ('text','ntext')&lt;br /&gt;                THEN &lt;br /&gt;                    'COALESCE('''''''' + REPLACE(CONVERT(char(8000),' + @Column_Name + '),'''''''','''''''''''')+'''''''',''NULL'')'                   &lt;br /&gt;            WHEN @Data_Type IN ('binary','varbinary')&lt;br /&gt;                THEN &lt;br /&gt;                    'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')' &lt;br /&gt;            WHEN @Data_Type IN ('timestamp','rowversion')&lt;br /&gt;                THEN &lt;br /&gt;                    CASE&lt;br /&gt;                        WHEN @include_timestamp = 0&lt;br /&gt;                            THEN&lt;br /&gt;                                '''DEFAULT'''&lt;br /&gt;                            ELSE&lt;br /&gt;                                'COALESCE(RTRIM(CONVERT(char,' + 'CONVERT(int,' + @Column_Name + '))),''NULL'')' &lt;br /&gt;                    END&lt;br /&gt;            WHEN @Data_Type IN ('float','real','money','smallmoney')&lt;br /&gt;                THEN&lt;br /&gt;                    'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' +  @Column_Name  + ',2)' + ')),''NULL'')'&lt;br /&gt;            ELSE&lt;br /&gt;                'COALESCE(LTRIM(RTRIM(' + 'CONVERT(char, ' +  @Column_Name  + ')' + ')),''NULL'')'&lt;br /&gt;        END   + '+' +  ''',''' + ' + '&lt;br /&gt;       &lt;br /&gt;        --Generating the column list for the INSERT statement&lt;br /&gt;        SET @Column_List = @Column_List +  @Column_Name + ','   &lt;br /&gt;&lt;br /&gt;        SKIP_LOOP: --The label used in GOTO&lt;br /&gt;&lt;br /&gt;        SELECT     @Column_ID = MIN(ORDINAL_POSITION)&lt;br /&gt;        FROM     INFORMATION_SCHEMA.COLUMNS (NOLOCK)&lt;br /&gt;        WHERE     TABLE_NAME = @table_name AND&lt;br /&gt;        ORDINAL_POSITION &amp;gt; @Column_ID AND&lt;br /&gt;        (@owner IS NULL OR TABLE_SCHEMA = @owner)&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    --Loop ends here!&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;--To get rid of the extra characters that got concatenated during the last run through the loop&lt;br /&gt;SET @Column_List = LEFT(@Column_List,len(@Column_List) - 1)&lt;br /&gt;SET @Actual_Values = LEFT(@Actual_Values,len(@Actual_Values) - 6)&lt;br /&gt;&lt;br /&gt;IF LTRIM(@Column_List) = ''&lt;br /&gt;    BEGIN&lt;br /&gt;        RAISERROR('No columns to select. There should at least be one column to generate the output',16,1)&lt;br /&gt;        RETURN -1 --Failure. Reason: Looks like all the columns are ommitted using the @cols_to_exclude parameter&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;--Forming the final string that will be executed, to output the INSERT statements&lt;br /&gt;IF (@include_column_list &amp;lt;&amp;gt; 0)&lt;br /&gt;    BEGIN&lt;br /&gt;        SET @Actual_Values =&lt;br /&gt;            'SELECT ' + &lt;br /&gt;            CASE WHEN @top IS NULL OR @top &amp;lt; 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +&lt;br /&gt;            '''' + RTRIM(@Start_Insert) +&lt;br /&gt;            ' ''+' + '''(' + RTRIM(@Column_List) +  '''+' + ''')''' +&lt;br /&gt;            ' +''VALUES(''+ ' +  @Actual_Values  + '+'')''' + ' ' +&lt;br /&gt;            COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')&lt;br /&gt;    END&lt;br /&gt;ELSE IF (@include_column_list = 0)&lt;br /&gt;    BEGIN&lt;br /&gt;        SET @Actual_Values =&lt;br /&gt;            'SELECT ' +&lt;br /&gt;            CASE WHEN @top IS NULL OR @top &amp;lt; 0 THEN '' ELSE ' TOP ' + LTRIM(STR(@top)) + ' ' END +&lt;br /&gt;            '''' + RTRIM(@Start_Insert) +&lt;br /&gt;            ' '' +''VALUES(''+ ' +  @Actual_Values + '+'')''' + ' ' +&lt;br /&gt;            COALESCE(@from,' FROM ' + CASE WHEN @owner IS NULL THEN '' ELSE '[' + LTRIM(RTRIM(@owner)) + '].' END + '[' + rtrim(@table_name) + ']' + '(NOLOCK)')&lt;br /&gt;    END   &lt;br /&gt;&lt;br /&gt;--Determining whether to ouput any debug information&lt;br /&gt;IF @debug_mode =1&lt;br /&gt;    BEGIN&lt;br /&gt;        PRINT '/*****START OF DEBUG INFORMATION*****'&lt;br /&gt;        PRINT 'Beginning of the INSERT statement:'&lt;br /&gt;        PRINT @Start_Insert&lt;br /&gt;        PRINT ''&lt;br /&gt;        PRINT 'The column list:'&lt;br /&gt;        PRINT @Column_List&lt;br /&gt;        PRINT ''&lt;br /&gt;        PRINT 'The SELECT statement executed to generate the INSERTs'&lt;br /&gt;        PRINT @Actual_Values&lt;br /&gt;        PRINT ''&lt;br /&gt;        PRINT '*****END OF DEBUG INFORMATION*****/'&lt;br /&gt;        PRINT ''&lt;br /&gt;    END&lt;br /&gt;       &lt;br /&gt;PRINT '--INSERTs generated by ''sp_generate_inserts'' stored procedure written by Vyas'&lt;br /&gt;PRINT '--Build number: 22'&lt;br /&gt;PRINT '--Problems/Suggestions? Contact Vyas @ vyaskn@hotmail.com'&lt;br /&gt;PRINT '--http://vyaskn.tripod.com'&lt;br /&gt;PRINT ''&lt;br /&gt;PRINT 'SET NOCOUNT ON'&lt;br /&gt;PRINT ''&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--Determining whether to print IDENTITY_INSERT or not&lt;br /&gt;IF (@IDN &amp;lt;&amp;gt; '')&lt;br /&gt;    BEGIN&lt;br /&gt;        PRINT 'SET IDENTITY_INSERT ' + QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + QUOTENAME(@table_name) + ' ON'&lt;br /&gt;        PRINT 'GO'&lt;br /&gt;        PRINT ''&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)&lt;br /&gt;    BEGIN&lt;br /&gt;        IF @owner IS NULL&lt;br /&gt;            BEGIN&lt;br /&gt;                SELECT     'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'&lt;br /&gt;            END&lt;br /&gt;        ELSE&lt;br /&gt;            BEGIN&lt;br /&gt;                SELECT     'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' NOCHECK CONSTRAINT ALL' AS '--Code to disable constraints temporarily'&lt;br /&gt;            END&lt;br /&gt;&lt;br /&gt;        PRINT 'GO'&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;PRINT ''&lt;br /&gt;PRINT 'PRINT ''Inserting values into ' + '[' + RTRIM(COALESCE(@target_table,@table_name)) + ']' + ''''&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;--All the hard work pays off here!!! You'll get your INSERT statements, when the next line executes!&lt;br /&gt;EXEC (@Actual_Values)&lt;br /&gt;&lt;br /&gt;PRINT 'PRINT ''Done'''&lt;br /&gt;PRINT ''&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;IF @disable_constraints = 1 AND (OBJECT_ID(QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + @table_name, 'U') IS NOT NULL)&lt;br /&gt;    BEGIN&lt;br /&gt;        IF @owner IS NULL&lt;br /&gt;            BEGIN&lt;br /&gt;                SELECT     'ALTER TABLE ' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL'  AS '--Code to enable the previously disabled constraints'&lt;br /&gt;            END&lt;br /&gt;        ELSE&lt;br /&gt;            BEGIN&lt;br /&gt;                SELECT     'ALTER TABLE ' + QUOTENAME(@owner) + '.' + QUOTENAME(COALESCE(@target_table, @table_name)) + ' CHECK CONSTRAINT ALL' AS '--Code to enable the previously disabled constraints'&lt;br /&gt;            END&lt;br /&gt;&lt;br /&gt;        PRINT 'GO'&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;PRINT ''&lt;br /&gt;IF (@IDN &amp;lt;&amp;gt; '')&lt;br /&gt;    BEGIN&lt;br /&gt;        PRINT 'SET IDENTITY_INSERT ' + QUOTENAME(COALESCE(@owner,USER_NAME())) + '.' + QUOTENAME(@table_name) + ' OFF'&lt;br /&gt;        PRINT 'GO'&lt;br /&gt;    END&lt;br /&gt;&lt;br /&gt;PRINT 'SET NOCOUNT OFF'&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SET NOCOUNT OFF&lt;br /&gt;RETURN 0 --Success. We are done!&lt;br /&gt;END&lt;br /&gt;GO&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-7499714885394905253?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/7499714885394905253/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=7499714885394905253" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/7499714885394905253?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/7499714885394905253?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/Ik59U8UPYyM/how-to-create-insert-script-in-sql.html" title="How to create Insert Script in SQL Server database" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/03/how-to-create-insert-script-in-sql.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0cEQXg-fSp7ImA9WxZWF0k.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-3451318131556246762</id><published>2008-03-17T03:09:00.000-07:00</published><updated>2008-03-17T03:16:40.655-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-17T03:16:40.655-07:00</app:edited><title>Check all checkbox within GridView or DataGrid in Asp.Net</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Check all checkbox within GridView or DataGrid in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;===================================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometimes we need to handle functionality in our asp.net pages, like when a header&lt;br /&gt;checkbox become selected, all checkbox within a GridView or DataGrid should become selected.&lt;br /&gt;So here, this is the way, by it you can handle this types of functionality.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suppose your page GridView layout is like:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-----------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:GridView ID="gvCompanyInvoiceList" runat="server" AutoGenerateColumns="False"&amp;gt;&lt;br /&gt;  &amp;lt;Columns&amp;gt;&lt;br /&gt;                      &amp;lt;asp:TemplateField&amp;gt;&lt;br /&gt;                          &amp;lt;HeaderTemplate&amp;gt;&lt;br /&gt;                              &amp;lt;asp:CheckBox ID="chkAll" &lt;span style="font-weight: bold;"&gt;onclick="CheckAll(this);"&lt;/span&gt; runat="server"  /&amp;gt;&lt;br /&gt;                          &amp;lt;/HeaderTemplate&amp;gt;&lt;br /&gt;                          &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                              &amp;lt;asp:CheckBox ID="chkgdApprove" &lt;span style="font-weight: bold;"&gt;onclick="CheckChanged(this);"&lt;/span&gt; runat="server" /&amp;gt;&lt;br /&gt;                          &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;                          &amp;lt;HeaderStyle Width="5%" /&amp;gt;&lt;br /&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;span style="font-weight: bold;"&gt;Use this script to handle checkbox functionalities.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;---------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;      function CheckAll(checkAllBox)&lt;br /&gt;      {&lt;br /&gt;    &lt;br /&gt;           var frm = document.form1;&lt;br /&gt;          var ChkState=checkAllBox.checked;&lt;br /&gt;           for(i=0; i&amp;lt; frm.length;i++)&lt;br /&gt;           {&lt;br /&gt;              e = frm.elements[i];&lt;br /&gt;               if(e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkgdApprove') != -1)&lt;br /&gt;               e.checked= ChkState ;&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;      function CheckChanged()&lt;br /&gt;       {&lt;br /&gt;          var frm = document.form1;&lt;br /&gt;           var boolAllChecked;&lt;br /&gt;           boolAllChecked=true;&lt;br /&gt;           for(i=0;i&amp;lt; frm.length;i++)&lt;br /&gt;           {&lt;br /&gt;               e=frm.elements[i];&lt;br /&gt;              if ( e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkgdApprove') != -1 )&lt;br /&gt;                   if(e.checked== false)&lt;br /&gt;                   { &lt;br /&gt;                       boolAllChecked=false;&lt;br /&gt;                       break;&lt;br /&gt;                   }&lt;br /&gt;           }&lt;br /&gt;          for(i=0;i&amp;lt; frm.length;i++)&lt;br /&gt;          {&lt;br /&gt;               e=frm.elements[i];&lt;br /&gt;               if ( e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkAll') != -1 )&lt;br /&gt;               {&lt;br /&gt;                   if( boolAllChecked==false)&lt;br /&gt;                      e.checked= false ;&lt;br /&gt;                   else&lt;br /&gt;                       e.checked= true;&lt;br /&gt;                  break;&lt;br /&gt;               }&lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-3451318131556246762?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/3451318131556246762/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=3451318131556246762" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3451318131556246762?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/3451318131556246762?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/mZEcKrFYM2w/abhishek-joshi-check-all-checkbox.html" title="Check all checkbox within GridView or DataGrid in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/03/abhishek-joshi-check-all-checkbox.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEQBRH46cCp7ImA9WxZWFUs.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-1640964807457889304</id><published>2008-03-14T23:22:00.000-07:00</published><updated>2008-03-14T23:25:55.018-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-14T23:25:55.018-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Check all checkbox within GridView or DataGrid in Asp.Net</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Check all checkbox within GridView or DataGrid in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;===================================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Sometimes we need to handle functionality in our asp.net pages, like when a header&lt;br /&gt;checkbox become selected, all checkbox within a GridView or DataGrid should become selected.&lt;br /&gt;So here, this is the way, by it you can handle this types of functionality.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Suppose your page GridView layout is like:&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;-----------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;asp:GridView ID="gvCompanyInvoiceList" runat="server" AutoGenerateColumns="False"&amp;gt;&lt;br /&gt;    &amp;lt;Columns&amp;gt;&lt;br /&gt;                        &amp;lt;asp:TemplateField&amp;gt;&lt;br /&gt;                            &amp;lt;HeaderTemplate&amp;gt;&lt;br /&gt;                                &amp;lt;asp:CheckBox ID="chkAll" &lt;span style="font-weight: bold;"&gt;onclick="CheckAll(this);"&lt;/span&gt; runat="server"  /&amp;gt;&lt;br /&gt;                            &amp;lt;/HeaderTemplate&amp;gt;&lt;br /&gt;                            &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                                &amp;lt;asp:CheckBox ID="chkgdApprove" &lt;span style="font-weight: bold;"&gt;onclick="CheckChanged(this);"&lt;/span&gt; runat="server" /&amp;gt;&lt;br /&gt;                            &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;                            &amp;lt;HeaderStyle Width="5%" /&amp;gt;&lt;br /&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;span style="font-weight: bold;"&gt;Use this script to handle checkbox functionalities.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;---------------------------------------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;        function CheckAll(checkAllBox)&lt;br /&gt;        {&lt;br /&gt;        &lt;br /&gt;             var frm = document.form1;&lt;br /&gt;            var ChkState=checkAllBox.checked;&lt;br /&gt;             for(i=0; i&amp;lt; frm.length;i++)&lt;br /&gt;             {&lt;br /&gt;                e = frm.elements[i];&lt;br /&gt;                 if(e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkgdApprove') != -1)&lt;br /&gt;                 e.checked= ChkState ;&lt;br /&gt;             }&lt;br /&gt;         }&lt;br /&gt;        function CheckChanged()&lt;br /&gt;         {&lt;br /&gt;            var frm = document.form1;&lt;br /&gt;             var boolAllChecked;&lt;br /&gt;             boolAllChecked=true;&lt;br /&gt;             for(i=0;i&amp;lt; frm.length;i++)&lt;br /&gt;             {&lt;br /&gt;                 e=frm.elements[i];&lt;br /&gt;                if ( e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkgdApprove') != -1 )&lt;br /&gt;                     if(e.checked== false)&lt;br /&gt;                     {   &lt;br /&gt;                         boolAllChecked=false;&lt;br /&gt;                         break;&lt;br /&gt;                     }&lt;br /&gt;             }&lt;br /&gt;            for(i=0;i&amp;lt; frm.length;i++)&lt;br /&gt;            {&lt;br /&gt;                 e=frm.elements[i];&lt;br /&gt;                 if ( e.type=='checkbox' &amp;amp;&amp;amp; e.name.indexOf('chkAll') != -1 )&lt;br /&gt;                 {&lt;br /&gt;                     if( boolAllChecked==false)&lt;br /&gt;                        e.checked= false ;&lt;br /&gt;                     else&lt;br /&gt;                         e.checked= true;&lt;br /&gt;                    break;&lt;br /&gt;                 }&lt;br /&gt;             }&lt;br /&gt;         }&lt;br /&gt; &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-1640964807457889304?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/1640964807457889304/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=1640964807457889304" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1640964807457889304?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1640964807457889304?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/aoiXtHEE76E/check-all-checkbox-within-gridview-or.html" title="Check all checkbox within GridView or DataGrid in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/03/check-all-checkbox-within-gridview-or.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0QFR3k9fSp7ImA9WxZXFU8.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-8241680182788898183</id><published>2008-02-27T00:53:00.000-08:00</published><updated>2008-03-02T22:21:56.765-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-03-02T22:21:56.765-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="C#" /><title>Generate a random alpha numeric string from given length</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Generate a random alpha numeric string from given length.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;==================================================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// Generate a random alpha numeric string from given length.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// Author : Abhishek Joshi&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// 24 Feb, 2008&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// &amp;lt;param name="iLength"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; /// &amp;lt;returns&amp;gt;Enter output string Length.&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; public static string GenerateAlphNumericCode(int iLength)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  int iZero, iNine, iA, iZ, iCount = 0, iRandNum;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  string sRandomString ;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // we'll need random characters, so a Random object &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // should probably be created...&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  Random rRandom = new Random(System.DateTime.Now.Millisecond);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // convert characters into their integer equivalents (their ASCII values)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  iZero = (int) '0';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  iNine = (int) '9';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  iA = (int) 'A';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  iZ = (int)'Z';&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // initialize our return string for use in the following loop&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  sRandomString = string.Empty;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // now we loop as many times as is necessary to build the string &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // length we want&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  while (iCount &amp;lt; iLength)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   // we fetch a random number between our high and low values&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   iRandNum = rRandom.Next(iZero, iZ);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   // here's the cool part: we inspect the value of the random number, &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            // and if it matches one of the legal values that we've decided upon,  &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;            // we convert the number to a character and add it to our string&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   if (((iRandNum &amp;gt;= iZero) &amp;amp;&amp;amp; (iRandNum &amp;lt;= iNine) || (iRandNum &amp;gt;= iA) &amp;amp;&amp;amp; (iRandNum &amp;lt;= iZ)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    sRandomString = sRandomString + Convert.ToChar(iRandNum);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    iCount = iCount + 1;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  // finally, our random character string should be built, so we return it&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  return sRandomString;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; }&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-8241680182788898183?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/8241680182788898183/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=8241680182788898183" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8241680182788898183?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8241680182788898183?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/fiO3G6zVh1U/generate-random-alpha-numeric-string_27.html" title="Generate a random alpha numeric string from given length" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>2</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/02/generate-random-alpha-numeric-string_27.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D08ERHkyfSp7ImA9WxZSFk0.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-6900644344333343473</id><published>2008-01-29T03:21:00.000-08:00</published><updated>2008-01-29T03:23:25.795-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-29T03:23:25.795-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Resize Image" /><title>Download Image in Asp.Net</title><content type="html">&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Download Image in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;=======================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;string ImageFile = Server.MapPath("Hello.jpg");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;System.Drawing.Image objImage = System.Drawing.Bitmap.FromFile(ImageFile);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Response.Clear();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Response.ClearContent();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Response.ContentType = "images/jpeg";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Response.AddHeader("Content-Disposition", "attachment; filename=Image.jpg;");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;MemoryStream objMem = new MemoryStream();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;objImage.Save(objMem, ImageFormat.Jpeg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;objMem.WriteTo(Response.OutputStream);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;//objImage.Save(Response.OutputStream, ImageFormat.Jpeg);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Response.End();&lt;br /&gt;&lt;br /&gt;That's It !!&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-6900644344333343473?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/6900644344333343473/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=6900644344333343473" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6900644344333343473?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6900644344333343473?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/K-HaLPr4rGM/download-image-in-aspnet.html" title="Download Image in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/01/download-image-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04FRn4_eyp7ImA9WB9aGUg.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-6306160596174795066</id><published>2008-01-10T01:23:00.000-08:00</published><updated>2008-01-10T02:11:57.043-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-10T02:11:57.043-08:00</app:edited><title>User Handler for Page Extension in Asp.Net</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;User Handler for Page Extension in Asp.Net&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;====================================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;In some cases you need to display you website pages (.aspx) to another extension like (.cgi)&lt;br /&gt;&lt;br /&gt;In that case, you need to use inbuilt handler of Asp.net&lt;br /&gt;&lt;br /&gt;You can do it by this way :&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setup your web.config file&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;----------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Don't forget to add section those are marked in "bold" in below code.&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0"?&gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;Note: As an alternative to hand editing this file you can use the&lt;br /&gt;web admin tool to configure settings for your application. Use&lt;br /&gt;the Website-&amp;gt;Asp.Net Configuration option in Visual Studio.&lt;br /&gt;A full list of settings and comments can be found in&lt;br /&gt;machine.config.comments usually located in&lt;br /&gt;\Windows\Microsoft.Net\Framework\v2.x\Config&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;&amp;lt;configSections&amp;gt;&lt;br /&gt;&amp;lt;section name="dataConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Data.Configuration.DatabaseSettings, Microsoft.Practices.EnterpriseLibrary.Data"/&amp;gt;&lt;br /&gt;&amp;lt;/configSections&amp;gt;&lt;br /&gt;&amp;lt;appSettings&amp;gt;&lt;br /&gt;&amp;lt;add key="PageSize" value="5" /&amp;gt;&lt;br /&gt;&amp;lt;add key="PageSize2" value="25"/&amp;gt;&lt;br /&gt;&amp;lt;add key="MailFrom" value="admin@site.com"/&amp;gt;&lt;br /&gt;&amp;lt;add key="SmtpServer" value="mail.netaxle.com"/&amp;gt;&lt;br /&gt;&amp;lt;add key="SmtpServerUserName" value="smtp@servercom" /&amp;gt;&lt;br /&gt;&amp;lt;add key="SmtpServerPassword" value="buster43" /&amp;gt;&lt;br /&gt;&amp;lt;add key="FCKeditor:BasePath" value="~/FCKeditor/" /&amp;gt;&lt;br /&gt;&amp;lt;add key="DictionaryFolder" value="/SpellCheck/dic" /&amp;gt;&lt;br /&gt;&amp;lt;/appSettings&amp;gt;&lt;br /&gt;&amp;lt;connectionStrings&amp;gt;&lt;br /&gt;&amp;lt;add name="ProjectNameDB" providerName="System.Data.SqlClient" connectionString="server=(local);database=DBName;UID=sa;PWD=pwd;"/&amp;gt;&lt;br /&gt;&amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;&amp;lt;dataConfiguration defaultDatabase="ProjectNameDB"/&amp;gt;&lt;br /&gt;&amp;lt;system.web&amp;gt;&lt;br /&gt;&amp;lt;sessionState timeout="30"&amp;gt;&amp;lt;/sessionState&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;Set compilation debug="true" to insert debugging&lt;br /&gt;symbols into the compiled page. Because this&lt;br /&gt;affects performance, set this value to true only&lt;br /&gt;during development.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;compilation debug="true" strict="false" explicit="true"&amp;gt;&lt;br /&gt;&amp;lt;assemblies&amp;gt;&lt;br /&gt;&amp;lt;add assembly="System.Management, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&amp;gt;&lt;br /&gt;&amp;lt;add assembly="System.Configuration.Install, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" /&amp;gt;&lt;br /&gt;&amp;lt;add assembly="System.Data.OracleClient, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /&amp;gt;&lt;br /&gt;&amp;lt;add assembly="System.Transactions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" /&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  &amp;lt;add assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;/assemblies&amp;gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  &amp;lt;buildProviders&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   &amp;lt;add extension=".cgi" type="System.Web.Compilation.PageBuildProvider" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  &amp;lt;/buildProviders&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;/compilation&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;The &amp;lt;authentication&amp;gt; section enables configuration&lt;br /&gt;of the security authentication mode used by&lt;br /&gt;ASP.NET to identify an incoming user.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;pages enableEventValidation="false"  validateRequest="false"&amp;gt;&amp;lt;/pages&amp;gt;&lt;br /&gt;&amp;lt;authentication mode="Forms"&amp;gt;&lt;br /&gt;&amp;lt;forms loginUrl="admin/Login.cgi" timeout="240" name="ProjectName" defaultUrl="add/UserList.cgi"&amp;gt;&amp;lt;/forms&amp;gt;&lt;br /&gt;&amp;lt;/authentication&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;The &amp;lt;customErrors&amp;gt; section enables configuration&lt;br /&gt;of what to do if/when an unhandled error occurs&lt;br /&gt;during the execution of a request. Specifically,&lt;br /&gt;it enables developers to configure html error pages&lt;br /&gt;to be displayed in place of a error stack trace.&lt;br /&gt;--&amp;gt;&lt;br /&gt;&amp;lt;!-- &amp;lt;customErrors defaultRedirect="errorpage.cgi" mode="On"  &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/customErrors&amp;gt; --&amp;gt;&lt;br /&gt;&amp;lt;customErrors mode="Off"/&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; &amp;lt;httpHandlers&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;   &amp;lt;add path="*.cgi" verb="*" type="System.Web.UI.PageHandlerFactory" validate="true" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt; &amp;lt;/httpHandlers&amp;gt;&lt;/span&gt;&lt;br /&gt;&amp;lt;/system.web&amp;gt;&lt;br /&gt;&amp;lt;system.net&amp;gt;&lt;br /&gt;&amp;lt;mailSettings&amp;gt;&lt;br /&gt;&amp;lt;smtp&amp;gt;&lt;br /&gt;&amp;lt;network host="mail.domain.com" userName="site@domain.com" password="buster43"/&amp;gt;&lt;br /&gt;&amp;lt;/smtp&amp;gt;&lt;br /&gt;&amp;lt;/mailSettings&amp;gt;&lt;br /&gt;&amp;lt;/system.net&amp;gt;&lt;br /&gt;&amp;lt;location path="admin"&amp;gt;&lt;br /&gt;&amp;lt;system.web&amp;gt;&lt;br /&gt;&amp;lt;authorization&amp;gt;&lt;br /&gt;&amp;lt;deny users="?"/&amp;gt;&lt;br /&gt;&amp;lt;/authorization&amp;gt;&lt;br /&gt;&amp;lt;/system.web&amp;gt;&lt;br /&gt;&amp;lt;/location&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Setup in IIS for your Server&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;----------------------------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1. Open you website properties from IIS&lt;br /&gt;&lt;br /&gt;2. Goto Home Directory Tab and se the all criteria as per below image&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_U0UefTbnoMQ/R4XtjTYhndI/AAAAAAAAAAc/vVQe-Apqt1E/s1600-h/2.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_U0UefTbnoMQ/R4XtjTYhndI/AAAAAAAAAAc/vVQe-Apqt1E/s320/2.JPG" alt="" id="BLOGGER_PHOTO_ID_5153786539349745106" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;3. Now click on 'Configuratino' from 'Home Directory' tab.&lt;br /&gt;&lt;br /&gt;4. Then, Add new Extension of '.cgi' as per below image.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_U0UefTbnoMQ/R4Xt2TYhneI/AAAAAAAAAAk/HXjTjeno8ts/s1600-h/3.JPG"&gt;&lt;img style="cursor: pointer;" src="http://2.bp.blogspot.com/_U0UefTbnoMQ/R4Xt2TYhneI/AAAAAAAAAAk/HXjTjeno8ts/s320/3.JPG" alt="" id="BLOGGER_PHOTO_ID_5153786865767259618" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;5. Select 'A redirection to url' radion button in 'Home Directory' tab.&lt;br /&gt;&lt;br /&gt;6. Write this text into textbox, next to 'Redirect to' label , just like below image.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_U0UefTbnoMQ/R4XuFjYhnfI/AAAAAAAAAAs/OaelX4oEK8E/s1600-h/1.JPG"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_U0UefTbnoMQ/R4XuFjYhnfI/AAAAAAAAAAs/OaelX4oEK8E/s320/1.JPG" alt="" id="BLOGGER_PHOTO_ID_5153787127760264690" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Redirection Text :&lt;/span&gt;  &lt;span style="font-weight: bold;"&gt;*; /*.aspx; /$0.cgi$Q; /*.aspx; /$0.cgi;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now, You can play with your website.&lt;br /&gt;Feeling magic with .cgi extension instead of .aspx pages.&lt;br /&gt;&lt;br /&gt;That's it !&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-6306160596174795066?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/6306160596174795066/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=6306160596174795066" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6306160596174795066?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6306160596174795066?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/HUpuqASfUyI/user-handler-for-page-extension-in.html" title="User Handler for Page Extension in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/_U0UefTbnoMQ/R4XtjTYhndI/AAAAAAAAAAc/vVQe-Apqt1E/s72-c/2.JPG" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/01/user-handler-for-page-extension-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkAGQ3g-cCp7ImA9WB9aE0g.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2396223648325052682</id><published>2008-01-03T01:55:00.000-08:00</published><updated>2008-01-03T02:05:22.658-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2008-01-03T02:05:22.658-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><title>Fade Effects With Javascript</title><content type="html">&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Fade Effects With Javascript&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;========================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Script&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;-------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;var TimeToFade = 1000.0;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;function fade(eid)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  var element = document.getElementById(eid);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  if(element == null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    return;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  if(element.FadeState == null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    if(element.style.opacity == null&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;        || element.style.opacity == ''&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;        || element.style.opacity == '1')&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;      element.FadeState = 2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;      element.FadeState = -2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;   &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  if(element.FadeState == 1 || element.FadeState == -1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.FadeState = element.FadeState == 1 ? -1 : 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.FadeTimeLeft = TimeToFade - element.FadeTimeLeft;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  else&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.FadeState = element.FadeState == 2 ? -1 : 1;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.FadeTimeLeft = TimeToFade;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    setTimeout("animateFade(" + new Date().getTime()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;        + ",'" + eid + "')", 33);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;function animateFade(lastTick, eid)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;{ &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  var curTick = new Date().getTime();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  var elapsedTicks = curTick - lastTick;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  var element = document.getElementById(eid);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  if(element.FadeTimeLeft &amp;lt;= elapsedTicks)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.style.opacity = element.FadeState == 1 ? '1' : '0';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.style.filter = 'alpha(opacity = '&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;        + (element.FadeState == 1 ? '100' : '0') + ')';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    element.FadeState = element.FadeState == 1 ? 2 : -2;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    return;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  element.FadeTimeLeft -= elapsedTicks;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  var newOpVal = element.FadeTimeLeft/TimeToFade;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  if(element.FadeState == 1)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;    newOpVal = 1 - newOpVal;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  element.style.opacity = newOpVal;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  element.style.filter =&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;      'alpha(opacity = ' + (newOpVal*100) + ')';&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  setTimeout("animateFade(" + curTick&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;      + ",'" + eid + "')", 33);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/HEAD&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;How to Use&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;You can use this JavsScript this way.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Suppose, Your HTML layout is like this :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;BODY&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;div &lt;span style="font-weight: bold; font-style: italic;"&gt;id="fadeBlock"&lt;/span&gt; style="background-color:Lime;width:250px;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;       height:65px;text-align:center;"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  &amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;  I'm Some Text&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;input type="button" &lt;span style="font-style: italic; font-weight: bold;"&gt;onclick="fade('fadeBlock');"&lt;/span&gt; value="Go" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/BODY&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/HTML&amp;gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2396223648325052682?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2396223648325052682/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2396223648325052682" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2396223648325052682?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2396223648325052682?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/9vDiI2G8qps/fade-effects-with-javascript.html" title="Fade Effects With Javascript" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2008/01/fade-effects-with-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0AAQ3o-eSp7ImA9WB9UF00.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2375792901799356212</id><published>2007-12-14T21:59:00.000-08:00</published><updated>2007-12-14T22:55:42.451-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-14T22:55:42.451-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Questions" /><title>Some reading before Interview</title><content type="html">&lt;span style="font-family:trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;What are the OOPS concepts?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;1) &lt;span style="font-style: italic;"&gt;Encapsulation:&lt;/span&gt; It is the mechanism that binds together code and&lt;br /&gt;data in manipulates, and keeps both safe from outside interference and&lt;br /&gt;misuse. In short it isolates a particular code and data from all other&lt;br /&gt;codes and data. A well-defined interface controls the access to that&lt;br /&gt;particular code and data.&lt;br /&gt;&lt;br /&gt;2) &lt;span style="font-style: italic;"&gt;Inheritance:&lt;/span&gt; It is the process by which one object acquires the&lt;br /&gt;properties of another object. This supports the hierarchical&lt;br /&gt;classification. Without the use of hierarchies, each object would need&lt;br /&gt;to define all its characteristics explicitly. However, by use of&lt;br /&gt;inheritance, an object need only define those qualities that make it&lt;br /&gt;unique within its class. It can inherit its general attributes from&lt;br /&gt;its parent. A new sub-class inherits all of the attributes of all of&lt;br /&gt;its ancestors.&lt;br /&gt;&lt;br /&gt;3) &lt;span style="font-style: italic;"&gt;Polymorphism:&lt;/span&gt; It is a feature that allows one interface to be used&lt;br /&gt;for general class of actions. The specific action is determined by the&lt;br /&gt;exact nature of the situation. In general polymorphism means "one&lt;br /&gt;interface, multiple methods", This means that it is possible to design&lt;br /&gt;a generic interface to a group of related activities. This helps&lt;br /&gt;reduce complexity by allowing the same interface to be used to specify&lt;br /&gt;a general class of action. It is the compiler's job to select the&lt;br /&gt;specific action (that is, method) as it applies to each situation.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is the difference between a Struct and a Class?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The struct type is suitable for representing lightweight objects such&lt;br /&gt;as Point, Rectangle, and Color. Although it is possible to represent a&lt;br /&gt;point as a class, a struct is more efficient in some scenarios. For&lt;br /&gt;example, if you declare an array of 1000 Point objects, you will&lt;br /&gt;allocate additional memory for referencing each object. In this case,&lt;br /&gt;the struct is less expensive.&lt;br /&gt;When you create a struct object using the new operator, it gets&lt;br /&gt;created and the appropriate constructor is called. Unlike classes,&lt;br /&gt;structs can be instantiated without using the new operator. If you do&lt;br /&gt;not use new, the fields will remain unassigned and the object cannot&lt;br /&gt;be used until all of the fields are initialized.&lt;br /&gt;It is an error to declare a default (parameterless) constructor for a&lt;br /&gt;struct. A default constructor is always provided to initialize the&lt;br /&gt;struct members to their default values.&lt;br /&gt;It is an error to initialize an instance field in a struct.&lt;br /&gt;There is no inheritance for structs as there is for classes. A struct&lt;br /&gt;cannot inherit from another struct or class, and it cannot be the base&lt;br /&gt;of a class. Structs, however, inherit from the base class Object. A&lt;br /&gt;struct can implement interfaces, and it does that exactly as classes&lt;br /&gt;do.&lt;br /&gt;A struct is a value type, while a class is a reference type.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Value type &amp;amp; reference types difference? Example from .NET. Integer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&amp;amp; struct are value types or reference types in .NET?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Most programming languages provide built-in data types, such as&lt;br /&gt;integers and floating-point numbers, that are copied when they are&lt;br /&gt;passed as arguments (that is, they are passed by value). In the .NET&lt;br /&gt;Framework, these are called value types. The runtime supports two&lt;br /&gt;kinds of value types:&lt;br /&gt;Built-in value types&lt;br /&gt;The .NET Framework defines built-in value types, such as System.Int32&lt;br /&gt;and System.Boolean, which correspond and are identical to primitive&lt;br /&gt;data types used by programming languages.&lt;br /&gt;User-defined value types&lt;br /&gt;Your language will provide ways to define your own value types, which&lt;br /&gt;derive from System.ValueType. If you want to define a type&lt;br /&gt;representing a value that is small, such as a complex number (using&lt;br /&gt;two floating-point numbers), you might choose to define it as a value&lt;br /&gt;type because you can pass the value type efficiently by value. If the&lt;br /&gt;type you are defining would be more efficiently passed by reference,&lt;br /&gt;you should define it as a class instead.&lt;br /&gt;Variables of reference types, referred to as objects, store references&lt;br /&gt;to the actual data. This following are the reference types:&lt;br /&gt;class&lt;br /&gt;interface&lt;br /&gt;delegate&lt;br /&gt;This following are the built-in reference types:&lt;br /&gt;object&lt;br /&gt;string&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is Method Overriding? How to override a function in C#?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use the override modifier to modify a method, a property, an indexer,&lt;br /&gt;or an event. An override method provides a new implementation of a&lt;br /&gt;member inherited from a base class. The method overridden by an&lt;br /&gt;override declaration is known as the overridden base method. The&lt;br /&gt;overridden base method must have the same signature as the override&lt;br /&gt;method.&lt;br /&gt;You cannot override a non-virtual or static method. The overridden&lt;br /&gt;base method must be virtual, abstract, or override.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Can we call a base class method without creating instance?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;Its possible If its a static method.&lt;br /&gt;Its possible by inheriting from that class also.&lt;br /&gt;Its possible from derived classes using base keyword.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;In which cases you use override and new base?&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Use the new modifier to explicitly hide a member inherited from a base&lt;br /&gt;class. To hide an inherited member, declare it in the derived class&lt;br /&gt;using the same name, and modify it with the new modifier.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What are Sealed Classes in C#?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;The sealed modifier is used to prevent derivation from a class. A&lt;br /&gt;compile-time error occurs if a sealed class is specified as the base&lt;br /&gt;class of another class. (A sealed class cannot also be an abstract&lt;br /&gt;class)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;UDDI&lt;/span&gt;&lt;br /&gt;(Universal Description, Discovery and Integration)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;WSDL&lt;/span&gt;&lt;br /&gt;(Web Services Discription Language)&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Web Service (Definition)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;- The W3C defines a Web service[1] as a software system designed to support interoperable machine-to-machine interaction over a network.&lt;br /&gt;&lt;br /&gt;- A Web Service is a software component that is described via WSDL and is capable of being accessed via standard network protocols such as   but not limited to SOAP over HTTP.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;SOAP (Definition)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;- SOAP is a standard for exchanging XML-based messages over a computer network, normally using HTTP. SOAP forms the foundation layer of   the web services stack, providing a basic messaging framework that more abstract layers can build on.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;.Net code Compilation and Execution&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;* Source code is converted to Microsoft Intermediate Language and an assembly is created.&lt;br /&gt;  * Upon execution of a .NET assembly, its MSIL is passed through the Common Language Runtime's JIT compiler to generate native code.       (NGEN compilation eliminates this step at run time.)&lt;br /&gt;  * The native code is executed by the computer's processor.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is XML ?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt; - XML (Extensible Markup Language) is a W3C initiative that allows information and services to be encoded with meaningful structure and semantics that computers and humans can understand. XML is great for information exchange, and can easily be extended to include user-specified and industry-specified tags.&lt;br /&gt;- XML is a markup language for documents containing structured information.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is UML ?&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;UML is a general-purpose modeling language that includes a standardized graphical notation used to create an abstract model of a system.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2375792901799356212?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2375792901799356212/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2375792901799356212" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2375792901799356212?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2375792901799356212?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/znXtIp6hH2E/some-reading-before-interview.html" title="Some reading before Interview" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>1</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/12/some-reading-before-interview.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0MCSHk7eSp7ImA9WB9VGU8.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-8429632312415398677</id><published>2007-12-06T00:14:00.000-08:00</published><updated>2007-12-06T00:24:29.701-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-06T00:24:29.701-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Regular Expression" /><category scheme="http://www.blogger.com/atom/ns#" term="Validation" /><title>Use Regular Expression by JavaScript</title><content type="html">&lt;!-- {\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Courier New;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0??;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255;??\red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;??\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;??\red192\green192\blue192;}??\fs20 function validateEmail()\par ??\tab \{\par ??\tab \tab \cf11 // Value to Validate. Ex. Your EMail Address TextBox\par ??\cf0 \tab \tab var EMailID = document.getElementById(\cf13 'txtEMail'\cf0 ).value;\par ??\tab \tab \par ??\tab \tab \cf11 // Here, we set the Expression to Validate the Value for EMail Address.\par ??\cf0 \tab \tab var EMailValidate = /^([a-zA-Z0-9])+([\\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\\.[a-zA-Z0-9_-]+)+$/;\par ??\tab \tab \par ??\tab \tab \cf11 // Test the Validator.\par ??\cf0 \tab \tab \cf2 if\cf0 ( EMailValidate.test(EMailID)) \par ??\tab \tab \{\par ??\tab \tab \tab alert(\cf13 'Right Email Address.'\cf0 );\par ??\tab \tab \}\par ??\tab \tab \cf2 else\par ??\cf0 \tab \tab \{\par ??\tab \tab \tab alert(\cf13 'Wrong Email Address.'\cf0 );\par ??\tab \tab \}\par ??\tab \}\tab } --&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Use Regular Expression by JavaScript&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;===============================&lt;/span&gt;&lt;br /&gt;&lt;div    style="background: white none repeat scroll 0% 50%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;font-family:Courier New;font-size:10pt;color:black;"&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    1&lt;/span&gt; function validateEmail()&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    2&lt;/span&gt;     {&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    3&lt;/span&gt;         &lt;span style="color:green;"&gt;// Value to Validate. Ex. Your EMail Address TextBox&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    4&lt;/span&gt;         var EMailID = document.getElementById(&lt;span style="color:maroon;"&gt;'txtEMail'&lt;/span&gt;).value;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    5&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    6&lt;/span&gt;         &lt;span style="color:green;"&gt;// Here, we set the Expression to Validate the Value for EMail Address.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    7&lt;/span&gt;         var EMailValidate = /^([a-zA-Z0-9])+([\.a-zA-Z0-9_-])*@([a-zA-Z0-9])+(\.[a-zA-Z0-9_-]+)+$/;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    8&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;    9&lt;/span&gt;         &lt;span style="color:green;"&gt;// Test the Validator.&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   10&lt;/span&gt;         &lt;span style="color:blue;"&gt;if&lt;/span&gt;( EMailValidate.test(EMailID)) &lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   11&lt;/span&gt;         {&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   12&lt;/span&gt;             alert(&lt;span style="color:maroon;"&gt;'Right Email Address.'&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   13&lt;/span&gt;         }&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   14&lt;/span&gt;         &lt;span style="color:blue;"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   15&lt;/span&gt;         {&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   16&lt;/span&gt;             alert(&lt;span style="color:maroon;"&gt;'Wrong Email Address.'&lt;/span&gt;);&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   17&lt;/span&gt;         }&lt;/pre&gt;&lt;br /&gt;&lt;pre style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;   18&lt;/span&gt;     }    &lt;/pre&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-8429632312415398677?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/8429632312415398677/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=8429632312415398677" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8429632312415398677?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/8429632312415398677?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/QpziuK6hkgw/use-regular-expression-by-javascript.html" title="Use Regular Expression by JavaScript" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/12/use-regular-expression-by-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DEYFSX04fip7ImA9WB9VFks.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-1615012977613543435</id><published>2007-12-02T23:04:00.000-08:00</published><updated>2007-12-02T23:15:18.336-08:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-12-02T23:15:18.336-08:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Use ICallbackEventHandler in Asp.Net 2.0</title><content type="html">&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Use ICallbackEventHandler in Asp.Net 2.0&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;==================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-style: italic;font-family:trebuchet ms;" &gt;For Example, you have page Layout is like this :&lt;/span&gt;&lt;br /&gt;&lt;html&amp;~~special_remove!#~~gt; style="font-family: trebuchet ms;"&gt;&lt;head&amp;~~special_remove!#~~gt;&gt;&lt;title&amp;~~special_remove!#~~gt; new="" document=""&gt;&lt;/title&amp;~~special_remove!#~~gt;&gt;&lt;br /&gt;&amp;lt;META NAME="Generator" CONTENT="EditPlus"&amp;gt;&lt;br /&gt;&amp;lt;META NAME="Author" CONTENT=""&amp;gt;&lt;br /&gt;&amp;lt;META NAME="Keywords" CONTENT=""&amp;gt;&lt;br /&gt;&amp;lt;META NAME="Description" CONTENT=""&amp;gt;&lt;br /&gt;&amp;lt;/HEAD&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;BODY&amp;gt;&lt;br /&gt;&amp;lt;div id="divResult" runat="server"&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&amp;lt;br/&amp;gt;&lt;br /&gt;&amp;lt;input type="button" value="Text ICallBack" onclick="return GetPop()" /&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;/BODY&amp;gt;&lt;br /&gt;&amp;lt;/HTML&amp;gt;&lt;br /&gt;&lt;br /&gt;Steps to Implement ICallbackEventHanler:&lt;br /&gt;-------------------------------------------------&lt;br /&gt;&lt;br /&gt;1. First define string variable in Common section of your code behind (.cs) file.&lt;br /&gt;&lt;br /&gt;string _CallBackString;&lt;br /&gt;&lt;br /&gt;2. Inherit ICallbackEventHandler in your page.&lt;br /&gt;&lt;br /&gt;public partial class Customize : System.Web.UI.Page, ICallbackEventHandler&lt;br /&gt;&lt;br /&gt;3. Now, write this code in your Page_Load() Event&lt;br /&gt;&lt;br /&gt;ClientScriptManager cs = Page.ClientScript;&lt;br /&gt;&lt;br /&gt;string cbRef = cs.GetCallbackEventReference(this, "arg", "ShowPop", "context");&lt;br /&gt;string cbScript = "function CallPopBack(arg, context){" + cbRef + ";}";&lt;br /&gt;cs.RegisterClientScriptBlock(this.GetType(), "CallPopBack", cbScript, true);&lt;br /&gt;&lt;br /&gt;4. Now, Write some javascript code, in your design section of your page.&lt;br /&gt;&lt;br /&gt;function GetPop()&lt;br /&gt;{&lt;br /&gt;          var justExample = 'Hi..All..';&lt;br /&gt;&lt;br /&gt;          CallPopBack(justExample)&lt;br /&gt;}&lt;br /&gt;function ShowPop(result, context)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;        var strResult = new String();&lt;br /&gt;        strResult = result;&lt;br /&gt;&lt;br /&gt;        alert(result);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;4. Now, In your code behind (.cs) file, write code for your EventHandle Method.&lt;br /&gt;&lt;br /&gt;public string GetCallbackResult()&lt;br /&gt;{&lt;br /&gt;       return _CallBackString;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void RaiseCallbackEvent(string eventArgument)&lt;br /&gt;{&lt;br /&gt;       _CallBackString = eventArgument + " " + DateTime.Now.ToShortTimeString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;5. Run the page and test this page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Hope you will like it.&lt;br /&gt;&lt;/head&amp;~~special_remove!#~~gt;&gt;&lt;/html&amp;~~special_remove!#~~gt;&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-1615012977613543435?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/1615012977613543435/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=1615012977613543435" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1615012977613543435?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1615012977613543435?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/x1X9oT7bptE/use-icallbackeventhandler-in-aspnet-20.html" title="Use ICallbackEventHandler in Asp.Net 2.0" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/12/use-icallbackeventhandler-in-aspnet-20.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CkUFRn8yfip7ImA9WB9TGE0.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-1598490771099529303</id><published>2007-09-25T06:22:00.000-07:00</published><updated>2007-09-26T02:50:17.196-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-09-26T02:50:17.196-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Javascript" /><title>Javascript to Allow only numbers in TextBox</title><content type="html">&lt;span style="font-family: trebuchet ms;"&gt;&lt;span style="font-weight: bold;"&gt;Javascript to Allow only numbers in TextBox &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;======================================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt;&lt;br /&gt;function CheckKeyCode(e)&lt;br /&gt;{&lt;br /&gt;if (navigator.appName == "Microsoft Internet Explorer")&lt;br /&gt;{&lt;br /&gt;if((e.keyCode &amp;gt;= 48 &amp;amp;&amp;amp; e.keyCode &amp;lt;= 57) || (e.keyCode == 8))&lt;br /&gt;{&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;if ((e.charCode &amp;gt;= 48 &amp;amp;&amp;amp; e.charCode &amp;lt;= 57) || (e.charCode == 0))&lt;br /&gt;{&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;// Add this code in your GridView control's RowDataBound Event.&lt;br /&gt;&lt;br /&gt;((TextBox)e.Row.FindControl("txtDispOrder")).Attributes.Add("onkeypress", "javascript:return CheckKeyCode(event);");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-1598490771099529303?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/1598490771099529303/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=1598490771099529303" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1598490771099529303?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1598490771099529303?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/E5OeYsCyNZI/javascript-to-allow-only-numbers-in.html" title="Javascript to Allow only numbers in TextBox" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/09/javascript-to-allow-only-numbers-in.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CU8AQHk4fyp7ImA9WB5bFkk.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-2857947866574609492</id><published>2007-09-01T03:44:00.000-07:00</published><updated>2007-09-01T03:50:41.737-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-09-01T03:50:41.737-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Convert a string to Proper Case</title><content type="html">&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Convert a string to Proper Case&lt;br /&gt;===========================&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Use this Namespace&lt;br /&gt;using System.Globalization;&lt;br /&gt;&lt;br /&gt;// Code&lt;br /&gt;string myString = "thIS is tHE sAmple tExt to shoW tHIs examPle !!";&lt;br /&gt;&lt;br /&gt;TextInfo TI = new CultureInfo("en-US",false).TextInfo;&lt;br /&gt;&lt;br /&gt;Response.Write (TI.ToTitleCase( myString ));&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-2857947866574609492?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/2857947866574609492/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=2857947866574609492" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2857947866574609492?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/2857947866574609492?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/adv6kpIx000/convert-string-to-proper-case.html" title="Convert a string to Proper Case" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/09/convert-string-to-proper-case.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUUGSXw4cSp7ImA9WB5bFEg.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-1738689105971234937</id><published>2007-08-29T23:58:00.000-07:00</published><updated>2007-08-30T00:00:28.239-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-30T00:00:28.239-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><category scheme="http://www.blogger.com/atom/ns#" term="Cookie" /><title>Read-Write a Cookie in Asp.Net</title><content type="html">&lt;span style="font-family: trebuchet ms; font-weight: bold;"&gt;Read-Write a Cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms; font-weight: bold;"&gt;==================&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;Write Cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;----------------&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;HttpCookie myCookie = new HttpCookie("UserSettings");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;myCookie["Font"] = "Arial";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;myCookie["Color"] = "Blue";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;myCookie.Expires = DateTime.Now.AddDays(1); // Set the Cookie Expiration Time&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;Response.Cookies.Add(myCookie);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;&lt;br /&gt;Read Cookie&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;---------------&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;if (Request.Cookies["UserSettings"] != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;{&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;    string userSettings;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;    if (Request.Cookies["UserSettings"]["Font"] != null)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;    { &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt; userSettings = Request.Cookies["UserSettings"]["Font"]; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;    }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: trebuchet ms;"&gt;}&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-1738689105971234937?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/1738689105971234937/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=1738689105971234937" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1738689105971234937?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/1738689105971234937?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/Gqh_5u0L3XM/read-write-cookie-in-aspnet.html" title="Read-Write a Cookie in Asp.Net" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/08/read-write-cookie-in-aspnet.html</feedburner:origLink></entry><entry gd:etag="W/&quot;C0EBSXk6cCp7ImA9WB5UF0U.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-6626168809118796762</id><published>2007-08-22T02:39:00.000-07:00</published><updated>2007-08-22T04:20:58.718-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-22T04:20:58.718-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Asp.Net" /><title>Dynamically change web.config file</title><content type="html">&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;Dynamically change web.config file&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;==============================&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;&lt;u&gt;Description&lt;/u&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Suppose you want to remove a handler from 'httpHandlers'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// and you want to remove modules from your 'httpModules'&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// section of you web.config file..&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Below, this is suppose your web.confile file's sections&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;httpHandlers&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &amp;lt;add verb="GET" type="DJ.Blog.FileUpload.UploadProgressHandler, FileUploadLibrary" path="DJUploadProgress.ashx" /&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/httpHandlers&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;httpModules&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt; &amp;lt;add name="DJUpload" type="DJ.Blog.FileUpload.UploadModule, FileUploadLibrary"/&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;&amp;lt;/httpModules&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:trebuchet ms;" &gt;&lt;u&gt;Code&lt;/u&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Now, you want to remove both section from you web.config file.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Using these  Namespaces&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;using System.Configuration;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;using System.Web.Configuration;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Write this code to your page_load() event&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;Configuration objConfig = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;HttpHandlersSection sec = (HttpHandlersSection) objConfig.GetSection("system.web/httpHandlers");&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;sec.Handlers.Remove("GET", "DJUploadProgress.ashx");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;HttpModulesSection sec2 = (HttpModulesSection)objConfig.GetSection("system.web/httpModules");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;sec2.Modules.Remove("DJUpload");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;objConfig.Save();&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:trebuchet ms;"&gt;// Your web.cofig is now changed dynamically.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-6626168809118796762?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/6626168809118796762/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=6626168809118796762" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6626168809118796762?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/6626168809118796762?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/k0cMkHFBvXQ/dynamically-chnage-webconfig-file.html" title="Dynamically change web.config file" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/08/dynamically-chnage-webconfig-file.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkQAQn86fSp7ImA9WB5UFE8.&quot;"><id>tag:blogger.com,1999:blog-8290833250333355662.post-136923477307279436</id><published>2007-08-17T23:39:00.000-07:00</published><updated>2007-08-18T01:05:43.115-07:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2007-08-18T01:05:43.115-07:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Remoting" /><category scheme="http://www.blogger.com/atom/ns#" term="Questions" /><title>.Net Remoting Interview Question</title><content type="html">&lt;div style="font-family: trebuchet ms;"&gt;&lt;br /&gt;&lt;ol type="1"&gt;&lt;li&gt;&lt;b&gt;What’s a Windows process?&lt;br /&gt;&lt;/b&gt;It’s an application that’s running and had been allocated memory.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s typical about a Windows process in regards to memory allocation?&lt;br /&gt;&lt;/b&gt;Each process is allocated its own block of available RAM space, no process can access another process’ code or data. If the process crashes, it dies alone without taking the entire OS or a bunch of other applications down.&lt;a name="more71"&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Explain what relationship is between a Process, Application Domain, and Application?&lt;br /&gt;&lt;/b&gt;A process is an instance of a running application. An application is an executable on the hard drive or network. There can be numerous processes launched of the same application (5 copies of Word running), but 1 process can run just 1 application.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What are possible implementations of distributed applications in .NET?&lt;br /&gt;&lt;/b&gt;.NET Remoting and ASP.NET Web Services. If we talk about the Framework Class Library, noteworthy classes are in System.Runtime.Remoting and System.Web.Services.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;strong&gt;What are the consideration in deciding to use .NET Remoting or ASP.NET Web Services?&lt;br /&gt;&lt;/strong&gt;Remoting is a more efficient communication exchange when you can control both ends of the application involved in the communication process.  Web Services provide an open-protocol-based exchange of informaion.  Web Services are best when you need to communicate with an external organization or another (non-.NET) technology.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s a proxy of the server object in .NET Remoting?&lt;br /&gt;&lt;/b&gt;It’s a fake copy of the server object that resides on the client side and behaves as if it was the server. It handles the communication between real server object and the client object. This process is also known as &lt;b&gt;marshaling&lt;/b&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What are remotable objects in .NET Remoting?&lt;br /&gt;&lt;/b&gt;Remotable objects are the objects that can be marshaled across the application domains. You can marshal by value, where a deep copy of the object is created and then passed to the receiver. You can also marshal by reference, where just a reference to an existing object is passed.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What are channels in .NET Remoting?&lt;br /&gt;&lt;/b&gt;Channels represent the objects that transfer the other serialized objects from one application domain to another and from one computer to another, as well as one process to another on the same box. A channel must exist before an object can be transferred.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What security measures exist for .NET Remoting in System.Runtime.Remoting?&lt;br /&gt;&lt;/b&gt;None. Security should be taken care of at the application level. Cryptography and other security techniques can be applied at application or server level.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What is a formatter?&lt;br /&gt;&lt;/b&gt;A formatter is an object that is responsible for encoding and serializing data into messages on one end, and deserializing and decoding messages into data on the other end.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Choosing between HTTP and TCP for protocols and Binary and SOAP for formatters, what are the trade-offs?&lt;br /&gt;&lt;/b&gt;Binary over TCP is the most effiecient, SOAP over HTTP is the most interoperable.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s SingleCall activation mode used for?&lt;br /&gt;&lt;/b&gt;If the server object is instantiated for responding to just one single request, the request should be made in SingleCall mode.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;What’s Singleton activation mode?&lt;br /&gt;&lt;/b&gt;A single object is instantiated regardless of the number of clients accessing it. Lifetime of this object is determined by lifetime lease.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;How do you define the lease of the object?&lt;br /&gt;&lt;/b&gt;By implementing ILease interface when writing the class code.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Can you configure a .NET Remoting object via XML file?&lt;br /&gt;&lt;/b&gt;Yes, via machine.config and application level .config file (or web.config in ASP.NET). Application-level XML settings take precedence over machine.config.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;b&gt;How can you automatically generate interface for the remotable object in .NET with Microsoft tools?&lt;br /&gt;&lt;/b&gt;Use the Soapsuds tool.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;Abhishek Joshi&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8290833250333355662-136923477307279436?l=abhimjoshi.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel="replies" type="application/atom+xml" href="http://abhimjoshi.blogspot.com/feeds/136923477307279436/comments/default" title="Post Comments" /><link rel="replies" type="text/html" href="http://www.blogger.com/comment.g?blogID=8290833250333355662&amp;postID=136923477307279436" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/136923477307279436?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/8290833250333355662/posts/default/136923477307279436?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/AbhishekJoshi/~3/wEQYIvVJ2jw/net-remoting-interview-question.html" title=".Net Remoting Interview Question" /><author><name>Abhishek M. Joshi</name><uri>http://www.blogger.com/profile/17689909043032999214</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="16" height="16" src="http://img2.blogblog.com/img/b16-rounded.gif" /></author><thr:total>0</thr:total><feedburner:origLink>http://abhimjoshi.blogspot.com/2007/08/net-remoting-interview-question.html</feedburner:origLink></entry></feed>

