tag:blogger.com,1999:blog-4948400512680626982024-03-13T15:01:39.579+05:30My Code LogicAnonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.comBlogger440125tag:blogger.com,1999:blog-494840051268062698.post-34920332228784092702012-06-22T10:42:00.000+05:302012-06-22T10:42:07.196+05:30ToolkitScriptManager On MasterPage To Use AjaxControlToolkit Controls<div dir="ltr" style="text-align: left;" trbidi="on">
<b>How To Add ToolkitScriptManager On MasterPage To Use AjaxControlToolkit Controls On Content Pages In Asp.Net </b><br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx76lw6J956fs4UTiUS-PJvdoNVx-rePPle_ZkXBPxmdu_ayej2kTFG3cA08yCd3LrsWkxQvNlJRt3jPr_VtYjuL4CdEUNgZdfK8cNpAWtOnNhj_jhI-Q1oDZnyCfLb78s27UKAjKY-6nE/s1600/ToolkitScriptManagerWithMasterPage.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Add ToolkitScriptManager On MasterPage In Asp.Net" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhx76lw6J956fs4UTiUS-PJvdoNVx-rePPle_ZkXBPxmdu_ayej2kTFG3cA08yCd3LrsWkxQvNlJRt3jPr_VtYjuL4CdEUNgZdfK8cNpAWtOnNhj_jhI-Q1oDZnyCfLb78s27UKAjKY-6nE/s320/ToolkitScriptManagerWithMasterPage.PNG" /></a></div>
<br />
<br />
When we use <b>AjaxControlToolkit controls </b>on content pages of site
with master page, we get some errors becuase ScriptManager or
ToolkitScriptManager not placed properly on master page.<br />
<br />
One of such error is<br />
<br />
<div class="codeview">
<b><i>"AjaxControlToolkit requires ASP.NET Ajax
4.0 scripts. Ensure the correct version of the scripts are referenced.
If you are using an ASP.NET ScriptManager, switch to the
ToolkitScriptManager in AjaxControlToolkit.dll."</i></b></div>
<br />
This error occurs if you are using .NET framework 3.5 or avobe and have placed ScriptManager on the masterPage.<br />
<br />
To fix this error remove ScriptManager and place ToolkitScriptManager on Master Page.<br />
<br />
<span class="fullpost"><br />
If you receive<br />
<br />
<div class="codeview">
<b><i>"'ToolkitScriptManager' must be placed inside a form tag with runat=server"</i></b> error <br />
<br />
Or <br />
<br />
<b><i>The control with ID 'yourAjaxcontrolID' requires a ScriptManager
on the page. The ScriptManager must appear before any controls that need
it error.</i></b></div>
<br />
Then either you have placed ToolkitScriptManager in head section of MasterPage or in ContentPlaceHolder.<br />
<br />
<b>ToolkitScriptManager must</b> be <b>placed within the form tag</b> of <b>MasterPage</b>.<br />
If you place ToolkitScriptManager on master page as mentioned above, YOu
don't need to put any scriptmanagerproxy or ToolkitScriptManager on
content pages.<br />
<br />
<b>HTML SOURCE OF MASTER PAGE WITH ToolkitScriptManager SHOULD LOOK LIKE SHOWN BELOW</b>
<hr />
<div class="codeview">
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 1: </span><span class="asp"><%@ Master Language="C#" AutoEventWireup="true" </span></pre>
<pre><span class="lnum"> 2: </span>CodeFile="MasterPage.master.cs" Inherits="MasterPage" %></pre>
<pre class="alt"><span class="lnum"> 3: </span> </pre>
<pre><span class="lnum"> 4: </span><span class="asp"><%@ Register assembly="AjaxControlToolkit" </span></pre>
<pre class="alt"><span class="lnum"> 5: </span>namespace="AjaxControlToolkit" tagprefix="asp" %></pre>
<pre><span class="lnum"> 6: </span> </pre>
<pre class="alt"><span class="lnum"> 7: </span><span class="kwrd"><!</span><span class="html">DOCTYPE</span> <span class="attr">html</span> <span class="attr">PUBLIC</span> <span class="kwrd">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> </pre>
<pre><span class="lnum"> 8: </span><span class="kwrd">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></span></pre>
<pre class="alt"><span class="lnum"> 9: </span> </pre>
<pre><span class="lnum"> 10: </span><span class="kwrd"><</span><span class="html">html</span> <span class="attr">xmlns</span><span class="kwrd">="http://www.w3.org/1999/xhtml"></span></pre>
<pre class="alt"><span class="lnum"> 11: </span><span class="kwrd"><</span><span class="html">head</span> <span class="attr">runat</span><span class="kwrd">="server"></span></pre>
<pre><span class="lnum"> 12: </span><span class="kwrd"><</span><span class="html">link</span> <span class="attr">href</span><span class="kwrd">="StyleSheet.css"</span> <span class="attr">rel</span><span class="kwrd">="stylesheet"</span> <span class="attr">type</span><span class="kwrd">="text/css"</span> <span class="kwrd">/></span></pre>
<pre class="alt"><span class="lnum"> 13: </span><span class="kwrd"><</span><span class="html">title</span><span class="kwrd">></span>Using AjaxControlToolkit With MasterPage<span class="kwrd"></</span><span class="html">title</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 14: </span><span class="kwrd"><</span><span class="html">asp:ContentPlaceHolder</span> <span class="attr">id</span><span class="kwrd">="head"</span> <span class="attr">runat</span><span class="kwrd">="server"/></span></pre>
<pre class="alt"><span class="lnum"> 15: </span><span class="kwrd"></</span><span class="html">head</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 16: </span> </pre>
<pre class="alt"><span class="lnum"> 17: </span><span class="kwrd"><</span><span class="html">body</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 18: </span><span class="kwrd"><</span><span class="html">form</span> <span class="attr">id</span><span class="kwrd">="form1"</span> <span class="attr">runat</span><span class="kwrd">="server"></span></pre>
<pre class="alt"><span class="lnum"> 19: </span><span class="kwrd"><</span><span class="html">div</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 20: </span><span class="kwrd"><</span><span class="html">asp:ToolkitScriptManager</span> <span class="attr">ID</span><span class="kwrd">="ToolkitScriptManager1"</span> </pre>
<pre class="alt"><span class="lnum"> 21: </span> <span class="attr">runat</span><span class="kwrd">="server"></span></pre>
<pre><span class="lnum"> 22: </span><span class="kwrd"></</span><span class="html">asp:ToolkitScriptManager</span><span class="kwrd">></span> </pre>
<pre class="alt"><span class="lnum"> 23: </span> </pre>
<pre><span class="lnum"> 24: </span><span class="kwrd"><</span><span class="html">asp:ContentPlaceHolder</span> <span class="attr">id</span><span class="kwrd">="ContentPlaceHolder1"</span> </pre>
<pre class="alt"><span class="lnum"> 25: </span> <span class="attr">runat</span><span class="kwrd">="server"></span></pre>
<pre><span class="lnum"> 26: </span><span class="kwrd"></</span><span class="html">asp:ContentPlaceHolder</span><span class="kwrd">></span></pre>
<pre class="alt"><span class="lnum"> 27: </span><span class="kwrd"></</span><span class="html">div</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 28: </span><span class="kwrd"><</span><span class="html">p</span> <span class="attr">style</span><span class="kwrd">="text-align: center"></span>master page<span class="kwrd"></</span><span class="html">p</span><span class="kwrd">></span></pre>
<pre class="alt"><span class="lnum"> 29: </span>Place your master page contents here </pre>
<pre><span class="lnum"> 30: </span><span class="kwrd"></</span><span class="html">form</span><span class="kwrd">></span></pre>
<pre class="alt"><span class="lnum"> 31: </span><span class="kwrd"></</span><span class="html">body</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 32: </span><span class="kwrd"></</span><span class="html">html</span><span class="kwrd">></span></pre>
</div>
</div>
<br />
<b>HTML SOURCE OF CONTENT PAGES WITH AJAX CONTROLS SHOULD LOOK LIKE MENTIONED BELOW</b>
<hr />
<div class="codeview">
<div class="csharpcode">
<pre class="alt"><span class="lnum"> 1: </span><span class="asp"><%@ Page Title="" Language="C#" </span></pre>
<pre><span class="lnum"> 2: </span>MasterPageFile="~/MasterPage.master" </pre>
<pre class="alt"><span class="lnum"> 3: </span>AutoEventWireup="true" CodeFile="Default2.aspx.cs" </pre>
<pre><span class="lnum"> 4: </span>Inherits="Default2" %></pre>
<pre class="alt"><span class="lnum"> 5: </span> </pre>
<pre><span class="lnum"> 6: </span><span class="asp"><%@ Register Assembly="AjaxControlToolkit" </span></pre>
<pre class="alt"><span class="lnum"> 7: </span>Namespace="AjaxControlToolkit" TagPrefix="asp" %></pre>
<pre><span class="lnum"> 8: </span> </pre>
<pre class="alt"><span class="lnum"> 9: </span><span class="kwrd"><</span><span class="html">asp:Content</span> <span class="attr">ID</span><span class="kwrd">="Content1"</span> <span class="attr">ContentPlaceHolderID</span><span class="kwrd">="head"</span> </pre>
<pre><span class="lnum"> 10: </span> <span class="attr">Runat</span><span class="kwrd">="Server"></span></pre>
<pre class="alt"><span class="lnum"> 11: </span><span class="kwrd"></</span><span class="html">asp:Content</span><span class="kwrd">></span></pre>
<pre><span class="lnum"> 12: </span> </pre>
<pre class="alt"><span class="lnum"> 13: </span><span class="kwrd"><</span><span class="html">asp:Content</span> <span class="attr">ID</span><span class="kwrd">="Content2"</span> </pre>
<pre><span class="lnum"> 14: </span> <span class="attr">ContentPlaceHolderID</span><span class="kwrd">="ContentPlaceHolder1"</span> </pre>
<pre class="alt"><span class="lnum"> 15: </span> <span class="attr">Runat</span><span class="kwrd">="Server"></span></pre>
<pre><span class="lnum"> 16: </span> </pre>
<pre class="alt"><span class="lnum"> 17: </span><span class="kwrd"><</span><span class="html">asp:TextBox</span> <span class="attr">ID</span><span class="kwrd">="TextBox1"</span> <span class="attr">runat</span><span class="kwrd">="server"/></span></pre>
<pre><span class="lnum"> 18: </span><span class="kwrd"><</span><span class="html">asp:PasswordStrength</span> <span class="attr">ID</span><span class="kwrd">="PasswordStrength1"</span> </pre>
<pre class="alt"><span class="lnum"> 19: </span> <span class="attr">runat</span><span class="kwrd">="server"</span> </pre>
<pre><span class="lnum"> 20: </span> <span class="attr">TargetControlID</span><span class="kwrd">="TextBox1"</span> </pre>
<pre class="alt"><span class="lnum"> 21: </span> <span class="attr">DisplayPosition</span><span class="kwrd">="RightSide"</span></pre>
<pre><span class="lnum"> 22: </span> <span class="attr">StrengthIndicatorType</span><span class="kwrd">="BarIndicator"</span> </pre>
<pre class="alt"><span class="lnum"> 23: </span> <span class="attr">BarBorderCssClass</span><span class="kwrd">="BarBorder"</span></pre>
<pre><span class="lnum"> 24: </span> <span class="attr">StrengthStyles</span><span class="kwrd">="BarIndicatorweak;</span></pre>
<pre class="alt"><span class="lnum"> 25: </span> BarIndicatoraverage;BarIndicatorgood;"<span class="kwrd">></span></pre>
<pre><span class="lnum"> 26: </span><span class="kwrd"></</span><span class="html">asp:PasswordStrength</span><span class="kwrd">></span></pre>
<pre class="alt"><span class="lnum"> 27: </span> </pre>
<pre><span class="lnum"> 28: </span><span class="kwrd"></</span><span class="html">asp:Content</span><span class="kwrd">></span></pre>
</div>
</div>
<br />
Hope this helps </span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-1520419228355887352012-04-12T10:49:00.000+05:302012-04-12T10:49:24.458+05:30Application to speak the text in the textbox using C#.Net<div dir="ltr" style="text-align: left;" trbidi="on">
<div align="justify">
<span style="font-size: x-small;"><b>Design:</b><br />
<br />
<img alt="textspeaker1.JPG" border="0" height="240" src="http://www.c-sharpcorner.com/UploadFile/e628d9/application-to-speak-the-text-in-the-textbox-using-C-Sharp-net/Images/textspeaker1.JPG" width="345" /><br />
<br />
Design the form as shown above with one TextBox and three Buttons, Set the 'textBox1' Properties as follows:<br />
<br />
Dock: Top,<br />
<br />
Multiline: True.<br />
<br />
Now goto 'Project' Menu -> Select 'AddReference'-> Click on 'COM' tab.<br />
<br />
Select 'Microsoft Speech Object Library' COM component -> OK<br />
<br />
<img alt="textspeaker2.JPG" border="0" height="395" src="http://www.c-sharpcorner.com/UploadFile/e628d9/application-to-speak-the-text-in-the-textbox-using-C-Sharp-net/Images/textspeaker2.JPG" width="470" /><br />
<br />
Now goto code window and include 'using SpeechLib' namespace<br />
<br />
<b>Code:</b> </span><span style="color: blue; font-family: verdana; font-size: 10pt;"><br />
<br />
using</span><span style="font-family: verdana; font-size: 10pt;"> System;</span><span style="color: blue; font-family: verdana; font-size: 10pt;"><br />
using</span><span style="font-family: verdana; font-size: 10pt;"> System.Windows.Forms;</span><span style="color: blue; font-family: verdana; font-size: 10pt;"><br />
using</span><span style="font-family: verdana; font-size: 10pt;"> SpeechLib;//include this namespace</span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: verdana; font-size: 10pt;">namespace</span><span style="font-family: verdana; font-size: 10pt;"> TextSpeaker<br />
{<br />
<span style="color: blue;">public</span> <span style="color: blue;">partialclass</span> <span style="color: #2b91af;">TextSpeakerForm</span> : <span style="color: #2b91af;">Form</span><br />
{<br />
<span style="color: blue;">public</span> TextSpeakerForm()<br />
{<br />
InitializeComponent();<br />
}</span></div>
<div class="MsoNormal">
<span style="font-family: verdana; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">void</span> btnSpeak_Click(<span style="color: blue;">object</span> sender,<span style="color: #2b91af;">EventArgs</span> e)<br />
{<br />
<span style="color: blue;">if</span> (textBox1.Text.Trim().Length > 0)<br />
{<br />
<span style="color: #2b91af;">SpVoice</span> obj = <span style="color: blue;">new</span><span style="color: #2b91af;">SpVoice</span>();<br />
obj.Speak(textBox1.Text, <span style="color: #2b91af;">SpeechVoiceSpeakFlags</span>.SVSFDefault);<br />
}<br />
<span style="color: #2b91af;">MessageBox</span>.Show(<span style="color: #a31515;">"Plz. write some text in the TextBox"</span>,<span style="color: #a31515;">"Info."</span>,<span style="color: #2b91af;">MessageBoxButtons</span>.OK,<span style="color: #2b91af;">MessageBoxIcon</span>.Information);<br />
}</span></div>
<div class="MsoNormal">
<span style="font-family: verdana; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">void</span> btnClear_Click(<span style="color: blue;">object</span> sender,<span style="color: #2b91af;">EventArgs</span> e)<br />
{<br />
textBox1.Text = <span style="color: #a31515;">""</span>;<br />
}</span></div>
<div class="MsoNormal">
<span style="font-family: verdana; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">void</span> btnExit_Click(<span style="color: blue;">object</span> sender,<span style="color: #2b91af;">EventArgs</span> e)<br />
{<br />
<span style="color: blue;">this</span>.Close();<br />
}<br />
}<br />
}</span><span style="font-size: x-small;"><br />
<br />
<b>Output:</b><br />
<br />
Write some text in the textbox and press 'speak' button<br />
<br />
<img alt="textspeaker3.JPG" border="0" height="241" src="http://www.c-sharpcorner.com/UploadFile/e628d9/application-to-speak-the-text-in-the-textbox-using-C-Sharp-net/Images/textspeaker3.JPG" width="348" /></span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-91755001983941213472012-02-22T22:32:00.000+05:302012-02-22T22:32:09.045+05:30Ajax Asp.Net PasswordStrength Example | My Code Logic<a href="http://www.mycodelogic.blogspot.in/2012/01/ajax-aspnet-passwordstrength-example.html">Ajax Asp.Net PasswordStrength Example | My Code Logic</a>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-20668955233928931852012-01-18T15:56:00.000+05:302012-01-18T15:56:06.757+05:30Ajax Asp.Net PasswordStrength Example<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihsD4kSHhF7S3KbGI354Scgg_2zJ8GiAbqz2KPtO9wny0zsLblckSny1sjCW-ycIJvMfqNk8aF4561evPBc8DHxI9Xpu4ru-mPZmiuu-r8zrEIM37cCrlIUOcPK2OqbchU5Sqr01lftcep/s300/PasswordStrength.gif" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Passwordstrength ajax asp.net" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihsD4kSHhF7S3KbGI354Scgg_2zJ8GiAbqz2KPtO9wny0zsLblckSny1sjCW-ycIJvMfqNk8aF4561evPBc8DHxI9Xpu4ru-mPZmiuu-r8zrEIM37cCrlIUOcPK2OqbchU5Sqr01lftcep/s300/PasswordStrength.gif" /></a></div>
<b>PasswordStrength Example using Ajax In Asp.Net.</b><br />
<br />
In this example i'm explaining how to use PasswordStrength Control of AjaxControlToolkit for asp.net 3.5.<br />
<br />
For this Add latest version of <b>AjaxControlToolkit.dll</b> in BIN folder of application and place one textbox and passwordstrength control on the aspx page.<br />
<br />
Add below mentioned CSS style in stylesheet.css for strength bar to show up.<br />
<br />
<span class="fullpost"><br />
<br />
<div class="codeview">
<b>CSS StyleSheet</b></div>
</span><br /><pre>.BarIndicatorweak
{
color:Red;
background-color:Red;
}
.BarIndicatoraverage
{
color:Blue;
background-color:Blue;
}
.BarIndicatorgood
{
color:Green;
background-color:Green;
}
.BarBorder
{
border-style:solid;
border-width:1px;
padding:2px 2px 2px 2px;
width:200px;
vertical-align:middle;
}</pre>
<span class="fullpost">
<b>Now configure the passwordstrength control as shown below.</b><br />
<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd"><</span><span class="html">form</span> <span class="attr">id</span><span class="kwrd">="form1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">div</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">asp:ToolkitScriptManager</span> <span class="attr">ID</span><span class="kwrd">="ToolkitScriptManager1"</span>
<span class="attr">runat</span><span class="kwrd">="server"</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">asp:ToolkitScriptManager</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">asp:TextBox</span> <span class="attr">ID</span><span class="kwrd">="TextBox1"</span> <span class="attr">runat</span><span class="kwrd">="server"</span>
<span class="attr">TextMode</span><span class="kwrd">="Password"</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">asp:TextBox</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">br</span> <span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">asp:PasswordStrength</span> <span class="attr">ID</span><span class="kwrd">="PasswordStrength1"</span>
<span class="attr">runat</span><span class="kwrd">="server"</span>
<span class="attr">TargetControlID</span><span class="kwrd">="TextBox1"</span>
<span class="attr">RequiresUpperAndLowerCaseCharacters</span><span class="kwrd">="true"</span>
<span class="attr">MinimumNumericCharacters</span><span class="kwrd">="1"</span>
<span class="attr">MinimumSymbolCharacters</span><span class="kwrd">="1"</span>
<span class="attr">MinimumUpperCaseCharacters</span><span class="kwrd">="1"</span>
<span class="attr">PreferredPasswordLength</span><span class="kwrd">="8"</span>
<span class="attr">DisplayPosition</span><span class="kwrd">="RightSide"</span>
<span class="attr">StrengthIndicatorType</span><span class="kwrd">="Text"</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">asp:PasswordStrength</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">br</span> <span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">br</span> <span class="kwrd">/></span>
<span class="kwrd"><</span><span class="html">asp:TextBox</span> <span class="attr">ID</span><span class="kwrd">="TextBox2"</span> <span class="attr">runat</span><span class="kwrd">="server"</span>
<span class="attr">TextMode</span><span class="kwrd">="Password"</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">asp:TextBox</span><span class="kwrd">></span>
<span class="kwrd"><</span><span class="html">asp:PasswordStrength</span> <span class="attr">ID</span><span class="kwrd">="PasswordStrength2"</span>
<span class="attr">runat</span><span class="kwrd">="server"</span>
<span class="attr">TargetControlID</span><span class="kwrd">="TextBox2"</span>
<span class="attr">RequiresUpperAndLowerCaseCharacters</span><span class="kwrd">="true"</span>
<span class="attr">MinimumNumericCharacters</span><span class="kwrd">="1"</span>
<span class="attr">MinimumSymbolCharacters</span><span class="kwrd">="1"</span>
<span class="attr">MinimumUpperCaseCharacters</span><span class="kwrd">="1"</span>
<span class="attr">PreferredPasswordLength</span><span class="kwrd">="8"</span>
<span class="attr">DisplayPosition</span><span class="kwrd">="RightSide"</span>
<span class="attr">StrengthIndicatorType</span><span class="kwrd">="BarIndicator"</span>
<span class="attr">BarBorderCssClass</span><span class="kwrd">="BarBorder"</span>
<span class="attr">StrengthStyles</span><span class="kwrd">="BarIndicatorweak;BarIndicatoraverage;BarIndicatorgood;"</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">asp:PasswordStrength</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">div</span><span class="kwrd">></span>
<span class="kwrd"></</span><span class="html">form</span><span class="kwrd">></span></pre>
</div>
<br />
Build and run the application. <br />
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-49931988509316238462012-01-18T15:51:00.000+05:302012-01-18T15:51:06.741+05:30Add License Agreement In Visual Studio Setup Project<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY8LUhIlZ6qOGme4wGfUkzk2LSQrKQpqgb68lglGt019JfsnixHGrr-TRgtchpSOidSVfTXKdGE4N0iK3B2x6uEquYdyXXd7Kam4gtbXLGGs7REWsqOfX0L3j4zCegRchW32QVW8-5nm0n/s1600/LicenceAgreementInSetupProject.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Add License agreement in setup project" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhY8LUhIlZ6qOGme4wGfUkzk2LSQrKQpqgb68lglGt019JfsnixHGrr-TRgtchpSOidSVfTXKdGE4N0iK3B2x6uEquYdyXXd7Kam4gtbXLGGs7REWsqOfX0L3j4zCegRchW32QVW8-5nm0n/s320/LicenceAgreementInSetupProject.PNG" /></a></div>
<b>Add License Agreement In Setup Project using Visual Studio</b><br />
<br />
In this post i am explaining steps to add license agreement dialog in visual studio setup project.<br />
<br />
Read <b><i><a href="http://csharpdotnetfreak.blogspot.com/2011/08/create-setup-project-visual-studio.html">Create Setup And Deployment Project in Visual Studio 2008/2010</a></i></b> to know how to create setup for your winforms or asp.net applications.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span class="fullpost"><br />
<br />
<div class="codeview">
<b>step 1.</b></div>
<br />
<b>First of all we need to create a licence agreement file, for this
open wordpad and type your licence agreement text and save it as
licence.rtf.</b><br />
<br />
<b>Add this file in your project in solution explorer by select add existing item menu.</b><br />
<br />
<br />
<div class="codeview">
<b>Step 2.</b></div>
<br />
<b>Right click on your setup project and select View > File System.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFV7xyhgB_zd3jf6erN3HMmIqyLO3meGZ83AMXCpgpLiuNAcbFjBIf_zJ3J7QkNzLKRlt6YsPrAcI9ajCD2Hw78TWOYjkHjnoqk-7TqjFFMpaxlrCcJsRbiPlfjRLKwf8Lx0PF0TJ0QkPP/s1600/licenceAgreement.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="license agreement in visual studio setupproject" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgFV7xyhgB_zd3jf6erN3HMmIqyLO3meGZ83AMXCpgpLiuNAcbFjBIf_zJ3J7QkNzLKRlt6YsPrAcI9ajCD2Hw78TWOYjkHjnoqk-7TqjFFMpaxlrCcJsRbiPlfjRLKwf8Lx0PF0TJ0QkPP/s320/licenceAgreement.PNG" /></a></div>
<br />
<div class="codeview">
<b>Step 3.</b></div>
<br />
<b>Right click on Application folder and select Add > File</b>.<br />
<br />
<b>Browse to licence.rtf we added to solution in step 1.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6v7VVuRkWWKAc1IKF6mFBAMYHK3ySCrvHor47z4oRinYknc8Xyswr9DdCHqTMjlvsZIXHOv3250mGon7zYa-K83N44JR4DDdoK0RN6ZCZ5x7zBwFIA4qGIk9DBE00UzkrV3CJ9tk4kwBQ/s1600/AddLicenceRtf.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="Add license.rtf file" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6v7VVuRkWWKAc1IKF6mFBAMYHK3ySCrvHor47z4oRinYknc8Xyswr9DdCHqTMjlvsZIXHOv3250mGon7zYa-K83N44JR4DDdoK0RN6ZCZ5x7zBwFIA4qGIk9DBE00UzkrV3CJ9tk4kwBQ/s320/AddLicenceRtf.PNG" /></a></div>
<br />
<div class="codeview">
<b>Step 4.</b></div>
<br />
<b>Right click on setup project in solution explorer and select View > User Interface.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6NzWxQBjN8XVyf8YAo7N4pyiDhaX4OAMmBN2Gan1bhbuIX8iR0_RNEcfVD1a0MZhcbmL3NOAOvL5_FEQ6XQY7OkfWiG1aqReFbcWwhxWEfQC0PksU94ZP89oUo6kLSRg2fyp_IfDfJWf1/s1600/UserInterface.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="UserInterface in setupproject" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6NzWxQBjN8XVyf8YAo7N4pyiDhaX4OAMmBN2Gan1bhbuIX8iR0_RNEcfVD1a0MZhcbmL3NOAOvL5_FEQ6XQY7OkfWiG1aqReFbcWwhxWEfQC0PksU94ZP89oUo6kLSRg2fyp_IfDfJWf1/s320/UserInterface.PNG" /></a></div>
<br />
<div class="codeview">
<b>Step 5.</b></div>
<br />
<b>Right click on Start and select Add Dialog.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHJvODpJwGBwyhFA4bVwrQauPx2MhSRHHXM1MmAxOSl5xYn_QU2duzyI1_0vo7KRwn8RztlOZ_hv7CXo7WyC7H9mhdIkuqeYxahWNZ7Wp34zRb1nVkH8edDKwHwgjLIkxrO3W9Lr1qQsAk/s1600/AddDialog.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="Add dialog in setup project" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjHJvODpJwGBwyhFA4bVwrQauPx2MhSRHHXM1MmAxOSl5xYn_QU2duzyI1_0vo7KRwn8RztlOZ_hv7CXo7WyC7H9mhdIkuqeYxahWNZ7Wp34zRb1nVkH8edDKwHwgjLIkxrO3W9Lr1qQsAk/s320/AddDialog.PNG" /></a></div>
<br />
<b>Select Licence agreement and click on OK. </b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_mjSDE0OqDgsxfq4Od3cdHYeoZ9UZ-anYO0JYRLts3Mes2GmE9SJuYR-26RGolq5IhdxXMvjX7FwsVlH7RjCZMO62kFHgWqHNhgWtstqx43TVboquiInXLcqzath7Fxzu_5UPgw4Xa4rP/s1600/LicenceAgreementDialog.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="License agreement dialog in setup project" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg_mjSDE0OqDgsxfq4Od3cdHYeoZ9UZ-anYO0JYRLts3Mes2GmE9SJuYR-26RGolq5IhdxXMvjX7FwsVlH7RjCZMO62kFHgWqHNhgWtstqx43TVboquiInXLcqzath7Fxzu_5UPgw4Xa4rP/s320/LicenceAgreementDialog.PNG" /></a></div>
<br />
<b>Move it Up by right clicking and selecting Move Up to put it on the top to show up when setup starts.</b><br />
<br />
<div class="codeview">
<b>Step 6.</b></div>
<br />
<b>Select Licence Agreement dialog in start group and open it's property window by pressing F4 key.<br />
</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSiagRCoS-d7HN_tUl1DKmhVgGuAjLH95QgQUzRpGvfshaGIix0UOkaRBcPM3-5aWaim6KadDRZZ0hyphenhyphenT2hEDZGyDuXOJGDEQt59ObytaA9MA0QLqKVC7a697pl6iOpi6X6dryI9tbuBze/s1600/licencefile.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSiagRCoS-d7HN_tUl1DKmhVgGuAjLH95QgQUzRpGvfshaGIix0UOkaRBcPM3-5aWaim6KadDRZZ0hyphenhyphenT2hEDZGyDuXOJGDEQt59ObytaA9MA0QLqKVC7a697pl6iOpi6X6dryI9tbuBze/s320/licencefile.PNG" /></a></div>
<br />
<b>Click on Browse in LicenceFile property and select licence.rtf file from Application Folder and click on OK.</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRdllSidF9CnLh8u8LNzD2nAn4gtxFFiLqoUNOHTumCMKLl0hDPJtT4PhL3U6DiLfGMspylt45t3OEgUIEPmQAnwVrjuYMOvRlVvR5i0jPSZ7db4k3Tf24rYj_7sFPFfyk9odH5OwSzjFl/s1600/LicenceFileBrowse.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img alt="add licence.rtf to license agreement dialog" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhRdllSidF9CnLh8u8LNzD2nAn4gtxFFiLqoUNOHTumCMKLl0hDPJtT4PhL3U6DiLfGMspylt45t3OEgUIEPmQAnwVrjuYMOvRlVvR5i0jPSZ7db4k3Tf24rYj_7sFPFfyk9odH5OwSzjFl/s320/LicenceFileBrowse.PNG" /></a></div>
<br />
<b>Save and build the setup project and licence agreement dialog will launch when you run setup.exe (as shown below).</b><br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJsus6Ah6H8_YM79xSCxyvzTcaOvQ7J8n7fpoIDYRdbn4Kd7b1p5ELNUuVheKh0simEZcF9zskl2Th8XpvV-4HPDYq3M8ihMiliH5mXU1Ip-PiYCeTSK65JBSkwtQdbautjEtSR8BdOJtE/s1600/Result.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiJsus6Ah6H8_YM79xSCxyvzTcaOvQ7J8n7fpoIDYRdbn4Kd7b1p5ELNUuVheKh0simEZcF9zskl2Th8XpvV-4HPDYq3M8ihMiliH5mXU1Ip-PiYCeTSK65JBSkwtQdbautjEtSR8BdOJtE/s320/Result.PNG" /></a></div>
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-78074701022350866322011-12-31T01:25:00.001+05:302011-12-31T10:41:07.986+05:30URL Rewriting for ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
<div>
<div id="pretty" style="-webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; background-color: white; color: #333333; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: 12px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; width: 640px; word-spacing: 0px;">
<div style="margin-left: 20px; text-align: justify;">
<br />
<div id="pretty" style="font-family: arial; font-size: 13px; text-align: left; width: 640px;">
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
This article describes a complete solution for URL rewriting in ASP.NET 2.0. The solution uses regular expressions to specify rewriting rules and resolves possible difficulties with postback from pages accessed via virtual URLs.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Why use URL rewriting?</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
The two main reasons to incorporate URL rewriting capabilities into your ASP.NET applications are usability and maintainability.</div>
<h3 style="font-family: 'Times New Roman', Times, serif; font-size: 15px; margin-left: 40px;">
Usability</h3>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
It is well-known that users of web applications prefer short, neat URLs to monstrous addresses packed with difficult to comprehend query string parameters. From time to time, being able to remember and type in a concise URL is less time-consuming than adding the page to a browser's favorites to access later. Again, when access to a browser's favorites is unavailable, it can be more convenient to type in the URL of a page on the browser address bar, without having to remember a few keywords and type them into a search engine in order to find the page.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Compare the following two addresses and decide which one you like more:</div>
<ol>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;"><strong>http://www.somebloghost.com/Blogs/Posts.aspx?Year=2006&Month=12&Day=10</strong></li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;"><strong>http://www. somebloghost.com/Blogs/2006/12/10/</strong></li>
</ol>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
The first URL contains query string parameters to encode the date for which some blog engines should show available postings. The second URL contains this information in the address, giving the user a clear idea of what he or she is going to see. The second address also allows the user to hack the URL to see all postings available in December, simply by removing the text encoding the day '10': <strong>http://www.somehost.com/Blogs/2006/12/</strong>.</div>
<h3 style="font-family: 'Times New Roman', Times, serif; font-size: 15px; margin-left: 40px;">
Maintainability</h3>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
In large web applications, it is common for developers to move pages from one directory to another. Let us suppose that support information was initially available at <strong>http://www.somebloghost.com/Info/Copyright.aspx</strong> and<strong>http://www.somebloghost.com/Support/Contacts.aspx</strong>, but at a later date the developers moved the<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Copyright.aspx</span> and <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Contacts.aspx</span> pages to a new folder called <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Help</span>. Users who have bookmarked the old URLs need to be redirected to the new location. This issue can be resolved by adding simple dummy pages containing calls to<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Response.Redirect</span>(<i>new location</i>). However, what if there are hundreds of moved pages all over the application directory? The web project will soon contain too many useless pages that have the sole purpose of redirecting users to a new location.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Enter URL rewriting, which allows a developer to move pages between virtual directories just by editing a configuration file. In this way, the developer can separate the physical structure of the website from the logical structure available to users via URLs.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Native URL mapping in ASP.NET 2.0</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
ASP.NET 2.0 provides an out-of-the-box solution for mapping static URLs within a web application. It is possible to map old URLs to new ones in web.config without writing any lines of code. To use URL mapping, just create a new <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">urlMappings</span>section within the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">system.web</span> section of your <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file and add the required mappings (the path <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">~/</span> points to the root directory of the web application):</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">urlMappings</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">enabled</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">"<span style="color: blue;">true</span>"<span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">add</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">url</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">"<span style="color: blue;">~/Info/Copyright.aspx</span>"<span style="color: blue;"> </span><span style="color: red;">mappedUrl</span><span style="color: blue;">=</span>"<span style="color: blue;">~/Help/Copyright.aspx</span>"<span style="color: blue;"> /></span></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">add</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">url</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">"<span style="color: blue;">~/Support/Contacts.aspx</span>"<span style="color: blue;"> </span><span style="color: red;">mappedUrl</span><span style="color: blue;">=</span>"<span style="color: blue;">~/Help/Contacts.aspx</span>"<span style="color: blue;"> /></span></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"></</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">urlMappings</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">></span><span lang="EN-US" style="font-family: Calibri;"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Thus, if a user types <strong>http://www.somebloghost.com/Support/Contacts.aspx</strong>, he can then see the page located at<strong>http://www.somebloghost.com/Help/Contacts.aspx</strong>, without even knowing the page had been moved.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
This solution is fine if you have only two pages that have been moved to other locations, but it is completely unsuitable where there are dozens of re-located pages, or where a really neat URL needs to be created.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px;">
Another possible disadvantage of the native URL mapping technique is that if the page <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Contacts.aspx</span> contains elements initiating postback to the server (which is most probable), then the user will be surprised that the URL<strong>http://www.somebloghost.com/Support/Contacts.aspx</strong> changes to<strong>http://www.somebloghost.com/Help/Contacts.aspx</strong>. This happens because the ASP.NET engine fills the <i>action</i>attribute of the <i>form</i> HTML tag with the actual path to a page. So the form renders like this:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">form</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> <span style="color: red;">name</span><span style="color: blue;">="formTest"</span> <span style="color: red;">method</span><span style="color: blue;">="post"</span><span style="color: red;">action</span><span style="color: blue;">="http://www.simple-talk.com/Help/Contacts.aspx" </span><span style="color: red;">id</span><span style="color: blue;">="formTest"></span></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"></</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">form</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Thus, URL mapping available in ASP.NET 2.0 is almost always useless. It would be much better to be able to specify a set of similar URLs in one mapping rule. The best solution is to use Regular Expressions (for overview see <a href="http://en.wikipedia.org/wiki/Regular_expression" style="color: #cc6633; text-decoration: none;">Wikipedia</a> and for implementation in .NET see <a href="http://msdn2.microsoft.com/en-us/library/ms972966.aspx" style="color: #cc6633; text-decoration: none;">MSDN</a> ), but an ASP.NET 2.0 mapping does not support regular expressions. We therefore need to develop a different solution to built-in URL mapping.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
The URL rewriting module </h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
The best way to implement a URL rewriting solution is to create reusable and easily configurable modules, so the obvious decision is to create an HTTP Module (for details on HTTP Modules see <a href="http://msdn.microsoft.com/msdnmag/issues/02/05/asp/" style="color: #cc6633; text-decoration: none;">MSDN Magazine</a> ) and implement it as an individual assembly. To make this assembly as easy to use as possible, we need to implement the ability to configure the rewrite engine and specify rules in a <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
During the development process we need to be able to turn the rewriting module on or off (for example if you have a bug that is difficult to catch, and which may have been caused by incorrect rewriting rules). There should, therefore, be an option in the rewriting module configuration section in <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> to turn the module on or off. So, a sample configuration section within <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> can go like this:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteModule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteOn</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">true<span style="color: blue;"></</span><span style="color: #a31515;">rewriteOn</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteRules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">source</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">(\d+)/(\d+)/(\d+)/</span>"<span style="color: blue;"><br /> </span><span style="color: red;">destination</span><span style="color: blue;">=</span>"<span style="color: blue;">Posts.aspx?Year=$1</span><span style="color: red;">&amp;</span><span style="color: blue;">Month=$2</span><span style="color: red;">&amp;</span><span style="color: blue;">Day=$3</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">source</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">(.*)/Default.aspx</span>"<span style="color: blue;"><br /> </span><span style="color: red;">destination</span><span style="color: blue;">=</span>"<span style="color: blue;">Default.aspx?Folder=$1</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteRules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"></</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">rewriteModule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">></span><span lang="EN-US"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
This means that all requests that run like: <strong>http://localhost/Web/2006/12/10/</strong> should be internally redirected to the page<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Posts.aspx</span> with query string parameters.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Please note that <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> is a well-formed XML file, and it is prohibited to use the symbol <b><span class="CodeInText" style="font-family: 'courier new', courier, monospaced;">&</span></b> in attribute value strings. In this case, you should use <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">&amp</span>; instead in the destination attribute of the rule element.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To use the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">rewriteModule</span> section in the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file, you need to register a section name and a section handler for this section. To do this, add a <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">configSections</span> section to <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span>:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">configSections</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span><div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">sectionGroup</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">name</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">modulesSection</span>"<span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">section</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">name</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">rewriteModule</span>"<span style="color: blue;"> </span><span style="color: red;">type</span><span style="color: blue;">=</span>"<span style="color: blue;">RewriteModule.<br />RewriteModuleSectionHandler, RewriteModule</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">sectionGroup</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">configSections</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">></span><span lang="EN-US"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
This means you may use the following section below the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">configSections</span> section:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">modulesSection</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteModule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteOn</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">true<span style="color: blue;"></</span><span style="color: #a31515;">rewriteOn</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteRules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">source</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">(\d+)/(\d+)/(\d+)/</span>"<span style="color: blue;"><br /></span><span style="color: red;">destination</span><span style="color: blue;">=</span>"<span style="color: blue;">Post.aspx?Year=$1</span><span style="color: red;">&amp;</span><span style="color: blue;">Month=$2</span><span style="color: red;">&amp;</span><span style="color: blue;">Day=$3</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> <</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">source</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">(.*)/Default.aspx</span>"<span style="color: blue;"><br /></span><span style="color: red;">destination</span><span style="color: blue;">=</span>"<span style="color: blue;">Default.aspx?Folder=$1</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteRules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">rewriteModule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: 17px; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;"> </</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">modulesSection</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 20px;">></span><span lang="EN-US"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px;">
Another thing we have to bear in mind during the development of the rewriting module is that it should be possible to use 'virtual' URLs with query string parameters, as shown in the following: <strong>http://www.somebloghost.com/2006/12/10/?Sort=Desc&SortBy=Date</strong>. Thus we have to develop a solution that can detect parameters passed via query string and also via virtual URL in our web application.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov-feb07.gif" title="" /></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
So, let’s start by building a new Class Library. We need to add a reference to the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">System.Web</span> assembly, as we want this library to be used within an ASP.NET application and we also want to implement some web-specific functions at the same time. If we want our module to be able to read <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span>, we need to add a reference to the<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">System.Configuration</span> assembly.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Handling the configuration section</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To be able to read the configuration settings specified in <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span>, we have to create a class that implements the<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">IConfigurationSectionHandler</span> interface (see <a href="http://search.msdn.microsoft.com/search/Redirect.aspx?title=IConfigurationSectionHandler%20Interface&url=http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemConfigurationIConfigurationSectionHandlerClassTopic.asp" style="color: #cc6633; text-decoration: none;">MSDN</a> for details). This can be seen below:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Collections.Generic;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Text;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Configuration;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Web;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Xml;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">namespace</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> RewriteModule</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">RewriteModuleSectionHandler</span> : <span style="color: #2b91af;">IConfigurationSectionHandler</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: #2b91af;">XmlNode</span> _XmlSection;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">string</span> _RewriteBase;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">bool</span> _RewriteOn;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: #2b91af;">XmlNode</span> XmlSection</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span> { <span style="color: blue;">return</span> _XmlSection; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> RewriteBase</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span> { <span style="color: blue;">return</span> _RewriteBase; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">bool</span> RewriteOn</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span> { <span style="color: blue;">return</span> _RewriteOn; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">object</span> Create(<span style="color: blue;">object</span> parent,<br /><span style="color: blue;"> object</span> configContext,<br /> System.Xml.<span style="color: #2b91af;">XmlNode</span> section)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// set base path for rewriting module to</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// application root</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _RewriteBase = <span style="color: #2b91af;">HttpContext</span>.Current.Request.ApplicationPath + <span style="color: #a31515;">"/"</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// process configuration section</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// from web.config</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">try</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _XmlSection = section;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _RewriteOn = <span style="color: #2b91af;">Convert</span>.ToBoolean(<br /> section.SelectSingleNode(<span style="color: #a31515;">"rewriteOn"</span>).InnerText);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">catch</span> (<span style="color: #2b91af;">Exception</span> ex)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">throw</span> (<span style="color: blue;">new</span> <span style="color: #2b91af;">Exception</span>(<span style="color: #a31515;">"Error while processing RewriteModule<br />configuration section."</span>, ex));</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span> <span style="color: blue;">this</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span><span lang="EN-US"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
The Class <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModuleSectionHandler</span> will be initialized by calling the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Create</span> method with the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">rewriteModule</span>section of <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> passed as <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">XmlNode</span>. The <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">SelectSingleNode</span> method of the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">XmlNode</span> class is used to return values for module settings.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Using parameters from rewritten URL</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
When handling virtual URLS such as <strong>http://www. somebloghost.com/Blogs/gaidar/?Sort=Asc</strong> (that is, a virtual URL with query string parameters), it is important that you clearly distinguish parameters that were passed via a query string from parameters that were passed as virtual directories. Using the rewriting rules specified below:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">rule</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">source</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">"<span style="color: blue;">(.*)/Default.aspx</span>"<span style="color: blue;"> </span><span style="color: red;">destination</span><span style="color: blue;">=</span>"<span style="color: blue;">Default.aspx?Folder=$1</span>"<span style="color: blue;">/>,</span></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
You can use the following URL:</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>http://www. somebloghost.com/gaidar/?Folder=Blogs</strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
...and the result will be the same as if you used this URL:</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>http://www. somebloghost.com/Blogs/gaidar/</strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To resolve this issue, we have to create some kind of wrapper for 'virtual path parameters'. This could be a collection with a static method to access the current parameters set:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Collections.Generic;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Text;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Collections.Specialized;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Web;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">namespace</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> RewriteModule</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">RewriteContext</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// returns actual RewriteContext instance for</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// current request</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: #2b91af;">RewriteContext</span> Current</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// Look for RewriteContext instance in</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// current HttpContext. If there is no RewriteContextInfo</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// item then this means that rewrite module is turned off</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span>(<span style="color: #2b91af;">HttpContext</span>.Current.Items.Contains(<span style="color: #a31515;">"RewriteContextInfo"</span>))</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span> (<span style="color: #2b91af;">RewriteContext</span>)<br /><span style="color: #2b91af;">HttpContext</span>.Current.Items[<span style="color: #a31515;">"RewriteContextInfo"</span>];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">else</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span> <span style="color: blue;">new</span> <span style="color: #2b91af;">RewriteContext</span>();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> RewriteContext()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _Params = <span style="color: blue;">new</span> <span style="color: #2b91af;">NameValueCollection</span>();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _InitialUrl = <span style="color: #2b91af;">String</span>.Empty;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> RewriteContext(<span style="color: #2b91af;">NameValueCollection</span> param, <span style="color: blue;">string</span> url)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _InitialUrl = url;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> _Params = <span style="color: blue;">new</span> <span style="color: #2b91af;">NameValueCollection</span>(param);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> </span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: #2b91af;">NameValueCollection</span> _Params;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: #2b91af;">NameValueCollection</span> Params</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span> { <span style="color: blue;">return</span> _Params; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">set</span> { _Params = <span style="color: blue;">value</span>; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">private</span> <span style="color: blue;">string</span> _InitialUrl;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> InitialUrl</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">get</span> { <span style="color: blue;">return</span> _InitialUrl; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">set</span> { _InitialUrl = <span style="color: blue;">value</span>; }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
You can see from the above that it is possible to access 'virtual path parameters' via the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteContext.Current</span>collection and be sure that those parameters were specified in the URL as virtual directories or pages names, and <i>not</i> as query string parameters.</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Rewriting URLs</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Now let's try some rewriting. First, we need to read rewriting rules from the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file. Secondly, we need to check the actual URL against the rules and, if necessary, do some rewriting so that the appropriate page is executed.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
We create an <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">HttpModule</span>:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">class</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">RewriteModule</span> : <span style="color: #2b91af;">IHttpModule</span>{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 35.4pt; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0.05pt;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">public</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> Dispose() { }<br /><span style="color: blue;">public</span> <span style="color: blue;">void</span> Init(<span style="color: #2b91af;">HttpApplication</span> context)</span></div>
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 35.4pt; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0.05pt;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">{}</span></div>
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">}</span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
When adding the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule_BeginRequest</span> method that will process the rules against the given URL, we need to check if the given URL has query string parameters and call <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">HttpContext.Current.RewritePath</span> to give control over to the appropriate ASP.NET page.</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Collections.Generic;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Text;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Web;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Configuration;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Xml;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Text.RegularExpressions;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Web.UI;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.IO;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">using</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> System.Collections.Specialized;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">namespace</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> RewriteModule</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">RewriteModule</span> : <span style="color: #2b91af;">IHttpModule</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> Dispose() { }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> Init(<span style="color: #2b91af;">HttpApplication</span> context)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// it is necessary to</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> context.BeginRequest += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(<br /> RewriteModule_BeginRequest);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> RewriteModule_BeginRequest(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">RewriteModuleSectionHandler</span> cfg =<br />(<span style="color: #2b91af;">RewriteModuleSectionHandler</span>)<br /><span style="color: #2b91af;">ConfigurationManager</span>.GetSection<br />(<span style="color: #a31515;">"modulesSection/rewriteModule"</span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// module is turned off in web.config</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (!cfg.RewriteOn) <span style="color: blue;">return</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">string</span> path = <span style="color: #2b91af;">HttpContext</span>.Current.Request.Path;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// there us nothing to process</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (path.Length == 0) <span style="color: blue;">return</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// load rewriting rules from web.config</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// and loop through rules collection until first match</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">XmlNode</span> rules = cfg.XmlSection.SelectSingleNode(<span style="color: #a31515;">"rewriteRules"</span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">foreach</span> (<span style="color: #2b91af;">XmlNode</span> xml <span style="color: blue;">in</span> rules.SelectNodes(<span style="color: #a31515;">"rule"</span>))</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">try</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">Regex</span> re = <span style="color: blue;">new</span> <span style="color: #2b91af;">Regex</span>(<br /> cfg.RewriteBase + xml.Attributes[<span style="color: #a31515;">"source"</span>].InnerText,<br /> <span style="color: #2b91af;">RegexOptions</span>.IgnoreCase);<br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">Match</span> match = re.Match(path);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (match.Success)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> path = re.Replace(<br /> path,<br /> xml.Attributes[<span style="color: #a31515;">"destination"</span>].InnerText);<br /></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (path.Length != 0)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// check for QueryString parameters</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span>(<span style="color: #2b91af;">HttpContext</span>.Current.Request.QueryString.Count != 0)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// if there are Query String papameters</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// then append them to current path</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">string</span> sign = (path.IndexOf(<span style="color: #a31515;">'?'</span>) == -1) ? <span style="color: #a31515;">"?"</span> : <span style="color: #a31515;">"&"</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> path = path + sign +<br /> <span style="color: #2b91af;">HttpContext</span>.Current.Request.QueryString.ToString();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// new path to rewrite to</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">string</span> rew = cfg.RewriteBase + path;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// save original path to HttpContext for further use</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpContext</span>.Current.Items.Add(</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #a31515;">"OriginalUrl"</span>,</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpContext</span>.Current.Request.RawUrl);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// rewrite</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpContext</span>.Current.RewritePath(rew);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">catch</span> (<span style="color: #2b91af;">Exception</span> ex)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">throw</span> (<span style="color: blue;">new</span> <span style="color: #2b91af;">Exception</span>(<span style="color: #a31515;">"Incorrect rule."</span>, ex));</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">return</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="RU" style="font-family: 'Courier New'; font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
We must then register this method:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">public</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> Init(<span style="color: #2b91af;">HttpApplication</span> context)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> context.BeginRequest += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(RewriteModule_BeginRequest);</span></div>
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">}</span><span lang="EN-US" style="font-size: 10pt; line-height: 15px;"></span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
But this is just half of the road we need to go down, because the rewriting module should handle a web form's postbacks and populate a collection of 'virtual path parameters'. In the given code you will not find a part that does this task. Let's put 'virtual path parameters' aside for a moment. The main thing here is to handle postbacks correctly.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px;">
If we run the code above and look through the HTML source of the ASP.NET page for an action attribute of the form tag, we find that even a virtual URL action attribute contains a path to an actual ASP.NET page. For example, if we are using the page <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">~/Posts.aspx</span> to handle requests like:<strong><br /><br />http://www. somebloghost.com/Blogs/2006/12/10/Default.aspx</strong>,<br /><br />...we find the action="/Posts.aspx". This means that the user will be using not the virtual URL on postback, but the actual one: <strong>http://www. somebloghost.com/Blog.aspx</strong>. This is not what we want to use here! So, a few more lines of code are required to achieve the desired result.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
First, we must register and implement one more method in our <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">HttpModule</span>:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> public</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> Init(<span style="color: #2b91af;">HttpApplication</span> context)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// it is necessary to</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> context.BeginRequest += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(<br /> RewriteModule_BeginRequest);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> context.PreRequestHandlerExecute += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(<br /> RewriteModule_PreRequestHandlerExecute);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">void</span> RewriteModule_PreRequestHandlerExecute(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpApplication</span> app = (<span style="color: #2b91af;">HttpApplication</span>)sender;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> ((app.Context.CurrentHandler <span style="color: blue;">is</span> <span style="color: #2b91af;">Page</span>) &&<br /> app.Context.CurrentHandler != <span style="color: blue;">null</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">Page</span> pg = (<span style="color: #2b91af;">Page</span>)app.Context.CurrentHandler;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> pg.PreInit += <span style="color: blue;">new</span> <span style="color: #2b91af;">EventHandler</span>(Page_PreInit);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
This method checks if the user requested a normal ASP.NET page and adds a handler for the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">PreInit</span> event of the page lifecycle. This is where <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteContext</span> will be populated with actual parameters and a second URL rewriting will be performed. The second rewriting is necessary to make ASP.NET believe it wants to use a virtual path in the action attribute of an HTML form.</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">void</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> Page_PreInit(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// restore internal path to original</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// this is required to handle postbacks</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (<span style="color: #2b91af;">HttpContext</span>.Current.Items.Contains(<span style="color: #a31515;">"OriginalUrl"</span>))</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">string</span> path = (<span style="color: blue;">string</span>)<span style="color: #2b91af;">HttpContext</span>.Current.Items[<span style="color: #a31515;">"OriginalUrl"</span>];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: green;">// save query string parameters to context</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">RewriteContext</span> con = <span style="color: blue;">new</span> <span style="color: #2b91af;">RewriteContext</span>(<br /> <span style="color: #2b91af;">HttpContext</span>.Current.Request.QueryString, path);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpContext</span>.Current.Items[<span style="color: #a31515;">"RewriteContextInfo"</span>] = con;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: blue;">if</span> (path.IndexOf(<span style="color: #a31515;">"?"</span>) == -1)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> path += <span style="color: #a31515;">"?"</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> <span style="color: #2b91af;">HttpContext</span>.Current.RewritePath(path);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;"> }</span></div>
</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Finally, we see three classes in our <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule</span> assembly:</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%282%29-feb07%20%282%29.gif" title="Figure 2" /></div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Registering RewriteModule in web.config</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To use <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule</span> in a web application, you should add a reference to the rewrite module assembly and register<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">HttpModule</span> in the web application <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file. To register <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">HttpModule</span>, open the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file and add the following code into the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">system.web</span> section:</div>
<div class="listing" style="background-color: #f9f9f9; border-bottom-color: rgb(202, 202, 202); border-bottom-style: solid; border-bottom-width: 1px; border-left-color: rgb(202, 202, 202); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(202, 202, 202); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(202, 202, 202); border-top-style: solid; border-top-width: 1px; font-family: 'Courier New', Courier, monospace; font-size: 11px; margin-left: 20px; padding-bottom: 0px; padding-left: 3px; padding-right: 3px; padding-top: 10px;">
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">httpModules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"><</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt;">add</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;"> </span><span lang="EN-US" style="color: red; font-family: 'Courier New'; font-size: 10pt;">name</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt;">=</span><span lang="EN-US" style="font-family: 'Courier New'; font-size: 10pt;">"<span style="color: blue;">RewriteModule</span>"<span style="color: blue;"> </span><span style="color: red;">type</span><span style="color: blue;">=</span>"<span style="color: blue;">RewriteModule.RewriteModule, RewriteModule</span>"<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="margin-bottom: 10pt; margin-left: 0cm; margin-right: 0cm; margin-top: 0cm; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;"></</span><span lang="EN-US" style="color: #a31515; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">httpModules</span><span lang="EN-US" style="color: blue; font-family: 'Courier New'; font-size: 10pt; line-height: 15px;">></span><span lang="EN-US"></span></div>
</div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Using RewriteModule</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
There are a few things you should bear in mind when using <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule</span>:</div>
<ul style="margin-top: 0px;">
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;">It is impossible to use special characters in a well-formed XML document which is <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> in its nature. You should therefore use HTML-encoded symbols instead. For example, use <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">&amp</span>; instead of <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">&</span>.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;">To use relative paths in your ASPX pages, you should call the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">ResolveUrl</span> method inside HTML tags: <span class="ImportantWords" style="font-weight: bold;"><img src="<%=ResolveUrl("~/Images/Test.jpg")%>" /></span>. Note, that ~/ points to the root directory of a web application.</li>
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;">Bear in mind the greediness of regular expressions and put rewriting rules to <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> in order of their greediness, for instance</li>
</ul>
<blockquote dir="ltr" style="font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif; font-size: 12.8px; margin-left: 50px; margin-right: 0px; text-align: justify;">
<div class="listing" style="background-color: white; border-bottom-color: initial; border-bottom-style: initial; border-bottom-width: 0px; border-left-color: initial; border-left-style: initial; border-left-width: 0px; border-right-color: initial; border-right-style: initial; border-right-width: 0px; border-top-color: initial; border-top-style: initial; border-top-width: 0px; font-family: 'Courier New', Courier, monospace; font-size: small; margin-left: 20px; padding-bottom: 10px; padding-left: 3px; padding-right: 3px; padding-top: 10px; text-align: left;">
<rule source="Directory/(.*)/(.*)/(.*)/(.*).aspx"<br />destination="Directory/Item.aspx?<br />Source=$1&amp;Year=$2&amp;ValidTill=$3&amp;Sales=$4"/><br /><rule source="Directory/(.*)/(.*)/(.*).aspx"<br />destination="Directory/Items.aspx?<br />Source=$1&amp;Year=$2&amp;ValidTill=$3"/><br /><rule source="Directory/(.*)/(.*).aspx"<br />destination="Directory/SourceYear.aspx?<br />Source=$1&amp;Year=$2&amp;"/><br /><rule source="Directory/(.*).aspx"<br />destination="Directory/Source.aspx?Source=$1"/></div>
</blockquote>
<ul style="margin-top: 0px;">
<li style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-bottom: 3px; margin-left: 20px; margin-top: 0px; text-align: justify;">If you would like to use <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule</span> with pages other than .aspx, you should configure IIS to map requests to pages with the desired extensions to ASP.NET runtime as described in the next section.</li>
</ul>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
IIS Configuration: using RewriteModule with extensions other than .aspx</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To use a rewriting module with extensions other than .aspx (for example, .html or .xml), you must configure IIS so that these file extensions are mapped to the ASP.NET engine (ASP.NET ISAPI extension). Note that to do so, you have to be logged in as an Administrator.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Open the IIS Administration console and select a virtual directory website for which you want to configure mappings.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>Windows XP (IIS 5)</strong><strong>Virtual Directory "RW" </strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%283%29-feb07.gif" title="" /> </div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>Windows 2003 Server (IIS 6)</strong><br /><strong>Default Web Site</strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong><img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%284%29-feb07.gif" title="" /></strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Then click the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Configuration…</span> button on the Virtual Directory tab (or the Home Directory tab if you are configuring mappings for the website).</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>Windows XP (IIS 5) </strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%285%29-feb07.gif" title="" /></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<strong>Windows 2003 Server (IIS 6)</strong></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%286%29-feb07.gif" title="" /></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Next, click on the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Add</span> button and type in an extension. You also need to specify a path to an ASP.NET ISAPI Extension. Don't forget to uncheck the option <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Check that file exists</span>.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%287%29-feb07.gif" title="" /></div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
If you would like to map all extensions to ASP.NET, then for IIS 5 on Windows XP you have only to map .* extension to the ASP.NET ISAPI extension. But for IIS 6 on Windows 2003 you have to do it in a slightly different way: click on the<span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Insert…</span> button instead of the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">Add…</span> button, and specify a path to the ASP.NET ISAPI extension.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
<img border="0" src="http://www.simple-talk.com/iwritefor/articlefiles/357-G_Magdanurov%288%29-feb07.gif" title="" /></div>
<h2 style="font-family: 'Times New Roman', Times, serif; font-size: 17px; margin-left: 20px;">
Conclusions</h2>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
Now we have built a simple but very powerful rewriting module for ASP.NET that supports regular expressions-based URLs and page postbacks. This solution is easily implemented and gives users the ability to use short, neat URLs free of bulky Query String parameters. To start using the module, you simply have to add a reference to the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">RewriteModule</span> assembly in your web application and add a few lines of code to the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file, whereupon you have all the power of regular expressions at your disposal to override URLs. The rewrite module is easily maintainable, because to change any 'virtual' URL you only need to edit the <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> file. If you need to test your application without the module, you can turn it off in <span class="CodeInText" style="font-family: 'courier new', courier, monospaced; font-weight: bold;">web.config</span> without modifying any code.</div>
<div style="font-family: Arial, Helvetica, sans-serif; font-size: 12px; margin-left: 20px; text-align: justify;">
To gain a deeper insight into the rewriting module, take a look through the source code and example attached to this article. I believe you'll find using the rewriting module a far more pleasant experience, than using the native URL mapping in ASP.NET 2.0.</div>
</div>
<br style="font-family: arial; font-size: 13px; text-align: left;" /></div>
</div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-3703386811910619132011-12-27T11:29:00.001+05:302011-12-27T11:29:58.087+05:30Check UserName Availability in ASP.Net using JQuery<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Many
times it was asked to me to provide an AJAX based example to Check User
Name Availability using AJAX in ASP.Net. Before I have already written
an article but it was lacking Server Side code. This one is a bit
different from it as here I’ll be using JQuery to make AJAX Calls to the
server. Thus I’ll also explain how to call server side methods or
functions directly using JQuery in ASP.Net</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Database</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">For this example I have created a sample database called dbUsers with a table called Users with the following structure</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><img alt="User Table SQL Server 2005 Database : Check whether username already exists in asp.net" src="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=b9443ae3-8b50-45cb-9c57-e22d4272f729.png" style="height: 104px; width: 358px;" /></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Secondly I have created the following stored procedure that will check the database for the user name requested and <b>will return true if user name is available</b> and <b>false in case it is not</b>.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">SET</span> <span style="color: blue;">ANSI_NULLS</span> <span style="color: blue;">ON</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">SET</span> <span style="color: blue;">QUOTED_IDENTIFIER</span> <span style="color: blue;">ON</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">CREATE</span> <span style="color: blue;">PROCEDURE</span> spx_CheckUserAvailability</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> @UserName <span style="color: blue;">VARCHAR</span><span style="color: grey;">(</span>50<span style="color: grey;">)</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">AS</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">BEGIN</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SET</span> <span style="color: blue;">NOCOUNT</span> <span style="color: blue;">ON</span><span style="color: grey;">;</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">IF</span> <span style="color: grey;">NOT</span> <span style="color: grey;">EXISTS</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: grey;">(</span><span style="color: blue;">SELECT</span> <span style="color: grey;">*</span> <span style="color: blue;">FROM</span> Users</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">WHERE</span> UserName <span style="color: grey;">=</span> @UserName</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: grey;">)</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SELECT</span> <span style="color: red;">'true'</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">ELSE</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SELECT</span> <span style="color: red;">'false'</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">END</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Server Side</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Server
side I have created a method which accepts the user name as string and
returns the status returned by the stored procedure based on the
availability</span> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><b><span style="line-height: 115%;">C#</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">[System.Web.Services.<span style="color: #2b91af;">WebMethod</span>]</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">string</span> CheckUserName(<span style="color: blue;">string</span> userName)</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">{</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">string</span> returnValue = <span style="color: blue;">string</span>.Empty;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">try</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">string</span> consString = <span style="color: #2b91af;">ConfigurationManager</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> .ConnectionStrings[<span style="color: #a31515;">"conString"</span>].ConnectionString;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: #2b91af;">SqlConnection</span> conn = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlConnection</span>(consString);</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: #2b91af;">SqlCommand</span> cmd = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlCommand</span>(<span style="color: #a31515;">"spx_CheckUserAvailability"</span>, conn); </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.CommandType = <span style="color: #2b91af;">CommandType</span>.StoredProcedure;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.Parameters.AddWithValue(<span style="color: #a31515;">"@UserName"</span>, userName.Trim());</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Open();</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = cmd.ExecuteScalar().ToString();</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Close(); </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">catch</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = <span style="color: #a31515;">"error"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">return</span> returnValue; </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><b><span style="line-height: 115%;">VB.Net</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <System.Web.Services.WebMethod()> _</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">Public</span> <span style="color: blue;">Shared</span> <span style="color: blue;">Function</span> CheckUserName(<span style="color: blue;">ByVal</span> userName <span style="color: blue;">As</span> <span style="color: blue;">String</span>) <span style="color: blue;">As</span> <span style="color: blue;">String</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> returnValue <span style="color: blue;">As</span> <span style="color: blue;">String</span> = <span style="color: blue;">String</span>.Empty</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Try</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> consString <span style="color: blue;">As</span> <span style="color: blue;">String</span> = ConfigurationManager _</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> .ConnectionStrings(<span style="color: #a31515;">"conString"</span>).ConnectionString</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> conn <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlConnection(consString)</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> cmd <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlCommand(<span style="color: #a31515;">"spx_CheckUserAvailability"</span>, conn)</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.CommandType = CommandType.StoredProcedure</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.Parameters.AddWithValue(<span style="color: #a31515;">"@UserName"</span>, userName.Trim())</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Open()</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = cmd.ExecuteScalar().ToString()</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Close()</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Catch</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = <span style="color: #a31515;">"error"</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">End</span> <span style="color: blue;">Try</span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Return</span> returnValue</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; margin: 0in 0in 10pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue; line-height: 115%;">End</span><span style="line-height: 115%;"> <span style="color: blue;">Function</span></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">As you’ll notice that I am simply calling the stored procedure </span><b><span style="color: #a31515; line-height: 115%;">spx_CheckUserAvailability</span></b><span style="line-height: 115%;"> and returning the value returned by the stored procedure.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Now
we’ll call this function using JQuery. There are three important points
that you need to take care if a function needs to be called using
JQuery</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">1. It should be public.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">2. It should be declared as </span><b><span style="color: blue; line-height: 115%;">static</span></b><span style="line-height: 115%;"> in C# and </span><b><span style="color: blue; line-height: 115%;">Shared</span></b><span style="line-height: 115%;"> </span><span style="line-height: 115%;">in VB.Net</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">3. It should be defined as Web Service <b>WebMethod</b></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Once all this is done we are ready to write client side code. You can download the JQuery library using the link below</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
<a href="http://docs.jquery.com/Downloading_jQuery" target="_blank">Download JQuery</a><br />
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Client Side</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">Below
is the HTML Markup of the page. I have placed an ASP.Net TextBox for
the user to enter user name, a HTML button for invoking the JQuery
method and a HTML SPAN to display the messages</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> UserName : </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TextBox</span> <span style="color: red;">ID</span><span style="color: blue;">="txtUserName"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: red;">onkeyup</span> <span style="color: blue;">=</span> <span style="color: blue;">"OnChange(this)"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TextBox</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">input</span> <span style="color: red;">id</span><span style="color: blue;">="btnCheck"</span> <span style="color: red;">type</span><span style="color: blue;">="button"</span> <span style="color: red;">value</span><span style="color: blue;">="Show Availability"</span> </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: red;">onclick</span> <span style="color: blue;">=</span> <span style="color: blue;">"ShowAvailability()"</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">span</span> <span style="color: red;">id</span> <span style="color: blue;">=</span> <span style="color: blue;">"mesg"></</span><span style="color: #a31515;">span</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; margin: 0in 0in 10pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue; line-height: 115%;"></</span><span style="color: #a31515; line-height: 115%;">form</span><span style="color: blue; line-height: 115%;">></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">The figure below describes the JQuery AJAX method’s syntax which will be used to call our Server Side method.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><img alt="Calling Server Side Page Methods using JQuery AJAX in ASP.Net" src="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=4d360ff0-d10b-4e95-8731-2eca95a637fb.png" style="height: 266px; width: 592px;" /></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; margin: 0in 0in 10pt;">
<span style="font-size: small;"><span style="line-height: 115%;">And finally here are the Client Side functions that will be used </span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">script</span> <span style="color: red;">src</span><span style="color: blue;">="scripts/jquery-1.3.2.min.js"</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"></</span><span style="color: #a31515;">script</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">script</span> <span style="color: red;">type</span> <span style="color: blue;">=</span> <span style="color: blue;">"text/javascript"></span></span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> ShowAvailability() {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> $.ajax({</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> type: <span style="color: #a31515;">"POST"</span>,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> url: <span style="color: #a31515;">"CS.aspx/CheckUserName"</span>,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> data: <span style="color: #a31515;">'{userName: "'</span> + $(<span style="color: #a31515;">"#<%=txtUserName.ClientID%>"</span>)[0].value + <span style="color: #a31515;">'" }'</span>,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> contentType: <span style="color: #a31515;">"application/json; charset=utf-8"</span>,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> dataType: <span style="color: #a31515;">"json"</span>,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> success: OnSuccess,</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> failure: <span style="color: blue;">function</span>(response) {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> alert(response);</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> });</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> OnSuccess(response) {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">var</span> mesg = $(<span style="color: #a31515;">"#mesg"</span>)[0];</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
</div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">switch</span> (response.d) {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: #a31515;">"true"</span>:</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: #a31515;">"green"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: #a31515;">"Available"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: #a31515;">"false"</span>:</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: #a31515;">"red"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: #a31515;">"Not Available"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: #a31515;">"error"</span>:</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: #a31515;">"red"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: #a31515;">"Error occured"</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>; </span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> OnChange(txt) {</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"> $(<span style="color: #a31515;">"#mesg"</span>)[0].innerHTML = <span style="color: #a31515;">""</span>;</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div class="MsoNormal" style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin: 0in 0in 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"></</span><span style="color: #a31515;">script</span><span style="color: blue;">></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">As
you’ll notice above I am simply calling the CheckUserName Server side
function in CS.aspx page (for VB.Net VB.aspx) and passing the TextBox
value as parameter. Secondly I have defined the <b>success</b> method <b>OnSuccess</b> that will be called handle the response returned by the Server.</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">Below is the screenshot of the sample application</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><img alt="Checking username availability in ASP.Net and SQL Server 2005 database using JQuery" src="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=6b27c71c-8df7-4edf-929e-aabcf2c8f5c0.png" style="height: 264px; width: 457px;" /></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;"><b>Note</b>:
For this article I have used Visual Studio 2008. In order to use this
functionality in Visual Studio 2005 you have to install AJAX Extensions
and Add ScriptManager to the page. Also instead of <b>response.d</b> you’ll have to check for <b>response</b> for the returned values</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">For
reference I have attached the sample code in VB.Net and C# for both VS
2005 and VS 2008 versions. You can download them using the links below</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">Visual Studio 2008 : <a href="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=52906080-2472-4e5f-bd94-2b05b227da55.zip">CallingServerSideMethodsJQuery.zip (24.52 kb)</a> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">Visual Studio 2005 : <a href="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=1e82c69b-ec6c-4030-89e5-fcc98d9ba7e7.zip">CheckUserNameAvailabilityVS05.zip (23.87 kb)</a> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin: 0in 0in 0pt;">
<span style="font-size: small;">SQL Server 2005 Sample Database : <a href="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=3bf0795a-10df-42e3-8a8e-9629e8de884e.zip">Database.zip (204.84 kb)</a> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-32679001986061046112011-12-27T11:14:00.000+05:302011-12-27T11:22:45.021+05:30Check Username Availability in ASP.Net using AJAX PageMethods<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Many
times it was asked to me to provide an AJAX based example to Check User
Name Availability using AJAX in ASP.Net. Before I have already written
an article but it was lacking Server Side code. This one is a bit
different from it as here I’ll be using PageMethods to make AJAX Calls
to the server. Thus I’ll also explain how to call server side methods or
functions directly using ASP.Net AJAX ScriptManager PageMethods in
ASP.Net</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Database</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">For this example I have created a sample database called dbUsers with a table called Users with the following structure</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><img alt="User Table SQL Server 2005 Database : Check whether username already exists in asp.net" src="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=b9443ae3-8b50-45cb-9c57-e22d4272f729.png" style="height: 104px; width: 358px;" title="User Table SQL Server 2005 Database : Check whether username already exists in asp.net" /></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Secondly I have created the following stored procedure that will check the database for the user name requested and <b>will return true if user name is available</b> and <b>false in case it is not</b>.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="background-color: #f2f2f2; border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">SET</span> <span style="color: blue;">ANSI_NULLS</span> <span style="color: blue;">ON</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">SET</span> <span style="color: blue;">QUOTED_IDENTIFIER</span> <span style="color: blue;">ON</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">CREATE</span> <span style="color: blue;">PROCEDURE</span> spx_CheckUserAvailability</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> @UserName <span style="color: blue;">VARCHAR</span><span style="color: grey;">(</span>50<span style="color: grey;">)</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">AS</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">BEGIN</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SET</span> <span style="color: blue;">NOCOUNT</span> <span style="color: blue;">ON</span><span style="color: grey;">;</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">IF</span> <span style="color: grey;">NOT</span> <span style="color: grey;">EXISTS</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: grey;">(</span><span style="color: blue;">SELECT</span> <span style="color: grey;">*</span> <span style="color: blue;">FROM</span> Users</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">WHERE</span> UserName <span style="color: grey;">=</span> @UserName</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: grey;">)</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SELECT</span> <span style="color: red;">'true'</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">ELSE</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">SELECT</span> <span style="color: red;">'false'</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">END</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">GO</span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Server Side</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Server
side I have created a method which accepts the user name as string and
returns the status returned by the stored procedure based on the
availability</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><b><span style="line-height: 115%;">C#</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="background-color: #f2f2f2; border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">[System.Web.Services.<span style="color: #2b91af;">WebMethod</span>]</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">public</span> <span style="color: blue;">static</span> <span style="color: blue;">string</span> CheckUserName(<span style="color: blue;">string</span> userName)</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">{</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">string</span> returnValue = <span style="color: blue;">string</span>.Empty;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">try</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">string</span> consString = <span style="color: #2b91af;">ConfigurationManager</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> .ConnectionStrings[<span style="color: #a31515;">"conString"</span>].ConnectionString;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: #2b91af;">SqlConnection</span> conn = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlConnection</span>(consString);</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: #2b91af;">SqlCommand</span> cmd = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlCommand</span>(<span style="color: #a31515;">"spx_CheckUserAvailability"</span>, conn); </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.CommandType = <span style="color: #2b91af;">CommandType</span>.StoredProcedure;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.Parameters.AddWithValue(<span style="color: #a31515;">"@UserName"</span>, userName.Trim());</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Open();</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = cmd.ExecuteScalar().ToString();</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Close(); </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">catch</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = <span style="color: #a31515;">"error"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">return</span> returnValue; </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><b><span style="line-height: 115%;">VB.Net</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="background-color: #f2f2f2; border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><System.Web.Services.WebMethod()> _</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">Public</span> <span style="color: blue;">Shared</span> <span style="color: blue;">Function</span> CheckUserName(<span style="color: blue;">ByVal</span> userName <span style="color: blue;">As</span> <span style="color: blue;">String</span>) <span style="color: blue;">As</span> <span style="color: blue;">String</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> returnValue <span style="color: blue;">As</span> <span style="color: blue;">String</span> = <span style="color: blue;">String</span>.Empty</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Try</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> consString <span style="color: blue;">As</span> <span style="color: blue;">String</span> = ConfigurationManager _</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> .ConnectionStrings(<span style="color: #a31515;">"conString"</span>).ConnectionString</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> conn <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlConnection(consString)</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Dim</span> cmd <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlCommand(<span style="color: #a31515;">"spx_CheckUserAvailability"</span>, conn)</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.CommandType = CommandType.StoredProcedure</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> cmd.Parameters.AddWithValue(<span style="color: #a31515;">"@UserName"</span>, userName.Trim())</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Open()</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = cmd.ExecuteScalar().ToString()</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> conn.Close()</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Catch</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> returnValue = <span style="color: #a31515;">"error"</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">End</span> <span style="color: blue;">Try</span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">Return</span> returnValue</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; padding: 0in;">
<span style="font-size: small;"><span style="color: blue; line-height: 115%;">End</span><span style="line-height: 115%;"> <span style="color: blue;">Function</span></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">As you’ll notice that I am simply calling the stored procedure </span><b><span style="color: #a31515; line-height: 115%;">spx_CheckUserAvailability</span></b><span style="line-height: 115%;"> and returning the value returned by the stored procedure.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Now
we’ll call this function using ASP.Net AJAX ScriptManager PageMethods.
There are three important points that you need to take care if a
function needs to be called using PageMethods</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">1. It should be public.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">2. It should be declared as </span><b><span style="color: blue; line-height: 115%;">static</span></b><span style="line-height: 115%;"> in C# and </span><b><span style="color: blue; line-height: 115%;">Shared</span></b> <span style="line-height: 115%;">in VB.Net</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">3. It should be defined as Web Service <b>WebMethod</b></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Once all this is done we are ready to write client side code. </span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><b><span style="line-height: 115%;">Client Side</span></b></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Below
is the HTML Markup of the page. I have placed an ASP.Net TextBox for
the user to enter user name, a HTML button for invoking the JavaScript
method and a HTML SPAN to display the messages</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="background-color: #f2f2f2; border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> UserName : </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TextBox</span> <span style="color: red;">ID</span><span style="color: blue;">="txtUserName"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: red;">onkeyup</span> <span style="color: blue;">=</span> <span style="color: blue;">"OnChange(this)"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TextBox</span><span style="color: blue;">></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">input</span> <span style="color: red;">id</span><span style="color: blue;">="btnCheck"</span> <span style="color: red;">type</span><span style="color: blue;">="button"</span> <span style="color: red;">value</span><span style="color: blue;">="Show Availability"</span> </span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: red;">onclick</span> <span style="color: blue;">=</span> <span style="color: blue;">"ShowAvailability()"</span> <span style="color: blue;">/></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;"><</span><span style="color: #a31515;">span</span> <span style="color: red;">id</span> <span style="color: blue;">=</span> <span style="color: blue;">"mesg"></</span><span style="color: #a31515;">span</span><span style="color: blue;">></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; padding: 0in;">
<span style="font-size: small;"><span style="color: blue; line-height: 115%;"></</span><span style="color: #a31515; line-height: 115%;">form</span><span style="color: blue; line-height: 115%;">></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><span style="line-height: 115%;">Here
are the Client Side functions that will be used to call the Server Side
Methods that will verify whether the Username entered by the user
exists or not.</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
<br />
</span><br />
<div style="background-color: #f2f2f2; border-color: windowtext; border-style: solid; border-width: 1pt; font-family: Georgia,"Times New Roman",serif; padding: 1pt 4pt;">
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"><</span><span style="color: maroon;">script</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"></span></span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> ShowAvailability() {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> PageMethods.CheckUserName(document.getElementById(<span style="color: maroon;">"<span style="-moz-background-inline-policy: continuous; background: none repeat scroll 0% 0% yellow;"><%</span>=txtUserName.ClientID<span style="-moz-background-inline-policy: continuous; background: none repeat scroll 0% 0% yellow;">%></span>"</span>).value, OnSuccess);</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> OnSuccess(response) {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">var</span> mesg = document.getElementById(<span style="color: maroon;">"mesg"</span>);</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">switch</span> (response) {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: maroon;">"true"</span>:</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: maroon;">"green"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: maroon;">"Available"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: maroon;">"false"</span>:</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: maroon;">"red"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: maroon;">"Not Available"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">case</span> <span style="color: maroon;">"error"</span>:</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.style.color = <span style="color: maroon;">"red"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> mesg.innerHTML = <span style="color: maroon;">"Error occured"</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> <span style="color: blue;">break</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> }</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;">function</span> OnChange(txt) {</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"> document.getElementById(<span style="color: maroon;">"mesg"</span>).innerHTML = <span style="color: maroon;">""</span>;</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;">}</span></div>
<div style="border-color: -moz-use-text-color; border-style: none; border-width: medium; line-height: normal; margin-bottom: 0pt; padding: 0in;">
<span style="font-size: small;"><span style="color: blue;"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></span></div>
</div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">As
you’ll notice above I am simply calling the CheckUserName Server side
function in CS.aspx page (for VB.Net VB.aspx) and passing the TextBox
value as parameter. Secondly I have defined the <b>success</b> method <b>OnSuccess</b> that will be called handle the response returned by the Server.</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">Below is the screenshot of the sample application</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;"><img alt="Checking username availability in ASP.Net and SQL Server database using AJAX ScriptManager PageMethods" src="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=6b27c71c-8df7-4edf-929e-aabcf2c8f5c0.png" style="height: 264px; width: 457px;" title="Checking username availability in ASP.Net and SQL Server database using AJAX ScriptManager PageMethods" /></span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">
</span></div>
<span style="font-family: Georgia,"Times New Roman",serif; font-size: small;">
</span><br />
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span style="font-size: small;">For
reference I have attached the sample code in VB.Net and C# along with
the sample database which you can directly attach to your SQL Server
Instance. You can download them using the link below</span><br />
<span style="font-size: small;"><b>Download</b> </span><br />
<a href="http://mycodelogic.somee.com/suneeldownload/CheckUserNameAvailabilityusingPageMethodsinASP.Net.zip" title="Check User Name Availability in ASP.Net using AJAX PageMethods">CheckUserNameAvailabilityusingPageMethodsinASP.Net.zip</a>
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
</div>
<div style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0pt;">
<span class="data-post"></span><br />
<div style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<span class="data-post"><span style="font-family: Algerian; font-size: 17px;">-------------------------</span></span></div>
<span class="data-post">
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<b><span style="color: #984806; font-family: Georgia,serif;">Thanks</span></b></div>
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<span style="font-family: Algerian; font-size: 13pt;">Suneel Kumar</span></div>
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Tahoma, Arial, Verdana; font-size: 12px; line-height: 18px; text-align: -webkit-auto;">
<span style="font-family: Algerian;"><span style="font-size: 17px;">-------------------------</span></span></div>
</span><span style="font-size: small;"> </span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-73943902480744967512011-12-27T10:51:00.001+05:302011-12-27T10:51:23.995+05:30JavaScript: How to Close Browser Window (window.close()) Without Warning<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">If you've ever tried to close a browser window from ASP.NET by using the following code:</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<pre style="font-family: Georgia,"Times New Roman",serif;"><span style="font-size: small;"><input type="<span style="color: darkred;">button</span>" <span style="color: blue;">class</span>="<span style="color: darkred;">inputfields</span>"</span></pre>
<pre style="font-family: Georgia,"Times New Roman",serif;"><span style="font-size: small;"> onclick="<span style="color: darkred;">javascript:window.close();</span>" <span style="color: blue;">value</span>="<span style="color: darkred;">Close</span>" /></td></span></pre>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">You will probably receive the following message:</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><a href="http://blogs.infinite-x.net/images/JavascriptHowtoClose.closeWithoutWarning_D055/image06.png"><img border="0" height="136" src="http://blogs.infinite-x.net/images/JavascriptHowtoClose.closeWithoutWarning_D055/image0_thumb2.png" style="border-color: -moz-use-text-color; border-right: 0px none; border-style: none; border-width: 0px;" width="400" /></a></span> </div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">After digging around for 20 minutes or so, I finally found the answer on Anatoly Lubarsky's <a href="http://blogs.x2line.com/al/articles/350.aspx" target="_blank">blog</a>:</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<pre style="font-family: Georgia,"Times New Roman",serif;"><span style="font-size: small;"><input type="<span style="color: darkred;">button</span>" <span style="color: blue;">class</span>="<span style="color: darkred;">inputfields</span>"
onclick="<span style="color: darkred;">javascript:window.opener='x';window.close();</span>" <span style="color: blue;">value</span>="<span style="color: darkred;">Close</span>" /></td></span></pre>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"> </span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">If you tried to close a window using javascript window.close() method
in <b style="background-color: yellow;">IE7</b>, and as you may noticed a message will prompt "The Webpage you
are viewing is trying to close the window. Do you want to close this
window". </span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">Because of the security enhancements in IE7, you can't
close a window unless it is opened by a script. so the walkaround will
be to let the browser thinks that this page is opened using a script
then closing the window. below is the implementation.</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">1- Create a javascript function which will be called to close the window</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><script language=javascript></span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">function CloseWindow()</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">{</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><strong>window.open('','_self','');</strong></span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">window.close();</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">}</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"></script></span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">the
code in bold is used to open a window in this case it's not defined
into the current window. in this way, we let the browser thinks that the
current window is opened using javascript, so when the window.close()
is executed it will close it without the message being displayed.</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">Now you can try it by adding the below HTML code</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><a href="" onclick="CloseWindow();">Testing Close Window</a></span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">Hope this post will help you.</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">For <b>Mozilla Firefox</b></span> </div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;"><br /></span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">set your firefox browser:
</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">1. input <b>"about:config </b>" to your firefox address bar and enter;</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: small;">2. make sure your "<b>dom.allow_scripts_to_close_windows</b>" is <b>true</b></span></div>
<span style="font-size: small;"><br style="font-family: Georgia,"Times New Roman",serif;" /></span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-12848734565956776512011-12-25T19:38:00.004+05:302011-12-25T19:39:14.082+05:30How To Delete a null record<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">The code below will show you how exactly you delete a row with a NULL value. You can not use =NULL but you have to use IS NULL</span><br />
<br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">CREATE TABLE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull (id </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">INT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> identity, SomeDate </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">DATETIME</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">)</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">INSERT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">VALUES</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">(</span><span style="background-color: #f6f6f6; color: #cc33cc; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">GETDATE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">())</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">INSERT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">VALUES</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">(</span><span style="background-color: #f6f6f6; color: #cc33cc; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">GETDATE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">())</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">INSERT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">VALUES</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">(NULL)</span><br />
<br />
<br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--Check what's in the table</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">SELECT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> * </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">FROM</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull</span><br />
<br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--This won't work</span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">DELETE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">WHERE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> SomeDate = NULL</span><br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--(0 row(s) affected)</span><br />
<br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--This is the way</span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">DELETE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">WHERE</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> SomeDate </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">IS</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> NULL</span><br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--(1 row(s) affected)</span><br />
<br />
<span style="background-color: #f6f6f6; color: #009900; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">--Check again</span><br />
<span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">SELECT</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> * </span><span style="background-color: #f6f6f6; color: #3333ff; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">FROM</span><span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"> #TestDeleteNull</span>
<br />
<span style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;"><br /></span><br />
<br />
<div style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<span style="font-family: Algerian; font-size: 17px;">-------------------------</span></div>
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<b><span style="color: #984806; font-family: Georgia, serif;">Thanks</span></b></div>
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Verdana, sans-serif; font-size: 13px; line-height: 18px; text-align: -webkit-auto;">
<span style="font-family: Algerian; font-size: 13pt;">Suneel Kumar</span></div>
<div class="MsoNormal" style="background-color: #f6f6f6; color: #333333; font-family: Tahoma, Arial, Verdana; font-size: 12px; line-height: 18px; text-align: -webkit-auto;">
<span style="font-family: Algerian;"><span style="font-size: 17px;">-------------------------</span></span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-73939129295260540592011-12-25T19:33:00.001+05:302011-12-25T19:36:42.723+05:30SQL String Functions Tutorial<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">1. CHARINDEX</strong> string function takes 2 arguments. 1st argument specifies the character whose index is to be retrieved and 2nd argument takes as a string from which character index is carried out.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select CHARINDEX ('S','MICROSOFT SQL SERVER 2000')<br />Result: 6</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">2. LEFT</strong> string function takes 2 arguments. 1st argument takes as a string value and 2nd argument as integer value as length parameter. It returns first characters of specified length starting from the left side of the string entered as 1st argument.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select LEFT ('MICROSOFT SQL SERVER 2000',4)<br />Result: MICR</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">3. RIGHT</strong> string function takes 2 arguments. 1st argument takes as a string value and 2nd argument as integer value as length parameter. It returns last characters of specified length starting from the right side of the string entered as 1st argument.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select RIGHT ('MICROSOFT SQL SERVER 2000',4)<br />Result: 2000</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">4. LEN</strong> string function takes 1 argument as string value and returns the length of entered string.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select LEN ('MICROSOFT SQL SERVER 2000')<br />Result: 25</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">5. REPLACE</strong> string function takes 3 arguments.<br />
1st argument as string value.<br />
2nd argument is a part of string entered as 1st argument which is to be replaced.<br />
3rd argument as a new string value that is to be placed at the place of 2nd argument.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select REPLACE ('MICROSOFT SQL SERVER 2000','MICROSOFT','MS')<br />Result: MS SQL SERVER 2000</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">6. STUFF</strong> string function takes 4 arguments. It is used to replace specified length of characters with provided pattern.<br />
1st argument as string value.<br />
2nd argument as integer value specifying the starting point of characters to be replaced.<br />
3rd arguments as integer value specifying the length of characters.<br />
4th argument as string value specifying the new pattern of characters.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select STUFF ('MICROSOFT SQL SERVER 2000', 11, 3,'S.Q.L.')<br />Result: MICROSFT S.Q.L. SERVER 2000</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">7. SUBSTRING</strong> string function returns the sub string of specified length starting from the entered start position. It takes 3 arguments.<br />
1st argument as string value.<br />
2nd argument as integer specifying the start position.<br />
3rd argument as integer specifying the length</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />Select SUBSTRING ('MICROSOFT SQL SERVER 2000', 11, 3)<br />Result: SQL</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">8. LOWER</strong> string function returns the lower case string whether the entered string has upper case letters. It takes 1 argument as string value.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select LOWER(‘MICROSOFT ASP .NET WEB HOSTING’)<br />Result: microsoft asp .net web hosting</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">9. UPPER</strong> string function returns the upper case string whether the entered string has lower case letters. It takes 1 argument as string value.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select LOWER(‘MICROSOFT ASP .NET WEB HOSTING with SQL Database’)<br />Result: MICROSOFT ASP .NET WEB HOSTING WITH SQL DATABASE</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">10. REVERSE</strong> string function returns the string in reverse order. It takes 1 argument as string value.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select REVERSE(‘ASP.NET’)<br />Result: TEN.PSA</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">11. LTRIM</strong> function returns the string by removing all the blank spaces at left side. It also takes 1 argument as string value.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select LTRIM (‘ ASP ’)<br />Result: ASP-----<br />blanks at the right side not removed.</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">12. RTRIM</strong> function returns the string by removing all the blank spaces at left side. It also takes 1 argument as string value.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select RTRIM (‘ ASP ’)<br />Result: -----ASP<br />blanks at the left side not removed.</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">13. PATINDEX</strong> function returns the position of first occurrence of specified pattern in the provided string. It takes 2 arguments.<br />
1st argument as string value specifying the pattern to match<br />
2nd argument as string value specifying the string to compare.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select PATINDEX('%RO%','MICROSOFT')<br />Results: 4</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">14. STR </strong>function returns character data converted from numeric data. It takes 3 arguments.<br />
1st argument as float data<br />
2nd argument as integer value specifying the length of the string including decimal that is to be retrieved.<br />
3rd argument as integer specifying the number of places to the right of the decimal point.</div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<strong style="font-weight: bold;">Example:<br />select STR(140.15, 6, 1)<br />Result: 140.2</strong></div>
<div style="background-color: #f6f6f6; font-family: Verdana, sans-serif; font-size: 13px; text-align: -webkit-auto;">
<br />
<strong style="font-weight: bold;">15. ASCII </strong>function returns the ASCII code value from the leftmost character specified character expression. It takes 1 argument as string/character expression.</div>
<div style="background-color: #f6f6f6; text-align: -webkit-auto;">
<div style="font-family: Verdana, sans-serif; font-size: 13px;">
<strong style="font-weight: bold;">Example:<br />select ASCII('A')<br />Result: 65</strong></div>
<div style="font-family: Verdana, sans-serif; font-size: 13px;">
<span style="font-family: Algerian; font-size: 17px;">-------------------------</span>
</div>
<span class="data-post"><span class="fullpost"></span></span><br />
<div class="MsoNormal" style="font-family: Verdana, sans-serif; font-size: 13px;">
<b><span style="color: #984806; font-family: "Georgia","serif";">Thanks </span></b></div>
<div class="MsoNormal" style="font-family: Verdana, sans-serif; font-size: 13px;">
<span style="font-family: Algerian; font-size: 13.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">Suneel Kumar</span></div>
<div class="MsoNormal">
<span style="font-family: Algerian;"><span style="font-size: 17px;">-------------------------</span></span></div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-87368723772702873692011-12-25T17:08:00.001+05:302011-12-25T17:15:55.810+05:30How to enlarge image on mouseover in asp.net using jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="date-outer">
<div class="date-posts">
<div class="post-outer">
<div class="post hentry" style="margin-bottom: 1.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 1.5em; text-align: justify;">
<div class="post-body entry-content" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br />
<img alt="aspdotnetcodebook" border="0" src="http://i951.photobucket.com/albums/ad355/excusemedoiknowu/img_enlarge.gif" style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;" /><br />
<pre class="csharpcode" style="background-color: white; font-family: Consolas, 'Courier New', Courier, monospace; font-size: small;"><span class="asp" style="background-color: yellow;"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Img_Enlarge.aspx.cs" Inherits="Img_Enlarge" %></span>
<span class="kwrd" style="color: blue;"><!</span><span class="html" style="color: maroon;">DOCTYPE</span> <span class="attr" style="color: red;">html</span> <span class="attr" style="color: red;">PUBLIC</span> <span class="kwrd" style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="kwrd" style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">html</span> <span class="attr" style="color: red;">xmlns</span><span class="kwrd" style="color: blue;">="http://www.w3.org/1999/xhtml"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">head</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">script</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/javascript"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Scripts/jquery-1.4.1.js"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<style type=<span class="str" style="color: #a31515;">"text/css"</span>>
.thumbnail
{
height: 100px;
width: 100px;
position: relative;
}
.image
{
position: relative;
width: 400px;
height: 250px;
}
</style>
<script language=<span class="str" style="color: #a31515;">"javascript"</span> type=<span class="str" style="color: #a31515;">"text/javascript"</span>>
$(document).ready(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">".thumbnail"</span>).mouseover(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">".thumbnail"</span>).css(<span class="str" style="color: #a31515;">"opacity"</span>, <span class="str" style="color: #a31515;">".5"</span>);
$(<span class="kwrd" style="color: blue;">this</span>).animate({ opacity: 1.0 });
$(<span class="str" style="color: #a31515;">"#imgContainer"</span>).append(<span class="str" style="color: #a31515;">"<img class='image' src='"</span> + $(<span class="kwrd" style="color: blue;">this</span>).attr(<span class="str" style="color: #a31515;">"src"</span>) + <span class="str" style="color: #a31515;">"' />"</span>);
});
$(<span class="str" style="color: #a31515;">".thumbnail"</span>).mouseout(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">".thumbnail"</span>).css(<span class="str" style="color: #a31515;">"opacity"</span>, <span class="str" style="color: #a31515;">"1.0"</span>);
$(<span class="str" style="color: #a31515;">".image"</span>).remove();
});
});
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">head</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">form</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="form1"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">form</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span> <span class="attr" style="color: red;">align</span><span class="kwrd" style="color: blue;">="center"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">img</span> <span class="attr" style="color: red;">alt</span><span class="kwrd" style="color: blue;">=""</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="thumbnail"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Images/Tree.jpg"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">img</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="thumbnail"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Images/dock.jpg"</span> <span class="attr" style="color: red;">alt</span><span class="kwrd" style="color: blue;">=""</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">img</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="thumbnail"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Images/forest.jpg"</span> <span class="attr" style="color: red;">alt</span><span class="kwrd" style="color: blue;">=""</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">img</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="thumbnail"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Images/garden.jpg"</span> <span class="attr" style="color: red;">alt</span><span class="kwrd" style="color: blue;">=""</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="imgContainer"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">html</span><span class="kwrd" style="color: blue;">></span>
</pre>
<br /></div>
</div>
</div>
</div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-34836039483325868232011-12-25T17:01:00.001+05:302011-12-25T17:01:20.102+05:30How to select/deselect all checkbox in gridview using jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="post-header-line-1" style="background-color: white; color: #333333; font-size: 13px; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<span style="font-family: Georgia, 'Times New Roman', serif;"><img alt="aspdotnetcodebook" border="0" height="275" src="http://i951.photobucket.com/albums/ad355/excusemedoiknowu/chkbox.gif" style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; line-height: 1.3em; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;" width="640" /><span style="line-height: 1.3em;"> </span><span style="line-height: 1.3em;">In this post I will show how to select/deselect checkbox present inside gridview using jquery.</span></span></div>
<div class="post-body entry-content" style="background-color: white; color: #333333; font-size: 13px; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="asp" style="background-color: yellow;"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="GridViewSelectAll.aspx.cs"
Inherits="GridViewSelectAll" %></span>
<span class="kwrd" style="color: blue;"><!</span><span class="html" style="color: maroon;">DOCTYPE</span> <span class="attr" style="color: red;">html</span> <span class="attr" style="color: red;">PUBLIC</span> <span class="kwrd" style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="kwrd" style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">html</span> <span class="attr" style="color: red;">xmlns</span><span class="kwrd" style="color: blue;">="http://www.w3.org/1999/xhtml"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">head</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">script</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Scripts/jquery-1.4.1.js"</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/javascript"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<script type=<span class="str" style="color: #a31515;">"text/javascript"</span>>
$(document).ready(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">"#<%=gvProducts.ClientID%> input[id$='chkAll']:checkbox"</span>).click(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">"#<%=gvProducts.ClientID%> input[id*='chkSelected']:checkbox"</span>).attr(<span class="str" style="color: #a31515;">'checked'</span>, $(<span class="kwrd" style="color: blue;">this</span>).<span class="kwrd" style="color: blue;">is</span>(<span class="str" style="color: #a31515;">':checked'</span>));
});
});
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">head</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">form</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="form1"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:GridView</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="gvProducts"</span> <span class="attr" style="color: red;">AutoGenerateColumns</span><span class="kwrd" style="color: blue;">="false"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">Columns</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">HeaderTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">input</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="checkbox"</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="chkAll"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="attr" style="color: red;">value</span><span class="kwrd" style="color: blue;">='<%#Eval("ProductID") %>'</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">HeaderTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">input</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="checkbox"</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="chkSelected"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:BoundField</span> <span class="attr" style="color: red;">DataField</span><span class="kwrd" style="color: blue;">="ProductName"</span> <span class="attr" style="color: red;">HeaderText</span><span class="kwrd" style="color: blue;">="ProductName"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:BoundField</span> <span class="attr" style="color: red;">DataField</span><span class="kwrd" style="color: blue;">="Description"</span> <span class="attr" style="color: red;">HeaderText</span><span class="kwrd" style="color: blue;">="Description"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">Columns</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:GridView</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">form</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">html</span><span class="kwrd" style="color: blue;">></span>
</span></pre>
<pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="kwrd" style="color: blue;">using</span> System;
<span class="kwrd" style="color: blue;">using</span> System.Collections.Generic;
<span class="kwrd" style="color: blue;">using</span> System.Linq;
<span class="kwrd" style="color: blue;">using</span> System.Web;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI.WebControls;
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">partial</span> <span class="kwrd" style="color: blue;">class</span> GridViewSelectAll : System.Web.UI.Page
{
<span class="kwrd" style="color: blue;">protected</span> <span class="kwrd" style="color: blue;">void</span> Page_Load(<span class="kwrd" style="color: blue;">object</span> sender, EventArgs e)
{
gvProducts.DataSource = ProductDAL.GetProducts();
gvProducts.DataBind();
}
}
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">class</span> Product
{
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">int</span> ProductID { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">string</span> ProductName { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">string</span> Description { get; set; }
}
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">class</span> ProductDAL
{
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">static</span> List<Product> GetProducts()
{
<span class="kwrd" style="color: blue;">return</span> <span class="kwrd" style="color: blue;">new</span> List<Product>()
{
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 1, ProductName = <span class="str" style="color: #a31515;">"P001"</span>, Description = <span class="str" style="color: #a31515;">"Desc01"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 2, ProductName = <span class="str" style="color: #a31515;">"P002"</span>, Description = <span class="str" style="color: #a31515;">"Desc02"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 3, ProductName = <span class="str" style="color: #a31515;">"P003"</span>, Description = <span class="str" style="color: #a31515;">"Desc03"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 4, ProductName = <span class="str" style="color: #a31515;">"P004"</span>, Description = <span class="str" style="color: #a31515;">"Desc04"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 5, ProductName = <span class="str" style="color: #a31515;">"P005"</span>, Description = <span class="str" style="color: #a31515;">"Desc05"</span>},
};
}
}</span></pre>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-5155173893955318252011-12-25T16:16:00.000+05:302011-12-25T16:16:02.686+05:30How to validate asp.net form using Jquery<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="date-outer" style="background-color: white; color: #333333; font-size: 13px;">
<div class="date-posts">
<div class="post-outer">
<div class="post hentry" style="margin-bottom: 1.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 1.5em; text-align: justify;">
<div class="post-body entry-content" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="font-family: Georgia, 'Times New Roman', serif;"><b>In this post I will show you how to validate asp.net form using jqery. Create a new website,add a new js file ,and add following code inside it</b></span><br />
<pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;">
</span></pre>
<pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;">function validateForm(e) {
var formIsValid = true;
// check that a valid email address has been entered
var emailRegExp = /[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,4}/;
if (!emailRegExp.test(String($("#txtEmail").val()).toUpperCase())) {
addError("txtEmail", "Please enter a valid email address.");
formIsValid = false;
} else {
removeError("txtEmail");
}
// check that first name has one or more characters
if ($("#txtFirstName").val() == '') {
addError("txtFirstName", "This field is required.");
formIsValid = false;
} else {
removeError("txtFirstName");
}
// check that last name has one or more characters
if ($("#txtLastName").val() == '') {
addError("txtLastName", "This field is required.");
formIsValid = false;
} else {
removeError("txtLastName");
}
// check that a valid phone number is entered
var phoneRegExp = /^\(?[1-9]\d{2}\)?\s?\-?\.?\d{3}\s?\-?\.?\d{4}$/;
if (!phoneRegExp.test($("#txtPhone").val())) {
addError("txtPhone", "Valid phone number required.");
formIsValid = false;
} else {
removeError("txtPhone");
}
if (!formIsValid) {
e.preventDefault();
}
}
function addError(id, msg) {
if ($("#" + id).parent().find("label[class=error]").attr("generated") == "true") {
$("#" + id).parent().find("label[class=error]").css("display", "block");
} else {
$("#" + id).parent().append('<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">label</span> <span class="attr" style="color: red;">for</span><span class="kwrd" style="color: blue;">="' + id + '"</span> <span class="attr" style="color: red;">generated</span><span class="kwrd" style="color: blue;">="true"</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="error"</span><span class="kwrd" style="color: blue;">></span>' + msg + '<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">label</span><span class="kwrd" style="color: blue;">></span>').css("display", "block");
}
}
function removeError(id) {
$("#" + id).parent().find("label[class=error]").css("display", "none");
}</span></pre>
<span style="font-family: Georgia, 'Times New Roman', serif;">Add a new page.Then add reference of jquery and above js file</span><pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="asp" style="background-color: yellow;"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %></span>
<span class="kwrd" style="color: blue;"><!</span><span class="html" style="color: maroon;">DOCTYPE</span> <span class="attr" style="color: red;">html</span> <span class="attr" style="color: red;">PUBLIC</span> <span class="kwrd" style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="kwrd" style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">html</span> <span class="attr" style="color: red;">xmlns</span><span class="kwrd" style="color: blue;">="http://www.w3.org/1999/xhtml"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">head</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">script</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/javascript"</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Scripts/jquery-1.4.1.js"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<script type=<span class="str" style="color: #a31515;">"text/javascript"</span> src=<span class="str" style="color: #a31515;">"Scripts/Validation.js"</span>></script>
<title></title>
<script type=<span class="str" style="color: #a31515;">"text/javascript"</span>>
$(document).ready(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">".submitForm"</span>).click(<span class="kwrd" style="color: blue;">function</span> (e) {
validateForm(e);
});
});
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">style</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/css"</span><span class="kwrd" style="color: blue;">></span>
.error{color:Red;}
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">style</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">head</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">form</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="form1"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">table</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="style1"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
FirstName
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TextBox</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="txtFirstName"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">asp:TextBox</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
LastName
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TextBox</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="txtLastName"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">asp:TextBox</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
Phone Number
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TextBox</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="txtPhone"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">asp:TextBox</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
Email
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TextBox</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="txtEmail"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">asp:TextBox</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">td</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">tr</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">table</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">input</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="button"</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="btnSubmit"</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="submitForm"</span> <span class="attr" style="color: red;">value</span><span class="kwrd" style="color: blue;">="Submit"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">form</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">html</span><span class="kwrd" style="color: blue;">></span>
</span></pre>
<br />
<div style="clear: both; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
</div>
<div class="post-footer" style="font-size: 11px; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<div class="post-footer-line post-footer-line-1" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="font-family: Georgia, 'Times New Roman', serif;"><span class="post-author vcard"></span><span class="post-timestamp"></span><span class="post-comment-link"><a class="comment-link" href="http://aspdotnetcodebook.blogspot.com/2011/10/how-to-validate-aspnet-form-using.html#comment-form" style="color: #336699; white-space: nowrap;">0 comments</a> </span><span class="post-icons"><span class="item-action"><a href="http://www.blogger.com/email-post.g?blogID=6673695286148904603&postID=5042425318312505239" style="color: #336699; text-decoration: none !important;" title="Email Post"><img alt="" class="icon-action" src="http://www.blogger.com/img/icon18_email.gif" style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; margin-bottom: 0px !important; margin-left: 0.5em !important; margin-right: 0px !important; margin-top: 0px !important; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; vertical-align: middle;" /></a></span></span></span></div>
<div class="post-footer-line post-footer-line-2" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span class="post-labels"><span style="font-family: Georgia, 'Times New Roman', serif;">Labels: <a href="http://aspdotnetcodebook.blogspot.com/search/label/ASP.NET" rel="tag" style="color: #336699;">ASP.NET</a>, <a href="http://aspdotnetcodebook.blogspot.com/search/label/Jquery" rel="tag" style="color: #336699;">Jquery</a></span></span></div>
<div class="post-footer-line post-footer-line-3" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="date-outer" style="background-color: white; color: #333333; font-size: 13px;">
<h2 class="date-header" style="color: #999999; font-size: 13px; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 1.5em;">
<span style="font-family: Georgia, 'Times New Roman', serif;">Saturday, October 1, 2011</span></h2>
<div class="date-posts">
<div class="post-outer">
<div class="post hentry" style="margin-bottom: 1.5em; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 1.5em; text-align: justify;">
<span style="font-family: Georgia, 'Times New Roman', serif;"><a href="" name="5914235263335720739"></a></span><h3 class="post-title entry-title" style="font-size: 16px; line-height: 1.1em; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<a href="http://aspdotnetcodebook.blogspot.com/2011/10/how-to-sum-value-of-gridview-column.html" style="color: #333333; text-decoration: none;"><span style="font-family: Georgia, 'Times New Roman', serif;">How to sum the value of gridview column using jquery</span></a></h3>
<div class="post-header-line-1" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<span style="font-family: Georgia, 'Times New Roman', serif;"><br /></span></div>
<div class="post-body entry-content" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px;">
<br />
<div dir="ltr" style="line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;" trbidi="on">
<pre class="cpp" name="code"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="Apple-style-span" style="font-size: medium;">In this post I will show how to sum the value of gridview column on selection of checkbox .Let us suppose that you have a gridview which has three column named Name,Quantity and Price.Now your requirement is to sum the value of price filed on selection of checkbox.</span>
</span></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"><pre class="csharpcode" style="color: black; font-size: small;"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="asp" style="background-color: yellow;"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %></span>
<span class="kwrd" style="color: blue;"><!</span><span class="html" style="color: maroon;">DOCTYPE</span> <span class="attr" style="color: red;">html</span> <span class="attr" style="color: red;">PUBLIC</span> <span class="kwrd" style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="kwrd" style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">html</span> <span class="attr" style="color: red;">xmlns</span><span class="kwrd" style="color: blue;">="http://www.w3.org/1999/xhtml"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">head</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">script</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Scripts/jquery-1.4.1.js"</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/javascript"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<title></title>
<script type=<span class="str" style="color: #a31515;">"text/javascript"</span>>
$(document).ready(<span class="kwrd" style="color: blue;">function</span> () {
<span class="kwrd" style="color: blue;">var</span> total;
<span class="rem" style="color: green;">//Column index value of price field (Column index start from 1)</span>
<span class="kwrd" style="color: blue;">var</span> columnIndexValue = 4;
<span class="kwrd" style="color: blue;">var</span> <span class="kwrd" style="color: blue;">checked</span> = $(<span class="str" style="color: #a31515;">'input:checkbox'</span>).click(<span class="kwrd" style="color: blue;">function</span> (e) {
<span class="kwrd" style="color: blue;">var</span> total = 0.0;
$(<span class="str" style="color: #a31515;">"tr:has(:checkbox:checked) td:nth-child("</span> + columnIndexValue + <span class="str" style="color: #a31515;">")"</span>).each(<span class="kwrd" style="color: blue;">function</span> () {
total += parseFloat($(<span class="kwrd" style="color: blue;">this</span>).text());
});
$(<span class="str" style="color: #a31515;">'#Sum'</span>).text(<span class="str" style="color: #a31515;">"your total is:"</span> + total.toFixed(2));
});
});
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">head</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">form</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="form1"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:GridView</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="grdItems"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="attr" style="color: red;">AutoGenerateColumns</span><span class="kwrd" style="color: blue;">="false"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">Columns</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:CheckBox</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="chkItem"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TemplateField</span> <span class="attr" style="color: red;">HeaderText</span><span class="kwrd" style="color: blue;">="Name"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:Label</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="label2"</span> <span class="attr" style="color: red;">Text</span><span class="kwrd" style="color: blue;">='<%#Eval("Name") %>'</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TemplateField</span> <span class="attr" style="color: red;">HeaderText</span><span class="kwrd" style="color: blue;">="Quantity"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:Label</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="Label1"</span> <span class="attr" style="color: red;">Text</span><span class="kwrd" style="color: blue;">='<%#Eval("Quantity") %>'</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:TemplateField</span> <span class="attr" style="color: red;">HeaderText</span><span class="kwrd" style="color: blue;">="Price"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:Label</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="Label2"</span> <span class="attr" style="color: red;">Text</span><span class="kwrd" style="color: blue;">='<%#Eval("Price") %>'</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">ItemTemplate</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:TemplateField</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">Columns</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">asp:GridView</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="Sum"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">form</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">html</span><span class="kwrd" style="color: blue;">></span>
</span></pre>
<span style="font-family: Georgia, 'Times New Roman', serif;">
</span></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"></pre>
<pre class="cpp" name="code"><pre class="csharpcode" style="color: black; font-size: small;"><pre class="csharpcode" style="margin-bottom: 0em; margin-left: 0em; margin-right: 0em; margin-top: 0em;"><span style="font-family: Georgia, 'Times New Roman', serif;"><span class="kwrd" style="color: blue;">using</span> System;
<span class="kwrd" style="color: blue;">using</span> System.Collections.Generic;
<span class="kwrd" style="color: blue;">using</span> System.Linq;
<span class="kwrd" style="color: blue;">using</span> System.Web;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI.WebControls;
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">partial</span> <span class="kwrd" style="color: blue;">class</span> Default2 : System.Web.UI.Page
{
<span class="kwrd" style="color: blue;">protected</span> <span class="kwrd" style="color: blue;">void</span> Page_Load(<span class="kwrd" style="color: blue;">object</span> sender, EventArgs e)
{
grdItems.DataSource = <span class="kwrd" style="color: blue;">new</span> Item().Items;
grdItems.DataBind();
}
}
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">class</span> Item
{
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">string</span> Name { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">int</span> Quantity { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">decimal</span> Price { get; set; }
<span class="kwrd" style="color: blue;">public</span> List<Item> Items
{
get
{
<span class="kwrd" style="color: blue;">return</span> <span class="kwrd" style="color: blue;">new</span> List<Item>()
{
<span class="kwrd" style="color: blue;">new</span> Item(){Name = <span class="str" style="color: #a31515;">"Item01"</span>,Quantity = 10,Price = 180M},
<span class="kwrd" style="color: blue;">new</span> Item(){Name = <span class="str" style="color: #a31515;">"Item01"</span>,Quantity = 11,Price = 184M},
<span class="kwrd" style="color: blue;">new</span> Item(){Name = <span class="str" style="color: #a31515;">"Item01"</span>,Quantity = 12,Price = 190M},
<span class="kwrd" style="color: blue;">new</span> Item(){Name = <span class="str" style="color: #a31515;">"Item01"</span>,Quantity = 13,Price = 110M},
};
}
}
}</span></pre>
</pre>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-36716878647360741842011-12-23T23:37:00.000+05:302011-12-23T23:37:55.943+05:30Captcha Control Sample (C#, ASP.NET, Server Control)<div dir="ltr" style="text-align: left;" trbidi="on">
<span style="font-family: Georgia, 'Times New Roman', serif;"><br /><br />In various websites, Captcha control is used for validating the user input and protect web application from the program. Here is one of the sample control for Captcha. It is basic one which can be enhanced further by including more to the image generation and even including the timeout. Or you can add much more to it<br /><br />This application has two parts<br /><br />1. CaptchaControl<br />2. CaptchaControl Sample Project<br /><br />Captcha control has three files.<br /><br />1. CaptchaControl (Which is the main control)<br />2. CaptchaImage (Which generates the Captcha image)<br />3. CaptchaImageHandler (which will provide the image to browser from the cache).<br /><br />You can download it from <a href="http://mycodelogic.somee.com/suneeldownload/CaptchaSample.zip">(Captcha Control Sample)</a> <br /><a href="http://towardsnext.files.wordpress.com/2009/02/pic17.jpg"><img src="http://towardsnext.files.wordpress.com/2009/02/pic17.jpg?w=300&h=217" /></a> <br /><br />Captcha Sample Control</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-45440380442308183812011-12-20T23:57:00.000+05:302011-12-20T23:57:18.700+05:30How to display progress indicator during ajax call in asp.net[Jquery]<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="post-header-line-1" style="background-color: white; color: #333333; font-family: Verdana, Arial, sans-serif; font-size: 13px; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<br /></div>
<div class="post-body entry-content" style="background-color: white; color: #333333; font-family: Verdana, Arial, sans-serif; font-size: 13px; line-height: 1.3em; margin-bottom: 0.75em; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">
<img alt="aspdotnetcodebook" border="0" src="http://i951.photobucket.com/albums/ad355/excusemedoiknowu/ajaxloader.gif" style="border-bottom-color: rgb(204, 204, 204); border-bottom-style: solid; border-bottom-width: 1px; border-image: initial; border-left-color: rgb(204, 204, 204); border-left-style: solid; border-left-width: 1px; border-right-color: rgb(204, 204, 204); border-right-style: solid; border-right-width: 1px; border-top-color: rgb(204, 204, 204); border-top-style: solid; border-top-width: 1px; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px;" />In this post I will show you how to display progress indicator during ajax call.<br />
<pre class="csharpcode" style="background-color: white; color: black; font-family: Consolas, 'Courier New', Courier, monospace; font-size: small;"><span class="asp" style="background-color: yellow;"><%@ Page Language="C#" AutoEventWireup="true" CodeFile="Jquery_Progress.aspx.cs"
Inherits="Jquery_Progress" %></span>
<span class="kwrd" style="color: blue;"><!</span><span class="html" style="color: maroon;">DOCTYPE</span> <span class="attr" style="color: red;">html</span> <span class="attr" style="color: red;">PUBLIC</span> <span class="kwrd" style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span> <span class="kwrd" style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">html</span> <span class="attr" style="color: red;">xmlns</span><span class="kwrd" style="color: blue;">="http://www.w3.org/1999/xhtml"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">head</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">title</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">script</span> <span class="attr" style="color: red;">src</span><span class="kwrd" style="color: blue;">="Scripts/jquery-1.4.1.js"</span> <span class="attr" style="color: red;">type</span><span class="kwrd" style="color: blue;">="text/javascript"</span><span class="kwrd" style="color: blue;">></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<style type=<span class="str" style="color: #a31515;">"text/css"</span>>
.loader
{
display: none;
background-color: Red;
width: 100px;
}
</style>
<script language=<span class="str" style="color: #a31515;">"javascript"</span> type=<span class="str" style="color: #a31515;">"text/javascript"</span>>
$(document).ready(<span class="kwrd" style="color: blue;">function</span> () {
$(<span class="str" style="color: #a31515;">"#btnLoad"</span>).click(<span class="kwrd" style="color: blue;">function</span> (e) {
e.preventDefault();
$(<span class="str" style="color: #a31515;">"#gvData"</span>).html(<span class="str" style="color: #a31515;">""</span>);
$(<span class="str" style="color: #a31515;">"#loader"</span>).show();
sendData();
});
});
<span class="kwrd" style="color: blue;">function</span> sendData() {
<span class="kwrd" style="color: blue;">var</span> loc = window.location.href;
loc = (loc.substr(loc.length - 1, 1) == <span class="str" style="color: #a31515;">"/"</span>) ? loc + <span class="str" style="color: #a31515;">"Jquery_Progress.aspx"</span> : loc;
$.ajax({
type: <span class="str" style="color: #a31515;">"POST"</span>,
url: loc + <span class="str" style="color: #a31515;">"/GetAllProducts"</span>,
contentType: <span class="str" style="color: #a31515;">"application/json;charset=utf-8"</span>,
dataType: <span class="str" style="color: #a31515;">"json"</span>,
success: <span class="kwrd" style="color: blue;">function</span> (msg) {
$(<span class="str" style="color: #a31515;">"#loader"</span>).hide();
$(<span class="str" style="color: #a31515;">"#gvData"</span>).html(msg.d);
},
error: <span class="kwrd" style="color: blue;">function</span> () {
alert(<span class="str" style="color: #a31515;">"An unexpected error has occurred during processing."</span>);
}
});
}
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">script</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">head</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">form</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="form1"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">asp:Button</span> <span class="attr" style="color: red;">ID</span><span class="kwrd" style="color: blue;">="btnLoad"</span> <span class="attr" style="color: red;">runat</span><span class="kwrd" style="color: blue;">="server"</span> <span class="attr" style="color: red;">Text</span><span class="kwrd" style="color: blue;">="LoadProduct"</span> <span class="kwrd" style="color: blue;">/><</span><span class="html" style="color: maroon;">br</span> <span class="kwrd" style="color: blue;">/></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="gvData"</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"><</span><span class="html" style="color: maroon;">div</span> <span class="attr" style="color: red;">id</span><span class="kwrd" style="color: blue;">="loader"</span> <span class="attr" style="color: red;">class</span><span class="kwrd" style="color: blue;">="loader"</span><span class="kwrd" style="color: blue;">></span>
Loading....<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">div</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">form</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">body</span><span class="kwrd" style="color: blue;">></span>
<span class="kwrd" style="color: blue;"></</span><span class="html" style="color: maroon;">html</span><span class="kwrd" style="color: blue;">></span>
</pre>
<pre class="csharpcode" style="background-color: white; color: black; font-family: Consolas, 'Courier New', Courier, monospace; font-size: small;"><span class="kwrd" style="color: blue;">using</span> System;
<span class="kwrd" style="color: blue;">using</span> System.Collections.Generic;
<span class="kwrd" style="color: blue;">using</span> System.Linq;
<span class="kwrd" style="color: blue;">using</span> System.Web;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI;
<span class="kwrd" style="color: blue;">using</span> System.Web.UI.WebControls;
<span class="kwrd" style="color: blue;">using</span> System.Web.Services;
<span class="kwrd" style="color: blue;">using</span> System.Web.Script.Services;
<span class="kwrd" style="color: blue;">using</span> System.Web.Script.Serialization;
<span class="kwrd" style="color: blue;">using</span> System.Text;
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">partial</span> <span class="kwrd" style="color: blue;">class</span> Jquery_Progress : System.Web.UI.Page
{
<span class="kwrd" style="color: blue;">protected</span> <span class="kwrd" style="color: blue;">void</span> Page_Load(<span class="kwrd" style="color: blue;">object</span> sender, EventArgs e)
{
}
[WebMethod]
[ScriptMethod]
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">static</span> <span class="kwrd" style="color: blue;">string</span> GetAllProducts()
{
<span class="rem" style="color: green;">//Comment below line for production server</span>
System.Threading.Thread.Sleep(3000);
StringBuilder sb=<span class="kwrd" style="color: blue;">new</span> StringBuilder();
JavaScriptSerializer json=<span class="kwrd" style="color: blue;">new</span> JavaScriptSerializer();
List<Product> products = ProductDAL.GetProducts();
json.Serialize(products, sb);
<span class="kwrd" style="color: blue;">return</span> sb.ToString();
}
}
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">class</span> Product
{
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">int</span> ProductID { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">string</span> ProductName { get; set; }
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">string</span> Description { get; set; }
}
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">class</span> ProductDAL
{
<span class="kwrd" style="color: blue;">public</span> <span class="kwrd" style="color: blue;">static</span> List<Product> GetProducts()
{
<span class="kwrd" style="color: blue;">return</span> <span class="kwrd" style="color: blue;">new</span> List<Product>()
{
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 1, ProductName = <span class="str" style="color: #a31515;">"P001"</span>, Description = <span class="str" style="color: #a31515;">"Desc01"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 2, ProductName = <span class="str" style="color: #a31515;">"P002"</span>, Description = <span class="str" style="color: #a31515;">"Desc02"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 3, ProductName = <span class="str" style="color: #a31515;">"P003"</span>, Description = <span class="str" style="color: #a31515;">"Desc03"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 4, ProductName = <span class="str" style="color: #a31515;">"P004"</span>, Description = <span class="str" style="color: #a31515;">"Desc04"</span>},
<span class="kwrd" style="color: blue;">new</span> Product() {ProductID = 5, ProductName = <span class="str" style="color: #a31515;">"P005"</span>, Description = <span class="str" style="color: #a31515;">"Desc05"</span>},
};
}
}</pre>
</div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-46295237719329889152011-12-15T11:26:00.000+05:302011-12-15T11:26:16.886+05:30Edit Update and Refresh Page values by PopUp ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
In this example i am going to describe how to open popup window from
aspx page with values from parent page, and update or refresh values in
parent window from child or popup window using javascript and
ClientScript.RegisterStartupScript method in ASP.NET <br />
<br />
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="http://i543.photobucket.com/albums/gg462/amitjain/csharpBlog/PopUpWindow.gif" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img border="0" src="http://i543.photobucket.com/albums/gg462/amitjain/csharpBlog/PopUpWindow.gif" /></a></div>
I have added to labels in Default.aspx page and one button to open popup window.<br />
<br />
I've also added a PopUp.aspx page which is having two textboxes and a button to update lable values of parent page.<br />
<br />
The textboxes in popup window are populated with Text values of lables
in parent page (Default.aspx), after making changes in textbox values
i'm updating values back in parent page.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span class="fullpost"><b>HTML source of Default.aspx (parent) page is </b><br />
<div class="codeview">
<pre class="csharpcode"><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
</pre>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">form</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">div</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>First Name :</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">label</span> <span style="color: red;">id</span><span style="color: blue;">="lblFirstName"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">text</span><span style="color: blue;">="amiT"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">asp</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">:</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">label</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>Last Name:<span style="color: red;">&nbsp;</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">label</span> <span style="color: red;">id</span><span style="color: blue;">="lblLastName"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">text</span><span style="color: blue;">="jaiN"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">asp</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">:</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">label</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">button</span> <span style="color: red;">id</span><span style="color: blue;">="btnPop"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">text</span><span style="color: blue;">="Click To
Edit Values"</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">div</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">form</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span><span style="font-family: "Georgia","serif";"></span></div>
<pre class="csharpcode"><span class="kwrd"></span></pre>
</div>
<div class="codeview2">
<b>Write this Javascript in Head section of Default.aspx page </b></div>
In this i m getting values of lables and passing them to popuup page as querystrings<br />
<div class="codeview2">
write this code Page_Load event of Default.aspx (parent) page<br />
<b>C# code behind </b><br />
</div>
</span><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">protected</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span>
sender, EventArgs e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">string</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> updateValuesScript =</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">@"function updateValues(popupValues)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">document.getElementById('lblFirstName').innerHTML=popupValues[0];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">document.getElementById('lblLastName').innerHTML=popupValues[1];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">}"</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">this</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">.ClientScript.RegisterStartupScript(Page.GetType(),</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">"UpdateValues"</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">, updateValuesScript.ToString(), <span style="color: blue;">true</span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">btnPop.Attributes.Add(<span style="color: #a31515;">"onclick"</span>,
<span style="color: #a31515;">"openPopUp('PopUp.aspx')"</span>);</span></div>
<div class="MsoNormal">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">}</span><span style="font-family: "Georgia","serif";"></span></div>
<span class="fullpost">
<div class="codeview2">
<b>VB.NET code behind</b></div>
<div class="syntaxhighlighter nogutter" id="highlighter_777482">
<div class="lines">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">Protected</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">Sub</span> Page_Load(<span style="color: blue;">ByVal</span>
sender <span style="color: blue;">As</span> <span style="color: blue;">Object</span>,
<span style="color: blue;">ByVal</span> e <span style="color: blue;">As</span>
EventArgs)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">Dim</span> updateValuesScript <span style="color: blue;">As</span>
<span style="color: blue;">String</span> = <span style="color: #a31515;">"function
updateValues(popupValues)"</span> & vbCr & vbLf & <span style="color: #a31515;">"{"</span> & vbCr & vbLf & <span style="color: #a31515;">"
document.getElementById('lblFirstName').innerHTML=popupValues[0];"</span>
& vbCr & vbLf & <span style="color: #a31515;">"
document.getElementById('lblLastName').innerHTML=popupValues[1];"</span>
& vbCr & vbLf & <span style="color: #a31515;">"}"</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">Me</span>.ClientScript.RegisterStartupScript(Page.[GetType](),
<span style="color: #a31515;">"UpdateValues"</span>,
updateValuesScript.ToString(), <span style="color: blue;">True</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>btnPop.Attributes.Add(<span style="color: #a31515;">"onclick"</span>,
<span style="color: #a31515;">"openPopUp('PopUp.aspx')"</span>)</span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">End</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">Sub</span></span><span style="font-family: "Georgia","serif";"></span></div>
</div>
</div>
<br />
<b>And this is the HTML code for PopUp.aspx(child) page </b><br />
<div class="codeview">
<pre class="csharpcode"><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
</pre>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">form</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">div</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>First Name :</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">textbox</span> <span style="color: red;">id</span><span style="color: blue;">="txtPopFName"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">width</span><span style="color: blue;">="113px"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">asp</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">:</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">textbox</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>Last Name:<span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">textbox</span> <span style="color: red;">id</span><span style="color: blue;">="txtPopLName"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">width</span><span style="color: blue;">="109px"></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">asp</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">:</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">textbox</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">br</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">button</span> <span style="color: red;">id</span><span style="color: blue;">="Button1"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"</span>
<span style="color: red;">onclick</span><span style="color: blue;">="Button1_Click"</span>
<span style="color: red;">text</span><span style="color: blue;">="Button"</span>
<span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">div</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"></</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">form</span><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">></span><span style="font-family: "Georgia","serif";"></span></div>
<pre class="csharpcode"><span class="kwrd"></span></pre>
</div>
<div class="codeview2">
Code behind for <b>PopUp.aspx</b><br />
<b>C# code behind </b><br />
</div>
<div class="syntaxhighlighter nogutter" id="highlighter_460713">
<div class="lines">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">protected</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span>
sender, EventArgs e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">string</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> updateParentScript =</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">@"function updateParentWindow()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">{<span style="mso-spacerun: yes;">
</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>var
fName=document.getElementById('txtPopFName').value;<span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>var
lName=document.getElementById('txtPopLName').value;<span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>var
arrayValues= new Array(fName,lName);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>window.opener.updateValues(arrayValues);<span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>window.close();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">}"</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">this</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">.ClientScript.RegisterStartupScript(<span style="color: blue;">this</span>.GetType(),</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: #a31515;">"UpdateParentWindow"</span>,
updateParentScript, <span style="color: blue;">true</span>);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">if</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">
(!IsPostBack)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>txtPopFName.Text =
Request[<span style="color: #a31515;">"fn"</span>];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span>txtPopLName.Text =
Request[<span style="color: #a31515;">"ln"</span>];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>Button1.Attributes.Add(<span style="color: #a31515;">"onclick"</span>,
<span style="color: #a31515;">"updateParentWindow()"</span>);</span></div>
<div class="MsoNormal">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">}</span><span style="font-family: "Georgia","serif";"></span></div>
</div>
</div>
<div class="codeview2">
<b>VB.NET code behind</b></div>
<div class="syntaxhighlighter nogutter" id="highlighter_56487">
<div class="lines">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">Protected</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">Sub</span> Page_Load(<span style="color: blue;">ByVal</span>
sender <span style="color: blue;">As</span> <span style="color: blue;">Object</span>,
<span style="color: blue;">ByVal</span> e <span style="color: blue;">As</span>
EventArgs)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">Dim</span> updateParentScript <span style="color: blue;">As</span>
<span style="color: blue;">String</span> = <span style="color: #a31515;">"function
updateParentWindow()"</span> & vbCr & vbLf & <span style="color: #a31515;">" {<span style="mso-spacerun: yes;">
</span>"</span> & vbCr & vbLf & <span style="color: #a31515;">"<span style="mso-spacerun: yes;"> </span>var fName=document.getElementById('txtPopFName').value;<span style="mso-spacerun: yes;"> </span>"</span> & vbCr & vbLf & <span style="color: #a31515;">"<span style="mso-spacerun: yes;"> </span>var
lName=document.getElementById('txtPopLName').value;<span style="mso-spacerun: yes;"> </span>"</span> & vbCr & vbLf & <span style="color: #a31515;">"<span style="mso-spacerun: yes;"> </span>var
arrayValues= new Array(fName,lName);"</span> & vbCr & vbLf & <span style="color: #a31515;">"<span style="mso-spacerun: yes;">
</span>window.opener.updateValues(arrayValues);<span style="mso-spacerun: yes;"> </span>"</span> & vbCr & vbLf
& <span style="color: #a31515;">"<span style="mso-spacerun: yes;">
</span>window.close(); "</span> & vbCr & vbLf & <span style="color: #a31515;">" }"</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">Me</span>.ClientScript.RegisterStartupScript(<span style="color: blue;">Me</span>.[GetType](), <span style="color: #a31515;">"UpdateParentWindow"</span>,
updateParentScript, <span style="color: blue;">True</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">If</span> <span style="color: blue;">Not</span> IsPostBack <span style="color: blue;">Then</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>txtPopFName.Text = Request(<span style="color: #a31515;">"fn"</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>txtPopLName.Text = Request(<span style="color: #a31515;">"ln"</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">End</span> <span style="color: blue;">If</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"><span style="mso-spacerun: yes;">
</span>Button1.Attributes.Add(<span style="color: #a31515;">"onclick"</span>,
<span style="color: #a31515;">"updateParentWindow()"</span>)</span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;">End</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; line-height: 115%; mso-bidi-font-family: "Courier New"; mso-no-proof: yes;"> <span style="color: blue;">Sub</span></span><span style="font-family: "Georgia","serif";"></span></div>
</div>
</div>
<br />
Hope this helps <br />
<br />
<b>Download sample code attached </b><br />
<a href="http://www.box.net/shared/h5fgi3aj91" target="_blank"><img src="http://amit.jain.online.googlepages.com/download.jpg" /></a> <br />
<br />
</span><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal">
<b style="mso-bidi-font-weight: normal;"><span style="color: #984806; font-family: "Georgia","serif"; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes; mso-themecolor: accent6; mso-themeshade: 128;">Thanks</span></b></div>
<div class="MsoNormal">
<span style="font-family: Algerian; font-size: 13.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">Suneel Kumar</span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-3184713077611723862011-12-15T10:56:00.000+05:302011-12-15T11:23:11.316+05:30Resize Image before Upload to Databse ASP.NET<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpqQs1DlV5WWG7oiGsFBap48pra0FMgG-1p-LLTIHv62oDFfT40Km15nNff618Rv3h7_Reye48we6H-HNFc7b_CrXOYInz4xtBM7ufQJOZSMab3FxM6XlWjZNYlQr9xuDozMk_nCF7hpWs/s1600-h/ResizeImage.JPG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpqQs1DlV5WWG7oiGsFBap48pra0FMgG-1p-LLTIHv62oDFfT40Km15nNff618Rv3h7_Reye48we6H-HNFc7b_CrXOYInz4xtBM7ufQJOZSMab3FxM6XlWjZNYlQr9xuDozMk_nCF7hpWs/s320/ResizeImage.JPG" width="306" /></a></div>
<br />
<br />
<br />
In this example i am going to describe how to resize image in ASP.NET before/and upload to ms sql database using C# and Vb.NET.<br />
<br />
For this i am using FileUpload control to upload the image in datbase after resizing.<br />
I am also displaying the Image in Gridviw after uploading to database.<br />
<br />
<b><i>To know how to display images in gridview read <i><a href="http://csharpdotnetfreak.blogspot.com/2009/07/display-images-gridview-from-database.html">Display Images In GridView From DataBase</a></i></i></b><br />
<br />
<br />
<br />
<br />
<span class="fullpost"><b>ASPX page html markup look like this </b></span><br />
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]--><span style="color: blue; font-family: "Georgia","serif"; font-size: 10.0pt; mso-ansi-language: EN-IN; mso-bidi-font-family: "Courier New"; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-no-proof: yes;"><</span><span style="color: #a31515; font-family: "Georgia","serif"; font-size: 10.0pt; mso-ansi-language: EN-IN; mso-bidi-font-family: "Courier New"; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-no-proof: yes;">form</span><span style="font-family: "Georgia","serif"; font-size: 10.0pt; mso-ansi-language: EN-IN; mso-bidi-font-family: "Courier New"; mso-bidi-language: AR-SA; mso-fareast-font-family: Calibri; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-latin; mso-no-proof: yes;"> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span><span class="fullpost"><b> </b>
</span><br />
<div class="codeview">
<pre class="csharpcode"></pre>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">div</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">textbox</span> <span style="color: red;">id</span><span style="color: blue;">="txtName"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">textbox</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">fileupload</span> <span style="color: red;">id</span><span style="color: blue;">="FileUpload1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">button</span> <span style="color: red;">id</span><span style="color: blue;">="btnUpload"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">onclick</span><span style="color: blue;">="btnUpload_Click"</span> <span style="color: red;">text</span><span style="color: blue;">="Upload"</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">br</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">label</span> <span style="color: red;">id</span><span style="color: blue;">="lblMessage"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">label</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">gridview</span> <span style="color: red;">id</span><span style="color: blue;">="GridView1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">autogeneratecolumns</span><span style="color: blue;">="False"</span> <span style="color: red;">datakeynames</span><span style="color: blue;">="ID"</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: red;">datasourceid</span><span style="color: blue;">="SqlDataSource1"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">Columns</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">BoundField</span> <span style="color: red;">DataField</span><span style="color: blue;">="ID"</span> <span style="color: red;">HeaderText</span><span style="color: blue;">="ID"</span> <span style="color: red;">InsertVisible</span><span style="color: blue;">="False"</span> <span style="color: red;">ReadOnly</span><span style="color: blue;">="True"</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: red;">SortExpression</span><span style="color: blue;">="ID"</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">BoundField</span> <span style="color: red;">DataField</span><span style="color: blue;">="ImageName"</span> <span style="color: red;">HeaderText</span><span style="color: blue;">="ImageName"</span> <span style="color: red;">SortExpression</span><span style="color: blue;">="ImageName"</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TemplateField</span> <span style="color: red;">HeaderText</span><span style="color: blue;">="Image"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">ItemTemplate</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Image</span> <span style="color: red;">ID</span><span style="color: blue;">="Image1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">ImageUrl</span><span style="color: blue;">='</span><span style="background: none repeat scroll 0% 0% yellow;"><%</span>#
"Handler.ashx?ID=" + Eval("ID")<span style="background: none repeat scroll 0% 0% yellow;">%></span><span style="color: blue;">'</span> <span style="color: blue;">/></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">ItemTemplate</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">TemplateField</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">Columns</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">gridview</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">sqldatasource</span> <span style="color: red;">id</span><span style="color: blue;">="SqlDataSource1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">connectionstring</span><span style="color: blue;">="</span><span style="background: none repeat scroll 0% 0% yellow;"><%</span>$ ConnectionStrings:ConnectionString <span style="background: none repeat scroll 0% 0% yellow;">%></span><span style="color: blue;">"</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: red;">selectcommand</span><span style="color: blue;">="SELECT [ID], [ImageName], [Image] </span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"> FROM [Images]"></</span><span style="color: #a31515; font-size: 10pt;">asp</span><span style="color: blue; font-size: 10pt;">:</span><span style="color: #a31515; font-size: 10pt;">sqldatasource</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">div</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="color: blue; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-size: 10pt; line-height: 115%;">form</span><span style="color: blue; font-size: 10pt; line-height: 115%;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<pre class="csharpcode"><span class="fullpost"><span class="kwrd" style="font-family: Georgia,"Times New Roman",serif;"></span><span class="kwrd"></span>
</span></pre>
</div>
<br />
<br />
<div class="codeview2">
<b>C# Code Behind</b></div>
<br />
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Data;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Configuration;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.Security;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.WebControls;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.WebControls.WebParts;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.HtmlControls;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.IO;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Data.SqlClient;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing.Imaging;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing.Drawing2D;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">using</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">public</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span>
<span style="color: #2b91af;">_Default</span> : System.Web.UI.<span style="color: #2b91af;">Page</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">protected</span> <span style="color: blue;">void</span>
Page_Load(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">protected</span> <span style="color: blue;">void</span> btnUpload_Click(<span style="color: blue;">object</span> sender, <span style="color: #2b91af;">EventArgs</span>
e)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">string</span> strImageName = txtName.Text.ToString();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">if</span> (FileUpload1.PostedFile != <span style="color: blue;">null</span> && FileUpload1.PostedFile.FileName != <span style="color: #a31515;">""</span>)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">string</span> strExtension = System.IO.<span style="color: #2b91af;">Path</span>.GetExtension(FileUpload1.FileName);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">if</span> ((strExtension.ToUpper() == <span style="color: #a31515;">".JPG"</span>) | (strExtension.ToUpper() == <span style="color: #a31515;">".GIF"</span>))</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">// Resize Image Before Uploading to DataBase</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
System.Drawing.<span style="color: #2b91af;">Image</span> imageToBeResized
= System.Drawing.<span style="color: #2b91af;">Image</span>.FromStream(FileUpload1.PostedFile.InputStream);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">int</span> imageHeight = imageToBeResized.Height;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">int</span> imageWidth = imageToBeResized.Width;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">int</span> maxHeight = 240;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">int</span> maxWidth
= 320;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageHeight = (imageHeight * maxWidth) / imageWidth;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageWidth = maxWidth;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">if</span> (imageHeight > maxHeight)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> {</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageWidth = (imageWidth * maxHeight) / imageHeight;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageHeight = maxHeight;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: #2b91af;">Bitmap</span> bitmap = <span style="color: blue;">new</span>
<span style="color: #2b91af;">Bitmap</span>(imageToBeResized, imageWidth,
imageHeight);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
System.IO.<span style="color: #2b91af;">MemoryStream</span> stream = <span style="color: blue;">new</span> <span style="color: #2b91af;">MemoryStream</span>();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
bitmap.Save(stream, System.Drawing.Imaging.<span style="color: #2b91af;">ImageFormat</span>.Jpeg);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
stream.Position = 0;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">byte</span>[] image = <span style="color: blue;">new</span> <span style="color: blue;">byte</span>[stream.Length + 1];</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
stream.Read(image, 0, image.Length);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">// Create SQL Connection</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: #2b91af;">SqlConnection</span>
con = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlConnection</span>();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
con.ConnectionString = <span style="color: #2b91af;">ConfigurationManager</span>.ConnectionStrings[<span style="color: #a31515;">"ConnectionString"</span>].ConnectionString;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">// Create SQL Command</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: #2b91af;">SqlCommand</span> cmd = <span style="color: blue;">new</span>
<span style="color: #2b91af;">SqlCommand</span>();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.CommandText = <span style="color: #a31515;">"INSERT INTO
Images(ImageName,Image) VALUES (@ImageName,@Image)"</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.CommandType = <span style="color: #2b91af;">CommandType</span>.Text;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.Connection = con;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: #2b91af;">SqlParameter</span> ImageName = <span style="color: blue;">new</span>
<span style="color: #2b91af;">SqlParameter</span>(<span style="color: #a31515;">"@ImageName"</span>,
<span style="color: #2b91af;">SqlDbType</span>.VarChar, 50);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
ImageName.Value = strImageName.ToString();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.Parameters.Add(ImageName);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: #2b91af;">SqlParameter</span> UploadedImage = <span style="color: blue;">new</span> <span style="color: #2b91af;">SqlParameter</span>(<span style="color: #a31515;">"@Image"</span>, <span style="color: #2b91af;">SqlDbType</span>.Image,
image.Length);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> UploadedImage.Value = image;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.Parameters.Add(UploadedImage);</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
con.Open();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">int</span> result = cmd.ExecuteNonQuery();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
con.Close();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">if</span> (result > 0)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
lblMessage.Text = <span style="color: #a31515;">"File Uploaded"</span>;</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
GridView1.DataBind();</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> }</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> }</span></div>
<div class="MsoNormal">
<span style="font-family: "Georgia","serif"; font-size: 10pt; line-height: 115%;">}</span><span style="font-family: "Georgia","serif";"></span></div>
<br />
<span class="fullpost">
<br />
</span><br />
<div class="codeview2">
<b>VB.NET Code Behind</b></div>
<div class="syntaxhighlighter nogutter" id="highlighter_335376">
<div class="lines">
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Data</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Configuration</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.Security</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.WebControls</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.WebControls.WebParts</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Web.UI.HtmlControls</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.IO</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Data.SqlClient</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing.Imaging</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing.Drawing2D</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Imports</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> System.Drawing</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt;">Partial</span><span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Public</span> <span style="color: blue;">Class</span>
_Default</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Inherits</span> System.Web.UI.Page</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Protected</span> <span style="color: blue;">Sub</span>
Page_Load(<span style="color: blue;">ByVal</span> sender <span style="color: blue;">As</span>
<span style="color: blue;">Object</span>, <span style="color: blue;">ByVal</span> e
<span style="color: blue;">As</span> EventArgs)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Sub</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Protected</span> <span style="color: blue;">Sub</span>
btnUpload_Click(<span style="color: blue;">ByVal</span> sender <span style="color: blue;">As</span> <span style="color: blue;">Object</span>, <span style="color: blue;">ByVal</span> e <span style="color: blue;">As</span> EventArgs)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> strImageName <span style="color: blue;">As</span> <span style="color: blue;">String</span> = txtName.Text.ToString()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">If</span> FileUpload1.PostedFile <span style="color: blue;">IsNot</span>
<span style="color: blue;">Nothing</span> <span style="color: blue;">AndAlso</span>
FileUpload1.PostedFile.FileName <> <span style="color: #a31515;">""</span>
<span style="color: blue;">Then</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> strExtension <span style="color: blue;">As</span> <span style="color: blue;">String</span> =
System.IO.Path.GetExtension(FileUpload1.FileName)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">If</span> (strExtension.ToUpper() = <span style="color: #a31515;">".JPG"</span>)
<span style="color: blue;">Or</span> (strExtension.ToUpper() = <span style="color: #a31515;">".GIF"</span>) <span style="color: blue;">Then</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">' Resize Image Before Uploading to DataBase</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> imageToBeResized <span style="color: blue;">As</span>
System.Drawing.Image =
System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> imageHeight <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = imageToBeResized.Height</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> imageWidth <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = imageToBeResized.Width</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> maxHeight <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = 240</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> maxWidth <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = 320</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageHeight = (imageHeight * maxWidth) / imageWidth</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageWidth = maxWidth</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">If</span> imageHeight > maxHeight <span style="color: blue;">Then</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageWidth = (imageWidth * maxHeight) / imageHeight</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
imageHeight = maxHeight</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> bitmap <span style="color: blue;">As</span> <span style="color: blue;">New</span> Bitmap(imageToBeResized, imageWidth, imageHeight)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> stream <span style="color: blue;">As</span>
System.IO.MemoryStream = <span style="color: blue;">New</span> MemoryStream()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
stream.Position = 0</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> image <span style="color: blue;">As</span> <span style="color: blue;">Byte</span>() = <span style="color: blue;">New</span> <span style="color: blue;">Byte</span>(stream.Length) {}</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
stream.Read(image, 0, image.Length)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">' Create SQL Connection</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> con <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlConnection()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> con.ConnectionString =
ConfigurationManager.ConnectionStrings(<span style="color: #a31515;">"ConnectionString"</span>).ConnectionString</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: green;">' Create SQL Command</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> cmd <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlCommand()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.CommandText = <span style="color: #a31515;">"INSERT INTO
Images(ImageName,Image) VALUES (@ImageName,@Image)"</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.CommandType = CommandType.Text</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.Connection = con</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> ImageName <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlParameter(<span style="color: #a31515;">"@ImageName"</span>,
SqlDbType.VarChar, 50)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
ImageName.Value = strImageName.ToString()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
cmd.Parameters.Add(ImageName)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> UploadedImage <span style="color: blue;">As</span> <span style="color: blue;">New</span> SqlParameter(<span style="color: #a31515;">"@Image"</span>,
SqlDbType.Image, image.Length)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
UploadedImage.Value = image</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> cmd.Parameters.Add(UploadedImage)</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
con.Open()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">Dim</span> result <span style="color: blue;">As</span> <span style="color: blue;">Integer</span> = cmd.ExecuteNonQuery()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
con.Close()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">If</span> result > 0 <span style="color: blue;">Then</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
lblMessage.Text = <span style="color: #a31515;">"File Uploaded"</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;">
GridView1.DataBind()</span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">If</span></span></div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<span style="font-family: "Georgia","serif"; font-size: 10pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Sub</span></span></div>
<div class="MsoNormal">
<span style="color: blue; font-family: "Georgia","serif"; font-size: 10pt; line-height: 115%;">End</span><span style="font-family: "Georgia","serif"; font-size: 10pt; line-height: 115%;"> <span style="color: blue;">Class</span></span><span style="font-family: "Georgia","serif";"></span></div>
</div>
</div>
<br />
<span class="fullpost">Hope this helps<br />
<br />
<b>Download sample code attached </b><br />
<a href="http://adf.ly/2N7CA" target="_blank"><img src="http://lh4.googleusercontent.com/_6FOczBbkX4I/Tdpk3o_nuGI/AAAAAAAAA0M/mZLEF4WXFL8/download.jpg" /></a> </span><br />
<br />
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="color: #984806; font-family: "Georgia","serif";">Thanks</span></b></div>
<div class="MsoNormal">
<span style="font-family: Algerian; font-size: 13pt;">Suneel Kumar</span></div>
<span class="fullpost">
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-7924194814923438312011-12-15T10:40:00.004+05:302011-12-15T10:42:45.885+05:30Select Find Nth Highest Salary Record in SQL Server<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="separator" style="clear: both; font-family: Georgia,"Times New Roman",serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRXuXKyM9MRyx1DUWkoi5Wbm4IYRgJwi46oASjIikb1FvCA10KVH9GXDy8Bf3p2sifMghMNm3CGPUw-39jOtTT_R0LTrVHkGu6gObP2I_LtJTCKTLezAj3eqYm-lPiGWcJ0eCHOvsoxE9j/s1600/2.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiRXuXKyM9MRyx1DUWkoi5Wbm4IYRgJwi46oASjIikb1FvCA10KVH9GXDy8Bf3p2sifMghMNm3CGPUw-39jOtTT_R0LTrVHkGu6gObP2I_LtJTCKTLezAj3eqYm-lPiGWcJ0eCHOvsoxE9j/s1600/2.PNG" /></a></div>
<span style="font-family: Georgia,"Times New Roman",serif;">Find or Select nth highest salary record in ms sql</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
This is most frequentky asked question how to select or get nth highest record or nth row/record from any column of sql table.</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
for example select get or fetch 2nd (second highest) or nth highest salary of employee or 10th highest record from the table. </span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
There are various ways to achieve this result, i've mentioned few here.</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;"><br />
I have created Employee table with following schema.<br />
<br />
</span><br />
<div class="separator" style="clear: both; text-align: center;">
<span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9yGXm2UgArWoD8PoPbUalCaVMbfoecFdT8oQN2wpucYslDIdI8GUuVGz9ROHF_hJAO4w0csZ9fSB61YAekk_gW2tScRRNxwuP1ZZpyerxLjhotFyBT3By9B-aolt64oB_zcDgs3PMm6XU/s1600/1.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img border="0" height="97" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj9yGXm2UgArWoD8PoPbUalCaVMbfoecFdT8oQN2wpucYslDIdI8GUuVGz9ROHF_hJAO4w0csZ9fSB61YAekk_gW2tScRRNxwuP1ZZpyerxLjhotFyBT3By9B-aolt64oB_zcDgs3PMm6XU/s320/1.PNG" width="320" /></a></span></div>
<span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;">
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<b>1st method</b><br />
<br />
To select <b>2nd highest salary</b> or record we can use following query.<br />
<br />
</span><br />
<div class="codeview">
<pre class="csharpcode"><span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;"><span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 [Salary]
<span class="kwrd">FROM</span>
(
<span class="kwrd">SELECT</span> <span class="kwrd">DISTINCT</span> <span class="kwrd">TOP</span> 2 [Salary]
<span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] <span class="kwrd">DESC</span>
) temp
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] </span></pre>
</div>
<span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;">
<br />
</span><br />
<div class="separator" style="clear: both; text-align: left;">
<span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKtDFPzbkfOQk-ftCrj663RAzTrQvaQeWz7rtKe3yChEf7HrguFfaQPHE323R4PyA56EAVsof5BUdTksb3zEA4aAQZzf38DO9mW5FEoRKrf34IimFFrNXSVP8iHMVRw3Dz4kmlCgq7yAvV/s1600/3.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="101" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiKtDFPzbkfOQk-ftCrj663RAzTrQvaQeWz7rtKe3yChEf7HrguFfaQPHE323R4PyA56EAVsof5BUdTksb3zEA4aAQZzf38DO9mW5FEoRKrf34IimFFrNXSVP8iHMVRw3Dz4kmlCgq7yAvV/s320/3.PNG" width="155" /></a></span></div>
<span class="fullpost" style="font-family: Georgia,"Times New Roman",serif;">
<br />
<b>2nd method</b><br />
<br />
To select <b>3rd highest salary</b> or record we can use following query.<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 [Salary]
<span class="kwrd">FROM</span> ( <span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 3 [Salary]
<span class="kwrd">FROM</span> [dbo].[Employee] e1 <span class="kwrd">GROUP</span> <span class="kwrd">BY</span> e1.Salary
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [e1].[Salary] <span class="kwrd">DESC</span>) e2
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary]</pre>
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqDWs08XmC0tKPmm3Rwbuy0J_B7ME5Ic7pjftXZCTLiSLJmHCdpxxck_pG7EMNYhDwyT91ONcKycO1f-GGDozmackpUoIKw2KGOvXX0yrj8IV1LXUdA2QlyHHbQtl32_VqTywl2tVKLihV/s1600/4.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="75" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhqDWs08XmC0tKPmm3Rwbuy0J_B7ME5Ic7pjftXZCTLiSLJmHCdpxxck_pG7EMNYhDwyT91ONcKycO1f-GGDozmackpUoIKw2KGOvXX0yrj8IV1LXUdA2QlyHHbQtl32_VqTywl2tVKLihV/s320/4.PNG" width="152" /></a></div>
<br />
<br />
These queries holds good untill we are selecting only salary column and
fails when we want to select all the columns or few more columns with
salary as salary can be same for more then one employees or records.<br />
<br />
For example if we change the first query to <b>select 2nd highest salary</b> with all the columns of table, output would be undesirable as shown below.<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 [Salary],[EmployeeName]
<span class="kwrd">FROM</span>
(
<span class="kwrd">SELECT</span> <span class="kwrd">DISTINCT</span> <span class="kwrd">TOP</span> 2 [Salary], [EmployeeName]
<span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] <span class="kwrd">DESC</span>
) temp
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary]
</pre>
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTWlO_VwAYJ1LOqobCFwLxAUvuQ7EsJ7EAHXSHAlZ8uc_JCNubGWLllVbR_ilyQuOwzUujh_2DbZ-NC8mJnevy0OHbMefA3b-mZ0SLhe21scJRVmIMCvazrauAErqGEagqtmgPNI54pUEp/s1600/5.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="65" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgTWlO_VwAYJ1LOqobCFwLxAUvuQ7EsJ7EAHXSHAlZ8uc_JCNubGWLllVbR_ilyQuOwzUujh_2DbZ-NC8mJnevy0OHbMefA3b-mZ0SLhe21scJRVmIMCvazrauAErqGEagqtmgPNI54pUEp/s320/5.PNG" width="194" /></a></div>
<br />
<br />
To select all columns we can use queries mentioned below.<br />
<br />
This query will give <b>4th highest salary</b> record but will show only 1 highest record if even if there are multiple duplicate salary records.<br />
<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd">SELECT</span> <span class="kwrd">TOP</span> 1 * <span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">WHERE</span> [Salary] <span class="kwrd">NOT</span> <span class="kwrd">IN</span>
(
<span class="kwrd">SELECT</span> <span class="kwrd">DISTINCT</span> <span class="kwrd">TOP</span> 3 [Salary] <span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] <span class="kwrd">DESC</span>
)
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] DESC</pre>
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvka0m0p5yEfH0_-qm1k1wXO9Coy8QLCE2cmeC7QU4pOsa7fq5UnziuoeKiKNrl4JvQQbsYk40ndggODMGxjZh3gOIHUXIs3mmBI4SpsY0zXnICpQDBQKCyMDKhFCqbyky9NeE75hOo0Tm/s1600/7.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="64" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhvka0m0p5yEfH0_-qm1k1wXO9Coy8QLCE2cmeC7QU4pOsa7fq5UnziuoeKiKNrl4JvQQbsYk40ndggODMGxjZh3gOIHUXIs3mmBI4SpsY0zXnICpQDBQKCyMDKhFCqbyky9NeE75hOo0Tm/s320/7.PNG" width="240" /></a></div>
<br />
<br />
These 2 queries will select 4th highest salary with duplicate records.<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd">SELECT</span> * <span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">WHERE</span> [Salary] =
(
<span class="kwrd">SELECT</span> <span class="kwrd">MAX</span>([Salary]) <span class="kwrd">FROM</span> [dbo].[Employee]
<span class="kwrd">WHERE</span> [Salary] <span class="kwrd">NOT</span> <span class="kwrd">IN</span>
(
<span class="kwrd">SELECT</span> <span class="kwrd">DISTINCT</span> <span class="kwrd">TOP</span> (4-1) [Salary] <span class="kwrd">FROM</span> [dbo].[Employee] e1
<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] <span class="kwrd">DESC</span>
)
)
</pre>
</div>
<br />
<div class="codeview1">
<pre class="csharpcode"><span class="kwrd">SELECT</span> *
<span class="kwrd">FROM</span> Employee E1
<span class="kwrd">WHERE</span> (4-1) = (
<span class="kwrd">SELECT</span> <span class="kwrd">COUNT</span>(<span class="kwrd">DISTINCT</span>(E2.Salary))
<span class="kwrd">FROM</span> Employee E2
<span class="kwrd">WHERE</span> E2.Salary > E1.Salary)</pre>
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6MSm7KYXVRsziU7N_wR_XhMWrcUiNI0WHcLESTa8QRMUuIjvod-VBJa8WFQI9WqHrRPf9VWVIpphrvAjb5pBYYboj7WXYGztzD1cHTIqjZIRSMwQwfqCIn3n_CE_1us7gcmLbdmeGYP0p/s1600/8.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="83" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg6MSm7KYXVRsziU7N_wR_XhMWrcUiNI0WHcLESTa8QRMUuIjvod-VBJa8WFQI9WqHrRPf9VWVIpphrvAjb5pBYYboj7WXYGztzD1cHTIqjZIRSMwQwfqCIn3n_CE_1us7gcmLbdmeGYP0p/s320/8.PNG" width="241" /></a></div>
<br />
<br />
We can also use sql ranking function to get desired result as follows.<br />
<br />
<div class="codeview">
<pre class="csharpcode"><span class="kwrd">SELECT</span> * <span class="kwrd">FROM</span>
(
<span class="kwrd">SELECT</span> DENSE_RANK() <span class="kwrd">OVER</span>(<span class="kwrd">ORDER</span> <span class="kwrd">BY</span> [Salary] <span class="kwrd">DESC</span>)<span class="kwrd">AS</span> RowId, *
<span class="kwrd">FROM</span> [dbo].[Employee]
) <span class="kwrd">AS</span> e1
<span class="kwrd">WHERE</span> e1.RowId = 4 </pre>
</div>
<br />
<div class="separator" style="clear: both; text-align: left;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKKHugTTSgalFeWCzBR6sxcTPXLh5jnWFRqs1D3dhWHSDLFuo-NU0kSrrsauBEJ2cZ1DcBYng1ugh_YQKB7ER9tu8mWmVI5lZjWRoPaQxstTeU7Dnz9OH7bOlNo9-2tCnhpcWxBtmeTJqj/s1600/9.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" height="91" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjKKHugTTSgalFeWCzBR6sxcTPXLh5jnWFRqs1D3dhWHSDLFuo-NU0kSrrsauBEJ2cZ1DcBYng1ugh_YQKB7ER9tu8mWmVI5lZjWRoPaQxstTeU7Dnz9OH7bOlNo9-2tCnhpcWxBtmeTJqj/s320/9.PNG" width="286" /></a></div>
</span><span class="data-post"><div class="MsoNormal">
</div>
<div class="MsoNormal">
<b><span style="color: #984806; font-family: "Georgia","serif";">Thanks </span></b></div>
<div class="MsoNormal">
<span style="font-family: Algerian; font-size: 13pt;">Suneel Kumar</span></div>
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-81571862735323579822011-12-15T10:24:00.001+05:302011-12-15T10:43:10.672+05:30Remove Delete Duplicate Records or Rows - SQL Server<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="separator" style="clear: both; font-family: Georgia,"Times New Roman",serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5soub_QkPM0I5ajwUlCK04i4wlxY1E2gSq5rYGVKsRGvaORC08jdetJFl03uuzKjskMwvwUTW1boawWIC78jc16srt2GJEfqzQPx9Rask_TpRflBDrv7H0KVyZqF82sLblmIUH_FNOrxV/s1600/DeleteDuplicateRecordsInSql.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Delete Duplicate Records In Sql" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5soub_QkPM0I5ajwUlCK04i4wlxY1E2gSq5rYGVKsRGvaORC08jdetJFl03uuzKjskMwvwUTW1boawWIC78jc16srt2GJEfqzQPx9Rask_TpRflBDrv7H0KVyZqF82sLblmIUH_FNOrxV/s320/DeleteDuplicateRecordsInSql.PNG" /></a></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>Remove or Delete duplicate records or rows from ms sql server database table.</b></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
In this post i am going to describe different methods of deleting duplicate records or rows from sql server database table.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
I am using Employees table with FirstName and Department columns.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span class="fullpost"><br />
</span></div>
<div class="separator" style="clear: both; font-family: Georgia,"Times New Roman",serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpEhQCkQIEqIpOwVQ6RW6Z5_iRTYgPax0PYPSPI9di4B548gC_07foSf-SKe_X5Ml6CqHGqHPeP2mjIi4RG5THUAtxwp48bwtQ4WJ-PzG6-TGE5-unpxR2oMTg3pmAye5_0AJ3g25c9rl-/s1600/RemoveDuplicateRecordsInSql.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Remove Duplicate Records In Sql" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhpEhQCkQIEqIpOwVQ6RW6Z5_iRTYgPax0PYPSPI9di4B548gC_07foSf-SKe_X5Ml6CqHGqHPeP2mjIi4RG5THUAtxwp48bwtQ4WJ-PzG6-TGE5-unpxR2oMTg3pmAye5_0AJ3g25c9rl-/s320/RemoveDuplicateRecordsInSql.PNG" /></a></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>First Method.</b></div>
<h3 style="font-family: Georgia,"Times New Roman",serif;">
Delete duplicate records/rows by creating identity column.</h3>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
duplicate records in table looks like shown in first image.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
First of all we need to <b>create a identity column</b> in our table by <b>using code mentioned below.</b></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
And table will look like image on the left. </div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="syntaxhighlighter" id="highlighter_194915" style="font-family: Georgia,"Times New Roman",serif;">
<div class="lines">
<div class="line alt1">
<code class="number bg" style="height: 14px; top: 1px;">1</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">ALTER TABLE dbo.Employees ADD ID INT IDENTITY(1,1)</code></span></span></div>
</div>
</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>Now write this query to delete duplicate rows.</b></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="syntaxhighlighter" id="highlighter_681355" style="font-family: Georgia,"Times New Roman",serif;">
<div class="lines">
<div class="line alt1">
<code class="number bg" style="height: 43px; top: 1px;">1</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">DELETE FROM dbo.Employees</code></span></span></div>
<div class="line alt2">
<code class="number">2</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">WHERE ID NOT IN (SELECT MIN(ID)</code></span></span></div>
<div class="line alt1">
<code class="number">3</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">FROM dbo.Employees GROUP BY FirstName,Department)</code></span></span></div>
</div>
</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
This should remove all duplicate records from table.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>Second Method.</b></div>
<h3 style="font-family: Georgia,"Times New Roman",serif;">
Delete duplicate records using Row_Number()</h3>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
If you do not want to make any changes in table design or don't want to
create identity column on table then you can remove duplicate records <b>using Row_Number in sql server 2005 onwards</b>.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
for this write below mentioned code and execute.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="syntaxhighlighter" id="highlighter_171374" style="font-family: Georgia,"Times New Roman",serif;">
<div class="lines">
<div class="line alt1">
<code class="number bg" style="height: 129px; top: 1px;">1</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">WITH DuplicateRecords AS</code></span></span></div>
<div class="line alt2">
<code class="number">2</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">(</code></span></span></div>
<div class="line alt1">
<code class="number">3</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">SELECT *,row_number() OVER(PARTITION BY FirstName,Department ORDER BY </code></span></span></div>
<div class="line alt2">
<code class="number">4</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="blankLine"> </code></span></span></div>
<div class="line alt1">
<code class="number">5</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">FirstName) </code></span></span></div>
<div class="line alt2">
<code class="number">6</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">AS RowNumber FROM dbo.Employees</code></span></span></div>
<div class="line alt1">
<code class="number">7</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">)</code></span></span></div>
<div class="line alt2">
<code class="number">8</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">DELETE FROM DuplicateRecords WHERE RowNumber>1</code></span></span></div>
</div>
</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
This should remove all duplicate records from table.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<b>Third Method.</b></div>
<h3 style="font-family: Georgia,"Times New Roman",serif;">
Remove duplicate rows/Records using temporary table</h3>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
Use below mentioned code to delete duplicates by moving them to temporary table using DISTINCT.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="syntaxhighlighter" id="highlighter_653309" style="font-family: Georgia,"Times New Roman",serif;">
<div class="lines">
<div class="line alt1">
<code class="number bg" style="height: 129px; top: 1px;">1</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">SELECT DISTINCT * INTO TempTable FROM dbo.Employees</code></span></span></div>
<div class="line alt2">
<code class="number">2</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">GROUP BY FirstName,Department</code></span></span></div>
<div class="line alt1">
<code class="number">3</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">HAVING COUNT(FirstName) > 1</code></span></span></div>
<div class="line alt2">
<code class="number">4</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="blankLine"> </code></span></span></div>
<div class="line alt1">
<code class="number">5</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">DELETE dbo.Employees WHERE FirstName</code></span></span></div>
<div class="line alt2">
<code class="number">6</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">IN (SELECT FirstName FROM TempTable)</code></span></span></div>
<div class="line alt1">
<code class="number">7</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="blankLine"> </code></span></span></div>
<div class="line alt2">
<code class="number">8</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">INSERT dbo.Employees SELECT * FROM TempTable</code></span></span></div>
<div class="line alt1">
<code class="number">9</code><span class="content"><span class="block" style="background-position: 0px 1.2em ! important; padding-left: 21px ! important; text-indent: -21px ! important;"><code class="plain">DROP TABLE TempTable</code></span></span></div>
</div>
</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="separator" style="clear: both; font-family: Georgia,"Times New Roman",serif; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWDS5fuw85_x2_gyR8m24B6-LxjDGMpO4RtBOVv9-cZaChdyQFCCg8YDzrwjUoImgrB8a5eeBjIMw6OrNsnI0SNy67s3TGKU_44ljrDvJWUdlvMgxuIWNVyCCjBnbDyvlD8kOSyxTePUQ4/s1600/RemoveDuplicateRowsInSql.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Remove delete Duplicate Rows In Sql" border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhWDS5fuw85_x2_gyR8m24B6-LxjDGMpO4RtBOVv9-cZaChdyQFCCg8YDzrwjUoImgrB8a5eeBjIMw6OrNsnI0SNy67s3TGKU_44ljrDvJWUdlvMgxuIWNVyCCjBnbDyvlD8kOSyxTePUQ4/s320/RemoveDuplicateRowsInSql.PNG" /></a></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
And result will be as shown.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
Have fun.</div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span class="fullpost"><br />
</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<span class="fullpost"><br />
</span></div>
<div style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<b><span style="color: #984806;">Thanks </span></b></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: 13pt;">Suneel Kumar</span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-52339719734189811022011-12-15T10:20:00.000+05:302011-12-15T10:20:04.675+05:30Create Setup And Deployment Project in Visual Studio 2008/2010<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM8KcDWzIQjLE6yo0umJgQMJpvOx2PW8nypk2YxMYSXyw7eag-wq7Yaubbv84X8OZnIru89k15qJUzYKQvtVuFAlhHsngJJJmm3m_JLdnk3xps_st21D3Y6obV1CZxxM7mD4L6PmT0nKsi/s1600/CreateSetupProjectInVisualStudio.PNG" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;" target="_blank"><img alt="Create setup Project In Visual Studio" border="0" height="262" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhM8KcDWzIQjLE6yo0umJgQMJpvOx2PW8nypk2YxMYSXyw7eag-wq7Yaubbv84X8OZnIru89k15qJUzYKQvtVuFAlhHsngJJJmm3m_JLdnk3xps_st21D3Y6obV1CZxxM7mD4L6PmT0nKsi/s320/CreateSetupProjectInVisualStudio.PNG" width="320" /></a></div>
<br />
In this example i am going to explain how to create setup and deployment
project for winforms windows application using visual studio
2005/2008/2010. <br />
<br />
Similar approach can be applied for creating setup project for web application as well.<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<span class="fullpost"><br />
<b>First of all create any sample windows/web application.</b><br />
<br />
<h3>
Create setup project <br />
</h3>
<div>
right click on solution explorer root and select Add > New project </div>
<div>
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIGuCS7yhH-VV2Xm8OHgj4Jull-KKR-P6AQqaJxBGLSJd2JlIR_rdP1x0VLB-SbQt1MibsGfpGjMaZP4R-LnmhgM2yD62xdfAukq_tFd5mHSghis76Jt9HYD5yGhaMrtc7pRoJQ8GfUFHR/s1600/CreateSetupProject1.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIGuCS7yhH-VV2Xm8OHgj4Jull-KKR-P6AQqaJxBGLSJd2JlIR_rdP1x0VLB-SbQt1MibsGfpGjMaZP4R-LnmhgM2yD62xdfAukq_tFd5mHSghis76Jt9HYD5yGhaMrtc7pRoJQ8GfUFHR/s1600/CreateSetupProject1.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
In add new project dialog box select setup and deployment from other project types and then select Setup Project.</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzfLRD12lZ8E83ZIUH0Rv58F201bf3bZGE30vLZSVipNjhLqT5VCwvGQPlGX9zHd-bI7il48R_Z4jfGEMj8ubKsEy6r45xVdfw7WlJhMSAXPidNqnSyaPljp8CQqship4PjHwN4JJTFvr/s1600/CreateSetupProject2.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgMzfLRD12lZ8E83ZIUH0Rv58F201bf3bZGE30vLZSVipNjhLqT5VCwvGQPlGX9zHd-bI7il48R_Z4jfGEMj8ubKsEy6r45xVdfw7WlJhMSAXPidNqnSyaPljp8CQqship4PjHwN4JJTFvr/s1600/CreateSetupProject2.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
In the setup project file system editor window, right click on Application folder > Add > Project Output </div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz77lfv0Sy96GwpX7MlQy-rdpGiz_dvoXpNYSPD-PQ5VaxaAnioNbmFRweAGMivVwNOPUYq9nbpfyFGHmipt_fkKYZhRmFjp28d2ZBB8VVSoyaNZplD0DCuVeO_6_Dvd1okdXvjuSbsJQh/s1600/CreateSetupProject3.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiz77lfv0Sy96GwpX7MlQy-rdpGiz_dvoXpNYSPD-PQ5VaxaAnioNbmFRweAGMivVwNOPUYq9nbpfyFGHmipt_fkKYZhRmFjp28d2ZBB8VVSoyaNZplD0DCuVeO_6_Dvd1okdXvjuSbsJQh/s1600/CreateSetupProject3.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
Now select primary output from next dialog box and click on OK.</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuVj_vgfJQL_rrMZP63vD6wuJQpeWS-uACqla3XfEjPDFjjj6DoUrfPeXV36xHrzgzH7LdmrLIY3M8_5T_C0aiojwY7KcvXtbfgP3bIr3ywmWL3py95KfQZ6ClPiGs_fitC4zNfVQ61J9W/s1600/setupProject4.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjuVj_vgfJQL_rrMZP63vD6wuJQpeWS-uACqla3XfEjPDFjjj6DoUrfPeXV36xHrzgzH7LdmrLIY3M8_5T_C0aiojwY7KcvXtbfgP3bIr3ywmWL3py95KfQZ6ClPiGs_fitC4zNfVQ61J9W/s1600/setupProject4.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDtl9pkIzELrtRVIfT0kTKAj8-dAYN1LqwpAadhVJnKUvsKTQO4_rYRTXaZE7mOdW27kstC4puTpkImDZlKt9mKQ3Nx49DStteGD0cNizeV1WsZfpzf4Y6gaIC4QvdFETvav2ji_GsNv_G/s1600/setupProject5.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjDtl9pkIzELrtRVIfT0kTKAj8-dAYN1LqwpAadhVJnKUvsKTQO4_rYRTXaZE7mOdW27kstC4puTpkImDZlKt9mKQ3Nx49DStteGD0cNizeV1WsZfpzf4Y6gaIC4QvdFETvav2ji_GsNv_G/s1600/setupProject5.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
Right click on User's desktop and create shortcut to primary output in application folder.</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrcIZ456hJovNoheusCaoxNPTd3nJWJiqyVLDE5UXGSepBX4mcfVQdMxBIy-nHpmOnW8ll21TJ8b0nAaCOhCl6aQtyGRnO_SgTg2p7yWBQdDlV4nxayZpZKexiDmqHArfjOZbhvLzOeD9t/s1600/setupProject6.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhrcIZ456hJovNoheusCaoxNPTd3nJWJiqyVLDE5UXGSepBX4mcfVQdMxBIy-nHpmOnW8ll21TJ8b0nAaCOhCl6aQtyGRnO_SgTg2p7yWBQdDlV4nxayZpZKexiDmqHArfjOZbhvLzOeD9t/s1600/setupProject6.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
Similarly add shortcut in user's program menu.</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Q3uav5eYiC9eIC6v8SDn4EgLZPO66olyi6_o4aJHyW_B-vyvwdFyV2gy3lgR8NqV_k1pRZcx14sjlCwoBGTLRczvt2NBn5KjdjFIAYWlrqQU9dypAgIu6bEGOCUIIufol9mzwu_1qkpT/s1600/7.PNG" style="margin-left: 1em; margin-right: 1em;" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh0Q3uav5eYiC9eIC6v8SDn4EgLZPO66olyi6_o4aJHyW_B-vyvwdFyV2gy3lgR8NqV_k1pRZcx14sjlCwoBGTLRczvt2NBn5KjdjFIAYWlrqQU9dypAgIu6bEGOCUIIufol9mzwu_1qkpT/s1600/7.PNG" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
Build the project by right clicking on setup project name and run the setup.</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
Hope this helps </div>
<div style="text-align: left;">
</div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
<b>Download the sample code attached</b> </div>
<div class="separator" style="clear: both; text-align: left;">
<br />
</div>
<div class="separator" style="clear: both; text-align: left;">
<a href="http://adf.ly/2N2gU" target="_blank"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhaKjs71_fGQEVRkYZtS0V6KtHI0CJLqCJen8J7N9vfdtFKbUNGUSfkbgVJDrQCrOx-yGsuqFciuQAymhjEqbEELs5WhiE7q-vHO2l3eNjzNV8i4lOVGrrKMduzZ_9Fdsj77anymcDT4Bc0/s1600/download.jpg" /> </a></div>
<div class="separator" style="clear: both; text-align: left;">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
<div class="MsoNormal">
<br /></div>
<div class="MsoNormal">
<b><span style="color: #984806; font-family: "Georgia","serif";">Thanks <span style="mso-spacerun: yes;"></span></span></b></div>
<div class="MsoNormal">
<span style="font-family: Algerian; font-size: 13.0pt; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-IN; mso-fareast-theme-font: minor-fareast; mso-no-proof: yes;">Suneel Kumar</span></div>
</div>
</span></div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-12379338086758970072011-12-14T12:47:00.002+05:302011-12-14T12:48:33.097+05:30how to convert web page to pdf<div dir="ltr" style="text-align: left;" trbidi="on">
<div style="font-family: Georgia,"Times New Roman",serif;">
</div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">In this post i will show how
to convert web page to pdf using iTextSharp.</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<div class="post-header-line-1">
<br />
</div>
<div class="post-body entry-content">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjICrrgu4cM8_g-HNHtxPtJcESTXAEsWUotYCkImWpXRCf4RSDC4Kf5qZkKo6RZJm_TIwLeW5a9_cTI_Ps5ov0I6mAOoPXQS4kSUqu7DzxjoNCXxVIb0bI8gLPzB9qs0vuWhYT2CrI8bLKB/s1600-h/pdf.jpg"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5322004776815277282" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjICrrgu4cM8_g-HNHtxPtJcESTXAEsWUotYCkImWpXRCf4RSDC4Kf5qZkKo6RZJm_TIwLeW5a9_cTI_Ps5ov0I6mAOoPXQS4kSUqu7DzxjoNCXxVIb0bI8gLPzB9qs0vuWhYT2CrI8bLKB/s400/pdf.jpg" style="cursor: pointer; display: block; height: 250px; margin: 0px auto 10px; text-align: center; width: 400px;" /></a></div>
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="background: none repeat scroll 0% 0% yellow; font-size: 10pt;"><%</span><span style="color: blue; font-size: 10pt;">@</span><span style="font-size: 10pt;"> <span style="color: #a31515;">Page</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span>
<span style="color: red;">AutoEventWireup</span><span style="color: blue;">="true"</span>
<span style="color: red;">CodeFile</span><span style="color: blue;">="Pdf.aspx.cs"</span>
<span style="color: red;">Inherits</span><span style="color: blue;">="Pdf"</span>
<span style="background: none repeat scroll 0% 0% yellow;">%></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><!</span><span style="color: #a31515; font-size: 10pt;">DOCTYPE</span><span style="font-size: 10pt;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span>
<span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span>
<span style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">html</span><span style="font-size: 10pt;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="font-size: 10pt;"> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">title</span><span style="color: blue;">></</span><span style="color: #a31515;">title</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">PlaceHolder</span> <span style="color: red;">ID</span><span style="color: blue;">="PlaceholderPdf"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">PlaceHolder</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">table</span> <span style="color: red;">border</span><span style="color: blue;">="1"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">td</span> <span style="color: red;">colspan</span><span style="color: blue;">="2"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> aspdotnetcodebook</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> cell1</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> cell2</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">td</span> <span style="color: red;">colspan</span><span style="color: blue;">="2"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Label</span> <span style="color: red;">ID</span><span style="color: blue;">="lblLabel"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">Text</span><span style="color: blue;">="Label Test"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Label</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">td</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">tr</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">table</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;"></</span><span style="color: #a31515;">form</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="color: blue; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-size: 10pt; line-height: 115%;">html</span><span style="color: blue; font-size: 10pt; line-height: 115%;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
</div>
<div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; mso-layout-grid-align: none; text-autospace: none;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Collections.Generic;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Linq;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.WebControls;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System.IO;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Text.RegularExpressions;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.pdf;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.html;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.xml;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Xml;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.html.simpleparser;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">public</span><span style="font-size: 10pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">Pdf</span> : System.Web.UI.Page</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">protected</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span>
Render(HtmlTextWriter writer)</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> {</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: #2b91af;">MemoryStream</span>
mem = <span style="color: blue;">new</span> <span style="color: #2b91af;">MemoryStream</span>();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: #2b91af;">StreamWriter</span>
twr = <span style="color: blue;">new</span> <span style="color: #2b91af;">StreamWriter</span>(mem);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> HtmlTextWriter myWriter = <span style="color: blue;">new</span> HtmlTextWriter(twr);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">base</span>.Render(myWriter);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> myWriter.Flush();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> myWriter.Dispose();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: #2b91af;">StreamReader</span>
strmRdr = <span style="color: blue;">new</span> <span style="color: #2b91af;">StreamReader</span>(mem);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> strmRdr.BaseStream.Position = 0;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">string</span>
pageContent = strmRdr.ReadToEnd();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> strmRdr.Dispose();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> mem.Dispose();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> writer.Write(pageContent);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> CreatePDFDocument(pageContent);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> }</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span>
CreatePDFDocument(<span style="color: blue;">string</span> strHtml)</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> {</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">string</span>
strFileName = HttpContext.Current.Server.MapPath(<span style="color: #a31515;">"test.pdf"</span>);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: green;">// step 1:
creation of a document-object</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Document document = <span style="color: blue;">new</span> Document();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: green;">// step 2:</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: green;">// we create
a writer that listens to the document</span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> PdfWriter.GetInstance(document, <span style="color: blue;">new</span> <span style="color: #2b91af;">FileStream</span>(strFileName,
<span style="color: #2b91af;">FileMode</span>.Create));</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: #2b91af;">StringReader</span>
se = <span style="color: blue;">new</span> <span style="color: #2b91af;">StringReader</span>(strHtml);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> HTMLWorker obj = <span style="color: blue;">new</span> HTMLWorker(document);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> document.Open();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> obj.Parse(se);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> document.Close();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> ShowPdf(strFileName);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> </span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> }</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> <span style="color: blue;">public</span> <span style="color: blue;">void</span> ShowPdf(<span style="color: blue;">string</span>
strFileName)</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> {</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.ClearContent();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.ClearHeaders();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.AddHeader(<span style="color: #a31515;">"Content-Disposition"</span>, <span style="color: #a31515;">"inline;filename="</span> + strFileName);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.ContentType = <span style="color: #a31515;">"application/pdf"</span>;</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.WriteFile(strFileName);</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.Flush();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> Response.Clear();</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"> }</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: 10pt; line-height: 115%;">}</span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><br />
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-47412044351512072922011-12-14T12:41:00.002+05:302011-12-14T12:41:49.970+05:30Export Html to Pdf using iTextSharp(GridView)<div dir="ltr" style="text-align: left;" trbidi="on">
<div class="post-header-line-1" style="font-family: Georgia,"Times New Roman",serif;">
<br /><br />
</div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span>
<div style="font-family: Georgia,"Times New Roman",serif;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5cABE_NdsQ3f65ztxOvusT4i_gPbX8S84ITKbe6wgZQ7mW0Yki5RDGdeXx4LNddW9W1cFZveLaK1fOd_CWq-jwUDcSRURq1uZQ4r0BNnEo2uueT6MkEU7wPLVvYQsmRPxtsKEGEI7n22v/s1600-h/a_grid.JPG"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5226173926257664418" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj5cABE_NdsQ3f65ztxOvusT4i_gPbX8S84ITKbe6wgZQ7mW0Yki5RDGdeXx4LNddW9W1cFZveLaK1fOd_CWq-jwUDcSRURq1uZQ4r0BNnEo2uueT6MkEU7wPLVvYQsmRPxtsKEGEI7n22v/s400/a_grid.JPG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /></a><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivfVMnUdbKyW7TACi0ruxMhAjqR7sae7XXH-mibItMccnPy383GggUHJfkG_67Utz5W5BzEPYhYiKvXNJNAwckq81tri9duuHEICiPS8ICI072gvKlD4SJM88R6-2Lbaqd5Cwdg6Xmrg1H/s1600-h/b_grid.JPG"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5226173812000649874" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivfVMnUdbKyW7TACi0ruxMhAjqR7sae7XXH-mibItMccnPy383GggUHJfkG_67Utz5W5BzEPYhYiKvXNJNAwckq81tri9duuHEICiPS8ICI072gvKlD4SJM88R6-2Lbaqd5Cwdg6Xmrg1H/s400/b_grid.JPG" style="cursor: pointer; display: block; margin: 0px auto 10px; text-align: center;" /></a> </div>
<div style="font-family: Georgia,"Times New Roman",serif;">
</div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="background: none repeat scroll 0% 0% yellow; font-size: 10pt;"><%</span><span style="color: blue; font-size: 10pt;">@</span><span style="font-size: 10pt;"> <span style="color: #a31515;">Page</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span>
<span style="color: red;">AutoEventWireup</span><span style="color: blue;">="true"</span>
<span style="color: red;">CodeFile</span><span style="color: blue;">="Pdf.aspx.cs"</span>
<span style="color: red;">Inherits</span><span style="color: blue;">="Pdf"</span>
<span style="background: yellow; mso-highlight: yellow;">%></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><!</span><span style="color: #a31515; font-size: 10pt;">DOCTYPE</span><span style="font-size: 10pt;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span>
<span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span>
<span style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">html</span><span style="font-size: 10pt;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="font-size: 10pt;"> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">title</span><span style="color: blue; font-size: 10pt;">></span><span style="font-size: 10pt;">Untitled Page<span style="color: blue;"></</span><span style="color: #a31515;">title</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">form</span><span style="font-size: 10pt;"> <span style="color: red;">id</span><span style="color: blue;">="form1"</span>
<span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">GridView</span> <span style="color: red;">ID</span><span style="color: blue;">="GridView1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"></</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">GridView</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">asp</span><span style="color: blue;">:</span><span style="color: #a31515;">Button</span> <span style="color: red;">ID</span><span style="color: blue;">="Button1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"</span> <span style="color: red;">OnClick</span><span style="color: blue;">="Button1_Click"</span> <span style="color: red;">Text</span><span style="color: blue;">="Pdf"</span> <span style="color: blue;">/></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">form</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="color: blue; font-size: 10pt; line-height: 115%;"></</span><span style="color: #a31515; font-size: 10pt; line-height: 115%;">html</span><span style="color: blue; font-size: 10pt; line-height: 115%;">></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span><pre class="csharpcode" style="font-family: Georgia,"Times New Roman",serif;"><pre class="csharpcode"><!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
</pre>
</pre>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Data;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Configuration;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Collections;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.Security;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.WebControls;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System.Web.UI.WebControls.WebParts;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.HtmlControls;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.pdf;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System.IO;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
iTextSharp.text.html;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">public</span><span style="font-size: 10pt;"> <span style="color: blue;">partial</span> <span style="color: blue;">class</span> <span style="color: #2b91af;">Pdf</span> : MyPage</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">protected</span><span style="font-size: 10pt;"> <span style="color: blue;">void</span> Page_Load(<span style="color: blue;">object</span>
sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">if</span>
(!IsPostBack)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>GridView1.DataSource = GetData();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>GridView1.DataBind();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">protected</span><span style="font-size: 10pt;"> <span style="color: blue;">void</span> Button1_Click(<span style="color: blue;">object</span>
sender, <span style="color: #2b91af;">EventArgs</span> e)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>MyPage tmpPage = <span style="color: blue;">new</span>
MyPage();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>HtmlForm form = <span style="color: blue;">new</span>
HtmlForm();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>form.Controls.Add(GridView1);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>tmpPage.Controls.Add(form);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: #2b91af;">StringWriter</span>
sw = <span style="color: blue;">new</span> <span style="color: #2b91af;">StringWriter</span>();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>HtmlTextWriter htmlWriter = <span style="color: blue;">new</span> HtmlTextWriter(sw);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>form.Controls[0].RenderControl(htmlWriter);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">string</span>
htmlContent = sw.ToString();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Document document = <span style="color: blue;">new</span> Document();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// step 2:</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// we create a
writer that listens to the document</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// and directs a
PDF-stream to a file</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>PdfWriter.GetInstance(document, <span style="color: blue;">new</span> <span style="color: #2b91af;">FileStream</span>(<span style="color: #a31515;">"c:\\Chap0101.pdf"</span>, <span style="color: #2b91af;">FileMode</span>.Create));</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// step 3: we
open the document</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>document.Open();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// step 4: we add
a paragraph to the document</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">//document.Add(new
Paragraph(htmlContent.ToString()));</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>System.Xml.XmlTextReader _xmlr = <span style="color: blue;">new</span> System.Xml.XmlTextReader(<span style="color: blue;">new</span>
<span style="color: #2b91af;">StringReader</span>(htmlContent));</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>HtmlParser.Parse(document, _xmlr);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: green;">// step 5: we
close the document</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>document.Close();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>ShowPdf(<span style="color: #a31515;">"c:\\Chap0101.pdf"</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">private</span><span style="font-size: 10pt;"> <span style="color: blue;">void</span> ShowPdf(<span style="color: blue;">string</span>
s)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.ClearContent();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.ClearHeaders();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.AddHeader(<span style="color: #a31515;">"Content-Disposition"</span>,
<span style="color: #a31515;">"inline;filename="</span> + s);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.ContentType = <span style="color: #a31515;">"application/pdf"</span>;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.WriteFile(s);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.Flush();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Response.Clear();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">public</span><span style="font-size: 10pt;"> DataSet
GetData()</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>DataSet ds = <span style="color: blue;">new</span>
DataSet();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>DataTable dt = <span style="color: blue;">new</span>
DataTable(<span style="color: #a31515;">"Product"</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>DataRow dr;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dt.Columns.Add(<span style="color: blue;">new</span>
DataColumn(<span style="color: #a31515;">"Price"</span>, <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">Int32</span>)));</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dt.Columns.Add(<span style="color: blue;">new</span>
DataColumn(<span style="color: #a31515;">"DisCount"</span>, <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">Int32</span>)));</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dt.Columns.Add(<span style="color: blue;">new</span>
DataColumn(<span style="color: #a31515;">"SellPrice"</span>, <span style="color: blue;">typeof</span>(<span style="color: #2b91af;">Int32</span>)));</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">for</span> (<span style="color: blue;">int</span> i = 1; i <= 10; i++)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dr = dt.NewRow();</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dr[0] = i;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dr[1] = i * 2;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dr[2] = 1 * 3;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>dt.Rows.Add(dr);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>ds.Tables.Add(dt);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>Session[<span style="color: #a31515;">"dt"</span>]
= dt;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">return</span> ds;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]-->
</div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: green; font-size: 10pt;">//*Create a new
clas Mypage.cs in app_code folder.</span><span style="font-size: 10pt;"></span></div>
<span style="font-family: Georgia,"Times New Roman",serif;">
</span>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;"> System;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Data;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Configuration;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.Security;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.WebControls;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.WebControls.WebParts;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">using</span><span style="font-size: 10pt;">
System.Web.UI.HtmlControls;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: grey; font-size: 10pt;">///</span><span style="color: green; font-size: 10pt;"> </span><span style="color: grey; font-size: 10pt;"><summary></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: grey; font-size: 10pt;">///</span><span style="color: green; font-size: 10pt;"> Summary description for MyPage</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: grey; font-size: 10pt;">///</span><span style="color: green; font-size: 10pt;"> </span><span style="color: grey; font-size: 10pt;"></summary></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;">public</span><span style="font-size: 10pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">MyPage</span> :
Page</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;">{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">public</span> <span style="color: blue;">override</span> <span style="color: blue;">void</span>
VerifyRenderingInServerForm(Control control)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>{</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>GridView grid = control <span style="color: blue;">as</span> GridView;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">if</span> (grid
!= <span style="color: blue;">null</span> && grid.ID == <span style="color: #a31515;">"GridView1"</span>)</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">return</span>;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">else</span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">base</span>.VerifyRenderingInServerForm(control);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<span style="font-size: 10pt; line-height: 115%;">}</span></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-4351619417399788662011-12-14T12:33:00.000+05:302011-12-14T12:33:35.219+05:30How To Create control at runtime using javascript<div dir="ltr" style="text-align: left;" trbidi="on">
<!--[if gte mso 9]><xml>
<w:WordDocument>
<w:View>Normal</w:View>
<w:Zoom>0</w:Zoom>
<w:TrackMoves/>
<w:TrackFormatting/>
<w:PunctuationKerning/>
<w:ValidateAgainstSchemas/>
<w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
<w:IgnoreMixedContent>false</w:IgnoreMixedContent>
<w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
<w:DoNotPromoteQF/>
<w:LidThemeOther>EN-IN</w:LidThemeOther>
<w:LidThemeAsian>X-NONE</w:LidThemeAsian>
<w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
<w:Compatibility>
<w:BreakWrappedTables/>
<w:SnapToGridInCell/>
<w:WrapTextWithPunct/>
<w:UseAsianBreakRules/>
<w:DontGrowAutofit/>
<w:SplitPgBreakAndParaMark/>
<w:DontVertAlignCellWithSp/>
<w:DontBreakConstrainedForcedTables/>
<w:DontVertAlignInTxbx/>
<w:Word11KerningPairs/>
<w:CachedColBalance/>
</w:Compatibility>
<w:BrowserLevel>MicrosoftInternetExplorer4</w:BrowserLevel>
<m:mathPr>
<m:mathFont m:val="Cambria Math"/>
<m:brkBin m:val="before"/>
<m:brkBinSub m:val="--"/>
<m:smallFrac m:val="off"/>
<m:dispDef/>
<m:lMargin m:val="0"/>
<m:rMargin m:val="0"/>
<m:defJc m:val="centerGroup"/>
<m:wrapIndent m:val="1440"/>
<m:intLim m:val="subSup"/>
<m:naryLim m:val="undOvr"/>
</m:mathPr></w:WordDocument>
</xml><![endif]--><!--[if gte mso 9]><xml>
<w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267">
<w:LsdException Locked="false" Priority="0" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
<w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
<w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
<w:LsdException Locked="false" Priority="39" Name="toc 1"/>
<w:LsdException Locked="false" Priority="39" Name="toc 2"/>
<w:LsdException Locked="false" Priority="39" Name="toc 3"/>
<w:LsdException Locked="false" Priority="39" Name="toc 4"/>
<w:LsdException Locked="false" Priority="39" Name="toc 5"/>
<w:LsdException Locked="false" Priority="39" Name="toc 6"/>
<w:LsdException Locked="false" Priority="39" Name="toc 7"/>
<w:LsdException Locked="false" Priority="39" Name="toc 8"/>
<w:LsdException Locked="false" Priority="39" Name="toc 9"/>
<w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
<w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title"/>
<w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
<w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
<w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
<w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
<w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
<w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
<w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
<w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
<w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
<w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
<w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
<w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6"/>
<w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
<w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
<w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
<w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
<w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
<w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
<w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
<w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
<w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6"/>
<w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
<w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
<w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
<w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
<w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
<w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
<w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
<w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
<w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
<w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
</w:LatentStyles>
</xml><![endif]--><!--[if gte mso 10]>
<style>
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
line-height:115%;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
</style>
<![endif]--><span style="font-size: 10pt;"></span>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="background: none repeat scroll 0% 0% yellow; font-size: 10pt;"><%</span><span style="color: blue; font-size: 10pt;">@</span><span style="font-size: 10pt;"> <span style="color: #a31515;">Page</span> <span style="color: red;">Language</span><span style="color: blue;">="C#"</span>
<span style="color: red;">AutoEventWireup</span><span style="color: blue;">="true"</span>
<span style="color: red;">CodeFile</span><span style="color: blue;">="AddRemoveJavascript.aspx.cs"</span>
<span style="color: red;">Inherits</span><span style="color: blue;">="AddRemoveJavascript"</span>
<span style="background: yellow; mso-highlight: yellow;">%></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><!</span><span style="color: #a31515; font-size: 10pt;">DOCTYPE</span><span style="font-size: 10pt;"> <span style="color: red;">html</span> <span style="color: red;">PUBLIC</span>
<span style="color: blue;">"-//W3C//DTD XHTML 1.0 Transitional//EN"</span>
<span style="color: blue;">"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">html</span><span style="font-size: 10pt;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="font-size: 10pt;"> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">title</span><span style="color: blue;">></</span><span style="color: #a31515;">title</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">script</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">function</span>
addElement() {</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
ni = document.getElementById(<span style="color: #a31515;">'myDiv'</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
numi = document.getElementById(<span style="color: #a31515;">'theValue'</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
num = (document.getElementById(<span style="color: #a31515;">'theValue'</span>).value
- 1) + 2;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>numi.value = num;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
newdiv = document.createElement(<span style="color: #a31515;">'div'</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
divIdName = <span style="color: #a31515;">'my'</span> + num + <span style="color: #a31515;">'Div'</span>;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>newdiv.setAttribute(<span style="color: #a31515;">'id'</span>, divIdName);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>newdiv.innerHTML = <span style="color: #a31515;">"Element Number "</span> + num + <span style="color: #a31515;">" has been added! <a
href=\"javascript:;\" onclick=\"removeElement(\'"</span> +
divIdName + <span style="color: #a31515;">"\')\">Remove the element
&quot;"</span> + divIdName + <span style="color: #a31515;">"&quot;</a>"</span>;</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>ni.appendChild(newdiv);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">function</span>
removeElement(divNum) {</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
d = document.getElementById(<span style="color: #a31515;">'myDiv'</span>);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;">var</span>
olddiv = document.getElementById(divNum);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>d.removeChild(olddiv);</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span>}</span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"></</span><span style="color: #a31515;">script</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">head</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"><</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">input</span> <span style="color: red;">type</span><span style="color: blue;">="hidden"</span> <span style="color: red;">value</span><span style="color: blue;">="0"</span> <span style="color: red;">id</span><span style="color: blue;">="theValue"</span> <span style="color: blue;">/></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">p</span><span style="color: blue;">><</span><span style="color: #a31515;">a</span> <span style="color: red;">href</span><span style="color: blue;">="javascript:;"</span> <span style="color: red;">onclick</span><span style="color: blue;">="addElement();"></span>Add Some Elements<span style="color: blue;"></</span><span style="color: #a31515;">a</span><span style="color: blue;">></</span><span style="color: #a31515;">p</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"><</span><span style="color: #a31515;">div</span> <span style="color: red;">id</span><span style="color: blue;">="myDiv"></span> <span style="color: blue;"></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<br /></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"></</span><span style="color: #a31515;">div</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="font-size: 10pt;"><span style="mso-spacerun: yes;"> </span><span style="color: blue;"></</span><span style="color: #a31515;">form</span><span style="color: blue;">></span></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">body</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif; line-height: normal; margin-bottom: 0.0001pt;">
<span style="color: blue; font-size: 10pt;"></</span><span style="color: #a31515; font-size: 10pt;">html</span><span style="color: blue; font-size: 10pt;">></span></div>
<div class="MsoNormal" style="font-family: Georgia,"Times New Roman",serif;">
<br /></div>
</div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0tag:blogger.com,1999:blog-494840051268062698.post-82784691077273638192011-12-10T15:39:00.001+05:302011-12-10T15:39:42.915+05:30Send and Receive JSON objects to Web Service Methods using jQuery AJAX in ASP.Net<div dir="ltr" style="text-align: left;" trbidi="on">
<br />
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">In this article I will explain how to send and receive JavaScript JSON objects to Web Methods using jQuery AJAX in ASP.Net.</span></div>
<div style="margin: 0in 0in 10pt;">
<b><u><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Custom Object Class</span></u></b></div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<span style="font-family: arial,sans-serif; font-size: 10pt;">First I’ll create a simple property class of City which has two simple properties</span></div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<span style="font-family: arial,sans-serif; font-size: 10pt;">1. Name – Name of the City</span></div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<span style="font-family: arial,sans-serif; font-size: 10pt;">2. Population – Population of the City.</span></div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<span style="font-family: arial,sans-serif; font-size: 10pt;">This class will act as the JSON object for sending and receiving date between the client and server.</span></div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<b><span style="font-family: arial,sans-serif; font-size: 10pt;">C#</span></b></div>
<div style="background: #f2f2f2; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;">
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">public</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">class</span> <span style="color: #2b91af;">City</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;">{</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">private</span> <span style="color: blue;">string</span> name;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">string</span> Name</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">return</span> name;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">set</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> name = <span style="color: blue;">value</span>;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
</div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">private</span> <span style="color: blue;">int</span> population;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">public</span> <span style="color: blue;">int</span> Population</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">return</span> population;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">set</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> population = <span style="color: blue;">value</span>;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;">}</span></div>
</div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
</div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<b><span style="font-family: arial,sans-serif; font-size: 10pt;">VB.Net</span></b></div>
<div style="background: #f2f2f2; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;">
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">Public</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Class</span> <span style="color: #2b91af;">City</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Private</span> _name <span style="color: blue;">As</span> <span style="color: blue;">String</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Public</span> <span style="color: blue;">Property</span> Name <span style="color: blue;">As</span> <span style="color: blue;">String</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Return</span> _name</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Set</span>(<span style="color: blue;">ByVal</span> value <span style="color: blue;">As</span> <span style="color: blue;">String</span>)</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> _name = value</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Set</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Property</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Private</span> _population <span style="color: blue;">As</span> <span style="color: blue;">Integer</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Public</span> <span style="color: blue;">Property</span> Population <span style="color: blue;">As</span> <span style="color: blue;">Integer</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Return</span> _population</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Get</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Set</span>(<span style="color: blue;">ByVal</span> value <span style="color: blue;">As</span> <span style="color: blue;">Integer</span>)</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> _population = value</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Set</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">End</span> <span style="color: blue;">Property</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">End</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Class</span></span></div>
</div>
<div>
</div>
<div style="margin-bottom: 10pt; margin-left: 0in; margin-right: 0in; margin-top: 0in;">
<b> </b></div>
<div style="margin: 0in 0in 10pt;">
<b><u><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">HTML Markup</span></u></b></div>
<div style="background: #f2f2f2; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;">
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"><</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">html</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: red;">xmlns</span><span style="color: blue;">="http://www.w3.org/1999/xhtml"></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"><</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">head</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: red;">id</span><span style="color: blue;">="Head1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">title</span><span style="color: blue;">></</span><span style="color: maroon;">title</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">script</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"</span> <span style="color: red;">src</span><span style="color: blue;">="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">script</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"</span> <span style="color: red;">src</span><span style="color: blue;">="http://ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">script</span> <span style="color: red;">type</span><span style="color: blue;">="text/javascript"></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> $(<span style="color: maroon;">"#btnCity"</span>).live(<span style="color: maroon;">"click"</span>, <span style="color: blue;">function</span> () {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">var</span> city = {};</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> city.Name = <span style="color: maroon;">"Mumbai"</span>;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> city.Population = 2000;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> $.ajax({</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> type: <span style="color: maroon;">'POST'</span>,</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> url: <span style="color: maroon;">'MyPage.aspx/GetCity'</span>,</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> data: <span style="color: maroon;">"{city:"</span> + JSON.stringify(city) + <span style="color: maroon;">"}"</span>,</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> contentType: <span style="color: maroon;">'application/json; charset=utf-8'</span>,</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> dataType: <span style="color: maroon;">'json'</span>,</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> success: <span style="color: blue;">function</span> (r) {</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> alert(r.d.Name);</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> alert(r.d.Population);</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> }</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> });</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> });</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"></</span><span style="color: maroon;">script</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"></</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">head</span><span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"><</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">body</span><span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">form</span> <span style="color: red;">id</span><span style="color: blue;">="form1"</span> <span style="color: red;">runat</span><span style="color: blue;">="server"></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">div</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"><</span><span style="color: maroon;">input</span> <span style="color: red;">type</span><span style="color: blue;">="button"</span> <span style="color: red;">id</span> <span style="color: blue;">=</span> <span style="color: blue;">"btnCity"</span> <span style="color: red;">value</span><span style="color: blue;">="Get City"</span> <span style="color: blue;">/></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"></</span><span style="color: maroon;">div</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;"></</span><span style="color: maroon;">form</span><span style="color: blue;">></span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"></</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">body</span><span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;"></</span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt;">html</span><span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">></span></div>
</div>
<div>
</div>
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Above you will notice that on the click event of the HTML button </span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt; line-height: 115%;">btnCity</span><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;"> I am making a jQuery AJAX call to the ASP.Net WebMethod </span><span style="color: maroon; font-family: 'courier new'; font-size: 9.5pt; line-height: 115%;">GetCity</span><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">
which accepts a custom JSON object City with 2 properties (Name and
Population). This function also returns a JSON object of type City with
the same 2 properties (Name and Population).</span></div>
<div style="margin: 0in 0in 10pt;">
</div>
<div style="margin: 0in 0in 10pt;">
<b><u><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Server side code</span></u></b></div>
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Below I have described the Web Methods that will process the requests received by the jQuery AJAX call.</span></div>
<div style="margin: 0in 0in 10pt;">
<b><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">C#</span></b></div>
<div style="background: #f2f2f2; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;">
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;">[System.Web.Services.<span style="color: #2b91af;">WebMethod</span>]</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">public</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">static</span> <span style="color: #2b91af;">City</span> GetCity(<span style="color: #2b91af;">City</span> city)</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;">{</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">return</span> city;</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;">}</span></div>
</div>
<div>
</div>
<div style="margin: 0in 0in 10pt;">
<b><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">VB.Net</span></b></div>
<div style="background: #f2f2f2; border-bottom: windowtext 1pt solid; border-left: windowtext 1pt solid; border-right: windowtext 1pt solid; border-top: windowtext 1pt solid; padding-bottom: 1pt; padding-left: 4pt; padding-right: 4pt; padding-top: 1pt;">
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"><System.Web.Services.<span style="color: #2b91af;">WebMethod</span>()> _</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">Public</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Shared</span> <span style="color: blue;">Function</span> GetCity(<span style="color: blue;">ByVal</span> city <span style="color: blue;">As</span> <span style="color: #2b91af;">City</span>) <span style="color: blue;">As</span> <span style="color: #2b91af;">City</span></span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Return</span> city</span></div>
<div style="background-attachment: initial; background-clip: initial; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: initial; border-bottom-style: none; border-bottom-width: medium; border-left-color: initial; border-left-style: none; border-left-width: medium; border-right-color: initial; border-right-style: none; border-right-width: medium; border-top-color: initial; border-top-style: none; border-top-width: medium; padding-bottom: 0in; padding-left: 0in; padding-right: 0in; padding-top: 0in;">
<span style="color: blue; font-family: 'courier new'; font-size: 9.5pt;">End</span><span style="font-family: 'courier new'; font-size: 9.5pt;"> <span style="color: blue;">Function</span></span></div>
</div>
<br />
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">The above Web Methods simply accept the object of class City and simply return it back to the client.</span></div>
<div style="margin: 0in 0in 10pt;">
<b> </b></div>
<div style="margin: 0in 0in 10pt;">
<b><u><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Screenshots</span></u></b></div>
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">The
below screenshot displays how the JavaScript JSON object sent to the
server via jQuery AJAX is received by the server side web method.</span></div>
<div style="margin: 0in 0in 10pt;">
<img alt="Received Custom Class sent by jQuery AJAX by Web service WebMethod in ASP.Net" src="http://www.aspsnippets.com/Handlers/url.ashx?id=d2f4caff-20e4-4c9f-90ee-85615c96ae91/2011-10-28_1543" title="Received Custom Class object sent by jQuery AJAX by Web service WebMethod in ASP.Net" /></div>
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">The below screenshot displays how the JavaScript JSON object is received from the server via jQuery AJAX success event handler.</span></div>
<div style="margin: 0in 0in 10pt;">
<img alt="Received JSON object sent by WebService webmethod by jQuery AJAX Success event handler" src="http://www.aspsnippets.com/Handlers/url.ashx?id=891252de-2277-4698-8cd8-b537fdf1451a/2011-10-28_1544" title="Received JSON object sent by WebService webmethod by jQuery AJAX Success event handler" /></div>
<div style="margin: 0in 0in 10pt;">
<b><u><span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">Downloads</span></u></b></div>
<div style="margin: 0in 0in 10pt;">
<span style="font-family: arial,sans-serif; font-size: 10pt; line-height: 115%;">You can download the complete working source code in C# and VB.Net using the download link provided below.</span></div>
<a href="http://www.aspsnippets.com/Handlers/DownloadFile.ashx?File=11794d44-fbcf-44f2-a5ea-13969f85025c.zip">SendAndReceiveJSONObjectsjQueryASP.Net.zip</a> </div>Anonymoushttp://www.blogger.com/profile/18092130009074973197noreply@blogger.com0