<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3500377907910657119</id><updated>2012-02-16T06:24:05.425-08:00</updated><title type='text'>asp.net web development</title><subtitle type='html'>HI..I am a software professional..and working as a senior software developer with 4+ years of exp in asp.net</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>24</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-7409410998070652113</id><published>2009-12-16T01:21:00.000-08:00</published><updated>2009-12-16T02:57:14.373-08:00</updated><title type='text'>Ref and Out Parameters In C#</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_76_SOrXkY1A/Syi6mwdQ-bI/AAAAAAAAADY/fp69UQLJxj8/s1600-h/ClassDiagram2.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 320px; height: 216px;" src="http://2.bp.blogspot.com/_76_SOrXkY1A/Syi6mwdQ-bI/AAAAAAAAADY/fp69UQLJxj8/s320/ClassDiagram2.jpg" alt="" id="BLOGGER_PHOTO_ID_5415783726918465970" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Ref" content="Microsoft Word 11"&gt;&lt;meta name="Out" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///D:%5CDOCUME%7E1%5Csusu4531%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} h2 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:2; 	font-size:18.0pt; 	font-family:"Times New Roman"; 	font-weight:bold;} h3 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:3; 	font-size:13.5pt; 	font-family:"Times New Roman"; 	font-weight:bold;} p 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} pre 	{margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; 	font-size:10.0pt; 	font-family:"Courier New"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* 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-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;h2&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Value Parameters&lt;/span&gt;&lt;/h2&gt;  &lt;h3&gt;Passing &lt;meta&gt;Value Types&lt;meta&gt; by Value&lt;/h3&gt;  &lt;p&gt;We often call the class methods through the class instances and by passing parameters. These parameters have all been &lt;em&gt;passed by value&lt;/em&gt;. While we pass the value types of a parameter, this means that a copy of the value's &lt;em&gt;contents&lt;/em&gt; has been passed. As only a copy of the contents is available, the external variable's value cannot be modified from within the method.&lt;/p&gt;  &lt;p&gt;The following example code demonstrates the use of value parameters with variables that are value types. In this sample, a value type variable is declared and its value is assigned. This variable is then used as the value of a parameter. The variable is passed to the method parameter by value and the parameter's value is changed within the method, but the original variable remains unaffected.&lt;/p&gt;  &lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;public void CallMethod()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;int original = 100;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;CallingMathod obj = new CallingMathod();&lt;span style=""&gt;           &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;obj.showValue(original);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label1.Text="Original: "+ original.ToString();;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallingMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void showValue(int valueToShow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;valueToShow *=2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label2.Text="Double: "+ valueToShow.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt; OUTPUT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Double: 200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Original: 100&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;br /&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Passing Reference Types by Value&lt;/h3&gt;  &lt;p&gt;When we pass the &lt;i style=""&gt;reference types&lt;/i&gt; by value rather &lt;i style=""&gt;value types&lt;/i&gt; by value, a copy of the &lt;em&gt;reference&lt;/em&gt; is made. This means that any changes to the object's properties that occur within the method will be reflected outside of the method too. This is because both the external variable and the variable within the method contain the same references to the same underlying object data in memory. However, if the variable inside the method is assigned a completely new value, and therefore a different reference to the external variable, this change is not reflected outside of the method.&lt;/p&gt;  &lt;p&gt;To demonstrate, consider the following code. This uses a "StudentClass" class that contains a single property for the &lt;i style=""&gt;student's roll number&lt;/i&gt;. When calling the GetRollNumber method, the Student is passed by reference. Increasing the Roll Number property within the method is visible outside of the method too. However, when the GetNewNumber method is called, the reassigned object is not seen externally to the method.&lt;/p&gt;  &lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;public void CallMethod()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Student objStudent = new Student ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objStudent.rollNumber = 004512;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;GetRollNumber(objStudent);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Label1.Text ="Roll Number: "+ objStudent.rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;GetNewNumber(objStudent);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Console.WriteLine("Roll Number: {0}", objStudent.rollNumber);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;i&gt; &lt;span style="font-weight: bold;"&gt;OUTPUT&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Diameter&lt;/span&gt;&lt;/i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;: &lt;/span&gt;&lt;i style=""&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;004513&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Diameter: &lt;/span&gt;&lt;/i&gt;&lt;i style=""&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;004513&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void GetRollNumber(Student objSt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt.rollNumber++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;static void GetNewNumber(Student objSt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt = new Student();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt.rollNumber = 1;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class Student&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;private int _rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;public int rollNumber&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;            &lt;/span&gt;return _rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;set&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;            &lt;/span&gt;_rollNumber = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;  &lt;h2&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Reference Parameters&lt;/span&gt;&lt;/h2&gt;  &lt;h3&gt;Passing Value Types by Reference&lt;/h3&gt;  &lt;p&gt;An alternative to passing parameters by value is &lt;em&gt;passing by reference&lt;/em&gt;. When using &lt;em&gt;reference parameters&lt;/em&gt; for value types a copy of the value is not made. Instead, the variable used in the parameter is itself passed to the called method. This makes the behaviour similar to using reference types in value parameters; any changes to the value of the parameter variable is also seen outside of the method.&lt;/p&gt;  &lt;p&gt;A reference parameter is declared using the &lt;em&gt;ref&lt;/em&gt; keyword before the parameter type and name. This prefix is also used when calling the method.&lt;/p&gt;  &lt;p&gt;The following sample code is based upon the first example in this article but by using a reference parameter rather than a value parameter, the results seen are different.&lt;/p&gt;  &lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void CalleeMethod()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;int original = 100;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;CallingMathod obj = new CallingMathod();&lt;span style=""&gt;         &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;obj.showValue(ref original);&lt;span style=""&gt;              &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label1.Text = "Original: "+original.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallingMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void showValue(int valueToShow)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;valueToShow *=2;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label2.Text="Double: "+ valueToShow.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt; OUTPUT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Double: 200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Original: 200&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h3&gt;Passing Reference Types by Reference:&lt;/h3&gt;  &lt;p&gt;&lt;i style=""&gt;Reference type&lt;/i&gt; data can be passed to &lt;i style=""&gt;reference&lt;/i&gt; parameters. In this case, rather than passing a copy of the reference to the method, as when using value parameters, the reference variable itself is passed. In this situation, property changes within the method are reflected outside of the method as expected. However, if the variable is reassigned within the method, the variable outside of the method is also reassigned.&lt;/p&gt;  &lt;p&gt;By modifying the earlier example relating to the Student class to use reference parameters, this can be demonstrated. In the following code the student’s &lt;i style=""&gt;rollNumber&lt;/i&gt; is increased by 1 as is was previously with the reference parameters showing no apparent difference in functionality. When the &lt;i style=""&gt;GetNewNumber&lt;/i&gt; method is called, the student variable is reassigned as a completely new object. &lt;/p&gt;  &lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;public void CallMethod()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Student objStudent = new Student ();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objStudent.rollNumber = 004512;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;GetRollNumber(ref objStudent);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Label1.Text ="Roll Number: "+ objStudent.rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;GetNewNumber(objStudent);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;span style=""&gt;      &lt;/span&gt;Console.WriteLine("Roll Number: {0}", objStudent.rollNumber);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;i&gt; &lt;span style="font-weight: bold;"&gt;OUTPUT&lt;/span&gt;&lt;o:p style="font-weight: bold;"&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Diameter&lt;/span&gt;&lt;/i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;: &lt;/span&gt;&lt;i style=""&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;004513&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;Diameter: &lt;/span&gt;&lt;/i&gt;&lt;i style=""&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;000001&lt;span style=""&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void GetRollNumber(ref Student objSt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt.rollNumber++;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;static void GetNewNumber(ref Student objSt)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt = new Student();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;objSt.rollNumber = 000001;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class Student&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;private int _rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;public int rollNumber&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;get&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;            &lt;/span&gt;return _rollNumber;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;set&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;            &lt;/span&gt;_rollNumber = value;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;br /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;h2&gt;Output Parameters&lt;/h2&gt;  &lt;p&gt;When we need to return more than one value from a method, one value can be returned using the normal return command with additional values being extracted using &lt;em&gt;output parameters&lt;/em&gt;.&lt;/p&gt;  &lt;p&gt;An output parameter is declared using the &lt;em&gt;out&lt;/em&gt; keyword before the parameter type and name. When called, the out keyword is used again as a prefix to the variable being passed as a parameter. The behavior seen is similar to passing by reference in that the variable &lt;i style=""&gt;must be assigned a value within the method&lt;/i&gt;. This value will then be reflected in the output parameter.&lt;/p&gt;  &lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static void CalleeMethod()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;decimal x = 10.00;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;decimal y = 200.00;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;decimal area;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;decimal perimeter;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;CallingMathod obj = new CallingMathod();&lt;span style=""&gt;         &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;area =obj.GetArea(x,y,out perimeter);&lt;span style=""&gt;     &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label1.Text = "Area: "+ area.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;Label2.Text = "Perimeter: "+ perimeter.ToString();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Public class CallingMathod&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;static decimal GetArea(int x,int y,out &lt;/span&gt;int&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt; perimeter)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;perimeter = 2*(x+y);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;span style=""&gt;    &lt;/span&gt;return (x*y);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="margin-left: 0.5in;"&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt; OUTPUT&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Area: 2000.00&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i style=""&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;Perimeter&lt;span style=""&gt;: 420.00&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Colclussion&lt;/span&gt;:&lt;br /&gt;  &lt;span style="font-weight: bold;"&gt;OUT &lt;/span&gt;:&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;   Variable gets value initialized after going into the method.&lt;br /&gt;   Later the same value is returned to the main method.&lt;br /&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;        &lt;span style="font-weight: bold;"&gt;Ref &lt;/span&gt;:&lt;/span&gt;&lt;/i&gt;&lt;br /&gt;   Variable should be initialized before going into the method.&lt;br /&gt;   Later same value or modified value will be returned to the main method&lt;br /&gt;&lt;i&gt;&lt;span style="background: silver none repeat scroll 0% 0%; -moz-background-clip: border; -moz-background-origin: padding; -moz-background-inline-policy: continuous;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/i&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-7409410998070652113?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/7409410998070652113/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=7409410998070652113' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7409410998070652113'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7409410998070652113'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/12/ref-and-out-parameters-in-c.html' title='Ref and Out Parameters In C#'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_76_SOrXkY1A/Syi6mwdQ-bI/AAAAAAAAADY/fp69UQLJxj8/s72-c/ClassDiagram2.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5676654128161361246</id><published>2009-09-08T02:47:00.000-07:00</published><updated>2009-09-08T03:42:24.724-07:00</updated><title type='text'>Data Insert By XML</title><content type='html'>&lt;a href="http://1.bp.blogspot.com/_76_SOrXkY1A/SqYsD87xsgI/AAAAAAAAADM/xtoJ8x_l0lc/s1600-h/ClassDiagram1.jpg"&gt;&lt;span style="font-family:times new roman;"&gt;&lt;img id="BLOGGER_PHOTO_ID_5379035251348713986" style="FLOAT: right; MARGIN: 0px 0px 10px 10px; WIDTH: 320px; CURSOR: hand; HEIGHT: 274px" alt="" src="http://1.bp.blogspot.com/_76_SOrXkY1A/SqYsD87xsgI/AAAAAAAAADM/xtoJ8x_l0lc/s320/ClassDiagram1.jpg" border="0" /&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family:times new roman;"&gt; &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;I have created two types of Xml based data insert Update etc..here.Basically for Bulck insert we use such process to enter or update data inside database and can avoide the hectick parameter passing process by passing the whole xml as a single string.We collect data and generate the dynamic xml and pass it to the stolred procedure.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;Here is my class architecture.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;For the Faculty there exists one to many mapping between Faculty - College (Consider guest lecturer) and Faculty-Department.So List collections are taken for College and Department to save Faculty data.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;have a look at my Faculty class&lt;/span&gt; methods&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;#endregion&lt;br /&gt;#region Internal Methods&lt;br /&gt;internal string GetXML()&lt;br /&gt;{&lt;br /&gt;XmlDocument xDoc = new XmlDocument();&lt;br /&gt;XmlElement xStudentDetail;&lt;br /&gt;xStudentDetail = (XmlElement)xDoc.CreateElement("FacultyDetails");&lt;br /&gt;//this.IsActive = true;&lt;br /&gt;xStudentDetail.SetAttribute("FacultyDetailsID", this.IdNo.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("PersonalAddress", this.PersonalAddress.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("Name", this.Name.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("OtherCharges", this.OtherCharges.ToString());&lt;br /&gt;if (this.CollegeDetails != null)&lt;br /&gt;{&lt;br /&gt;XmlElement xStudentDetails;&lt;br /&gt;xStudentDetails = (XmlElement)xDoc.CreateElement("CollegeDetails");&lt;br /&gt;foreach (College objCollegeDetails in this.CollegeDetails)&lt;br /&gt;{&lt;br /&gt;xStudentDetails.InnerXml = xStudentDetails.InnerXml + objCollegeDetails.GetXML();&lt;br /&gt;}&lt;br /&gt;xRentAgreement.AppendChild(xStudentDetails);&lt;br /&gt;}&lt;br /&gt;xDoc.AppendChild(xStudentDetail);&lt;br /&gt;return xDoc.InnerXml;&lt;br /&gt;}&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// This internal method is used for saving the Student details into the database&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;///&lt;br /&gt;internal int SaveFacultyInfo()&lt;br /&gt;{&lt;br /&gt;DataAccess dataAccess = null;&lt;br /&gt;DataSet dsFaculty;&lt;br /&gt;int iFunctionId = 0;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;DataAccess = new DataAccess(_connectionString);&lt;br /&gt;SqlParameter[] sqlParams = new SqlParameter[1];&lt;br /&gt;sqlParams[0] = new SqlParameter("@sFacultyXML", this.GetXML());&lt;br /&gt;dsFaculty = dataAccess.ExecuteDataSet("spSaveFacultyDetails", CommandType.StoredProcedure, sqlParams);&lt;br /&gt;foreach (DataRow dr in dsFaculty.Tables[0].Rows)&lt;br /&gt;{&lt;br /&gt;iFunctionId = Convert.ToInt32(dr[0]);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;if (dataAccess != null)&lt;br /&gt;{&lt;br /&gt;if (dataAccess.DataConn != null)&lt;br /&gt;{&lt;br /&gt;//Close the dataset connection&lt;br /&gt;dataAccess.DataConn.Close();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;return iFunctionId;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// This internal method is used for getting the student details from the database&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;///&lt;br /&gt;internal void GetFacultyInfo()&lt;br /&gt;{&lt;br /&gt;DataAccess dataAccess = null;&lt;br /&gt;DataSet dsFaculty;&lt;br /&gt;DataRow[] drs;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;DataAccess = new DataAccess(_connectionString);&lt;br /&gt;SqlParameter[] sqlParams = new SqlParameter[1];&lt;br /&gt;sqlParams[0] = new SqlParameter("@sFId", studentId);&lt;br /&gt;dsFaculty = dataAccess.ExecuteDataSet("spGetFacultyDetails", CommandType.StoredProcedure, sqlParams);&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;if (dataAccess != null)&lt;br /&gt;{&lt;br /&gt;if (dataAccess.DataConn != null)&lt;br /&gt;{&lt;br /&gt;//Close the dataset connection&lt;br /&gt;dataAccess.DataConn.Close();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;#endregion&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;the GetXML() method will collect the information and populate it into a XML&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;span style="font-size:85%;"&gt;#region Internal Methods&lt;br /&gt;internal string GetXML()&lt;br /&gt;{&lt;br /&gt;XmlDocument xDoc = new XmlDocument();&lt;br /&gt;XmlElement xStudentDetail;&lt;br /&gt;xStudentDetail = (XmlElement)xDoc.CreateElement("FacultyDetails");&lt;br /&gt;//this.IsActive = true;&lt;br /&gt;xStudentDetail.SetAttribute("FacultyDetailsID", this.IdNo.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("PersonalAddress", this.PersonalAddress.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("Name", this.Name.ToString());&lt;br /&gt;xStudentDetail.SetAttribute("OtherCharges", this.OtherCharges.ToString());&lt;br /&gt;if (this.CollegeDetails != null)&lt;br /&gt;{&lt;br /&gt;XmlElement xStudentDetails;&lt;br /&gt;xStudentDetails = (XmlElement)xDoc.CreateElement("CollegeDetails");&lt;br /&gt;foreach (College objCollegeDetails in this.CollegeDetails)&lt;br /&gt;{&lt;br /&gt;xStudentDetails.InnerXml = xStudentDetails.InnerXml + objCollegeDetails.GetXML();&lt;br /&gt;}&lt;br /&gt;xRentAgreement.AppendChild(xStudentDetails);&lt;br /&gt;}&lt;br /&gt;xDoc.AppendChild(xStudentDetail);&lt;br /&gt;return xDoc.InnerXml;&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;For Collecting the College information there is also a GetXML method inside College Class.It will add the ollege info as a child node to the faculty XML.&lt;br /&gt;&lt;br /&gt;#region Internal Methods&lt;br /&gt;/// &lt;summary&gt;&lt;br /&gt;/// this method will get the object in xml format&lt;br /&gt;/// &lt;/summary&gt;&lt;br /&gt;/// &lt;returns&gt;&lt;/returns&gt;&lt;br /&gt;/// &lt;createdby&gt;Subhamay Sur&lt;/createdby&gt;&lt;br /&gt;internal string GetXML()&lt;br /&gt;{&lt;br /&gt;XmlDocument xDoc = new XmlDocument();&lt;br /&gt;XmlElement xCollege;&lt;br /&gt;xCollege = (XmlElement)xDoc.CreateElement("CollegeInfo");&lt;br /&gt;xCollege.SetAttribute("CollegeInfo", this.CollegeID.ToString());&lt;br /&gt;xCollege.SetAttribute("UniversityRegNo", this.UniversityRegNo.ToString());&lt;br /&gt;xCollege.SetAttribute("CollegeName", this.CollegeName.ToString());&lt;br /&gt;xCollege.SetAttribute("CollegeAddress", this.CollegeAddress.ToString());&lt;br /&gt;xCollege.SetAttribute("CollegeStatus", this.CollegeStatus.ToString());&lt;br /&gt;xCollege.SetAttribute("IsAICTEApproved", this.IsAICTEApproved.ToString());&lt;br /&gt;xCollege.SetAttribute("IsWBSEBApproved", this.IsWBSEBApproved.ToString());&lt;br /&gt;if (this.DepartmentDetails != null)&lt;br /&gt;{&lt;br /&gt;XmlElement xDeparmentDetails;&lt;br /&gt;xDeparmentDetails = (XmlElement)xDoc.CreateElement("DepartmentDetails");&lt;br /&gt;foreach (Department objDepartmentDetails in this.FacultyDetails)&lt;br /&gt;{&lt;br /&gt;xDeparmentDetails.InnerXml = xDeparmentDetails.InnerXml + objDepartmentDetails.GetXML();&lt;br /&gt;}&lt;br /&gt;xCollege.AppendChild(xCollegeDetails);&lt;br /&gt;}&lt;br /&gt;xDoc.AppendChild(xCollege);&lt;br /&gt;return xDoc.InnerXml;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;#endregion&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;"&gt;To save this string formatted string the Stored Procedure will be like&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;INSERT INTO #TempFaculty&lt;br /&gt;(&lt;br /&gt;[PersonalAddress],&lt;br /&gt;[Department],&lt;br /&gt;[Name],&lt;br /&gt;[OtherCharges]&lt;br /&gt;)&lt;br /&gt;SELECT&lt;br /&gt;T.F.value(&lt;a href="mailto:"&gt;'@PersonalAddress','VARCHAR(200)'&lt;/a&gt;),&lt;br /&gt;T.F.value(&lt;a href="mailto:"&gt;'@Name','VARCHAR(200)'&lt;/a&gt;),&lt;br /&gt;T.F.value(&lt;a href="mailto:"&gt;'@OtherCharges','decimal(14&lt;/a&gt;, 2)')&lt;br /&gt;FROM @sFacultyXML.nodes('/FacultyDetails') T(F)&lt;/span&gt; &lt;span style="font-family:times new roman;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;br /&gt;&lt;br /&gt;CREATE TABLE #TempTableRentAgreementVendorMap&lt;br /&gt;(&lt;br /&gt;[RentAgreementID] INT,&lt;br /&gt;[VendorNo] VARCHAR(200),&lt;br /&gt;[AmountShareRent] DECIMAL(14, 2),&lt;br /&gt;[AmountShareMaintenance] DECIMAL(14, 2),&lt;br /&gt;[AmountShareOthers] DECIMAL(14, 2)&lt;br /&gt;)&lt;br /&gt;INSERT INTO #TempTableFacultyCollegeMap&lt;br /&gt;(&lt;br /&gt;[CollegeId],&lt;br /&gt;[UniversityRegNo],&lt;br /&gt;[CollegeName],&lt;br /&gt;[CollegeAddress],&lt;br /&gt;[IsAICTEApproved] ,&lt;br /&gt;[IsWBSEBApproved]&lt;br /&gt;)&lt;br /&gt;SELECT&lt;br /&gt;T.F.value('@CollegeId','INT'),&lt;br /&gt;T.F.value('@UniversityRegNo','VARCHAR(200)'),&lt;br /&gt;T.c.value('@CollegeName','decimal(14, 2)'),&lt;br /&gt;T.F.value('@CollegeAddress','decimal(14, 2)'),&lt;br /&gt;T.F.value('@IsAICTEApproved','decimal(14, 2)') ,&lt;br /&gt;T.F.value('@IsWBSEBApproved','decimal(14, 2)')&lt;br /&gt;FROM @sFacultyXML.nodes('/FacultyDetails/CollegeInfo') T(F)&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:times new roman;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:times new roman;"&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5676654128161361246?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5676654128161361246/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5676654128161361246' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5676654128161361246'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5676654128161361246'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/09/i-have-created-two-types-of-xml-based.html' title='Data Insert By XML'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_76_SOrXkY1A/SqYsD87xsgI/AAAAAAAAADM/xtoJ8x_l0lc/s72-c/ClassDiagram1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-7740649030747238582</id><published>2009-09-03T22:26:00.000-07:00</published><updated>2009-09-03T22:35:06.422-07:00</updated><title type='text'>Bind DropDownList Using Cache Value</title><content type='html'>&lt;span style="font-family:arial;font-size:85%;"&gt;Here I have created an AppCacheManager Class where i define some methods for Insert to Cache,Remove From Cache,Refresh Cache etc..&lt;br /&gt;We need to use a synchronization primitive lock which is provided by the .NET Framework. Basically this mechanism allows a thread to acquire a lock on an instance of an object. Which means, only one thread can acquire a lock on the object and other threads have to wait until the original thread releases the lock .But if we lock the cache object directly it will be a huge performance issue.Acctullay we have to make sure that a)multiple threads can read cache data simultaneously, b)only one thread is allowed to update the cache at a time c) When a thread is updating the cache, all the threads that want to read the cache data should wait until the update is complete&lt;br /&gt;The .NET framework provides another thread synchronization primitive called ReaderWriterLock&lt;br /&gt;My Cache Manager Class is like that&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:times new roman;font-size:85%;"&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Text;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Web.Caching;&lt;br /&gt;using System.Threading;&lt;br /&gt;using System.Reflection;&lt;br /&gt;using AppConfigurationManagement&lt;br /&gt;namespace CacheManagement&lt;br /&gt;{&lt;br /&gt;// contains the methods for cache management for Add ,Remove,Refresh&lt;br /&gt;public static class AppCacheManager&lt;br /&gt;{&lt;br /&gt;private static System.Web.Caching.Cache _CacheManager = System.Web.HttpContext.Current.Cache;&lt;br /&gt;private static ReaderWriterLock _ReadWriteLock;&lt;br /&gt;static AppCacheManager ()&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock = new ReaderWriterLock();&lt;br /&gt;if (System.Web.HttpContext.Current != null)&lt;br /&gt;{&lt;br /&gt;_CacheManager = System.Web.HttpContext.Current.Cache;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;_CacheManager = System.Web.HttpRuntime.Cache;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;// Method to add object in cache&lt;br /&gt;public static void AddToCache(EnumeratorsConfiguration.CacheKey key, object keyData)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;// Aquire Writer Lock&lt;br /&gt;_ReadWriteLock.AcquireWriterLock(60000);&lt;br /&gt;_CacheManager.Insert(key.ToString(), keyData);&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;if (_ReadWriteLock.IsWriterLockHeld)&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.ReleaseWriterLock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/// Method to remove object from cache,&lt;br /&gt;/// it removes object for all keys which starts with value of key&lt;br /&gt;public static void RemoveFromCache(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.AcquireWriterLock(60000);&lt;br /&gt;System.Collections.IDictionaryEnumerator dicEnum;&lt;br /&gt;dicEnum = _CacheManager.GetEnumerator();&lt;br /&gt;while(dicEnum.MoveNext() == true)&lt;br /&gt;{&lt;br /&gt;if (((string)dicEnum.Key).StartsWith(key.ToString()))&lt;br /&gt;{&lt;br /&gt;_CacheManager.Remove((string)dicEnum.Key);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;//Release the write lock&lt;br /&gt;if (_ReadWriteLock.IsWriterLockHeld)&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.ReleaseWriterLock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/// Method to remove object from cache,&lt;br /&gt;/// it removes object for all keys which starts with value of key&lt;br /&gt;public static void RemoveFromCache()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.AcquireWriterLock(60000);&lt;br /&gt;System.Collections.IDictionaryEnumerator dicEnum;&lt;br /&gt;dicEnum = _CacheManager.GetEnumerator();&lt;br /&gt;while (dicEnum.MoveNext() == true)&lt;br /&gt;{&lt;br /&gt;if (IsCacheable(dicEnum.Key.ToString()))&lt;br /&gt;_CacheManager.Remove((string)dicEnum.Key);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;//Release the write lock&lt;br /&gt;if (_ReadWriteLock.IsWriterLockHeld)&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.ReleaseWriterLock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;public static DataTable GetCacheList()&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.AcquireWriterLock(60000);&lt;br /&gt;System.Collections.IDictionaryEnumerator dicEnum;&lt;br /&gt;dicEnum = _CacheManager.GetEnumerator();&lt;br /&gt;DataTable dtCache = new DataTable();&lt;br /&gt;dtCache.Columns.Add("Key");&lt;br /&gt;while (dicEnum.MoveNext() == true)&lt;br /&gt;{&lt;br /&gt;if (IsCacheable(dicEnum.Key.ToString()))&lt;br /&gt;{&lt;br /&gt;DataRow drCache = dtCache.NewRow();&lt;br /&gt;drCache["Key"] = dicEnum.Key.ToString();&lt;br /&gt;dtCache.Rows.Add(drCache);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;return dtCache;&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;//Release the write lock&lt;br /&gt;if (_ReadWriteLock.IsWriterLockHeld)&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.ReleaseWriterLock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;// It retrieves a object from cache for a key&lt;br /&gt;public static object RetrieveFromCache(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.AcquireReaderLock(60000);&lt;br /&gt;return _CacheManager.Get(key.ToString());&lt;br /&gt;}&lt;br /&gt;finally&lt;br /&gt;{&lt;br /&gt;if (_ReadWriteLock.IsReaderLockHeld)&lt;br /&gt;{&lt;br /&gt;_ReadWriteLock.ReleaseReaderLock();&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;/// Rerurns whether the specified key Exists in cache.&lt;br /&gt;public static bool ExistsInCache(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;if (_CacheManager.Get(key.ToString()) != null)&lt;br /&gt;{&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (Exception ex)&lt;br /&gt;{&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;Now let us say I want to bind a dropdownlist by the values stored in the cache.Here is way how I can do thatHere we are taking an Enum for the Cache Key Settings. If there exists various Chache Key ,we can use an Enum for that &lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;namespace AppConfigurationManagement&lt;br /&gt;{&lt;br /&gt;public static class EnumeratorsConfiguration&lt;br /&gt;{&lt;br /&gt;#region Enum&lt;br /&gt;public enum CacheKey&lt;br /&gt;{&lt;br /&gt;Location = 1,&lt;br /&gt;Region =2,&lt;br /&gt;Branch = 3&lt;br /&gt;}&lt;br /&gt;#endregion&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now let us call the Cache Methods.If the data for the specified cache key remains in the cache then we will call it ,otherwise we will add the value to the cache.&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;&lt;br /&gt;using AppConfigurationManagement;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using BusinessEntity;&lt;br /&gt;namespace BusinessLogic&lt;br /&gt;{&lt;br /&gt;public static class AppMetadataManager&lt;br /&gt;{&lt;br /&gt;#region Public Methods&lt;br /&gt;/// Contains the methods for Metadata Management&lt;br /&gt;public static object GetMetadata(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;object metadata = null;&lt;br /&gt;try&lt;br /&gt;{&lt;br /&gt;if (AppCacheManager.ExistsInCache(key) &amp;amp;&amp;amp; ConfigurationManager.AppSettings["EnableCache"].ToString() == "1")&lt;br /&gt;{&lt;br /&gt;/*if the data is in cache returns that from the cache*/&lt;br /&gt;metadata = AppCacheManager.RetrieveFromCache(key);&lt;br /&gt;if (metadata == null)&lt;br /&gt;metadata = GetMetadataFromDB(key);&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;metadata = GetMetadataFromDB(key);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;catch (Exception e)&lt;br /&gt;{&lt;br /&gt;throw new Exception() ;&lt;br /&gt;}&lt;br /&gt;return metadata;&lt;br /&gt;}&lt;br /&gt;/// Flushes the Metadata&lt;br /&gt;public static void FlushMetadata(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;if (AppCacheManager.ExistsInCache(key))&lt;br /&gt;{&lt;br /&gt;AppCacheManager.RemoveFromCache(key);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;private static object GetMetadataFromDB(EnumeratorsConfiguration.CacheKey key)&lt;br /&gt;{&lt;br /&gt;object metadata = null;&lt;br /&gt;/*data is not in cache, so get the data from the database and put that in cache*/&lt;br /&gt;switch (key)&lt;br /&gt;{&lt;br /&gt;case EnumeratorsConfiguration.CacheKey.Location:&lt;br /&gt;DataSet dsLocation = BackEndManager.GetLocationList();&lt;br /&gt;AppCacheManager.AddToCache(key, dsLocation);&lt;br /&gt;metadata = dsLocation;&lt;br /&gt;break;&lt;br /&gt;case EnumeratorsConfiguration.CacheKey.Region :&lt;br /&gt;List&lt;region&gt; lstRegion = BackEndManager.GetRegionList();&lt;br /&gt;AppCacheManager.AddToCache(key, lstRegion);&lt;br /&gt;metadata = lstRegion;&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;return metadata;&lt;br /&gt;}&lt;br /&gt;#endregion&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Now in our Page_Load Event we can do the following&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;ddlRegion.Items.Clear();&lt;br /&gt;ddlRegion.Items.Add(new ListItem("---Select---", "0"));&lt;br /&gt;List&lt;region&gt; lstRegion = (List&lt;region&gt;)MetadataManager.GetMetadata(ConfigurationEnumerators.CacheKey.Region);&lt;br /&gt;foreach (Region objRegion in lstRegion)&lt;br /&gt;{&lt;br /&gt;ListItem li = new ListItem();&lt;br /&gt;li.Text = objRegion.Name.ToString();&lt;br /&gt;li.Value = objRegion.RegionID.ToString();&lt;br /&gt;ddlRegion.Items.Add(li);&lt;br /&gt;}&lt;br /&gt;ddlRegion.DataBind();&lt;br /&gt;}&lt;br /&gt;I will post Upadte and Remove Cache very soon&lt;br /&gt;However, the problem with the MS Caching application block is that it carries a lot of overhead and has a lot of features that may not be useful for your application&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family:Times New Roman;font-size:85%;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-7740649030747238582?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/7740649030747238582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=7740649030747238582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7740649030747238582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7740649030747238582'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/09/bind-dropdownlist-using-cache-value.html' title='Bind DropDownList Using Cache Value'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-8244553661907325440</id><published>2009-08-27T05:37:00.000-07:00</published><updated>2009-08-27T05:46:32.695-07:00</updated><title type='text'>Bind DropdownList by an Enum</title><content type='html'>&lt;span style="font-size:85%;"&gt;i have an enum like using System;using System.Collections.Generic;using System.Text; namespace ConfigurationManager{ public static class ConfigurationEnumerators&lt;br /&gt;{&lt;br /&gt;public enum EventTypeValues&lt;br /&gt;{&lt;br /&gt;Red= 1,&lt;br /&gt;Green= 2,&lt;br /&gt;Yellow= 3,&lt;br /&gt;White= 4,&lt;br /&gt;Blue = 5,&lt;br /&gt;Violate = 0&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt; } &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;This is a color type enum.Now i am going to populate a dropdown list by this Color Enumarator ddlColorType.Items.Insert(0, "------Select------");&lt;br /&gt;foreach (string str in Enum.GetNames(typeof(ConfigurationEnumerators.EventTypeValues)))&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;{&lt;br /&gt;ddlCarType.Items.Insert((int)Enum.Parse(typeof( ConfigurationEnumerators.EventTypeValues), str ),str.ToString());&lt;br /&gt;} &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;The dropdownlist is populated by the enum with the string at its TextField and the int value at its Index fieldNow it is possible to collect the selected dropdownlist value by ddlColorType.SelectedIndex property&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-8244553661907325440?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/8244553661907325440/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=8244553661907325440' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8244553661907325440'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8244553661907325440'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/08/bind-dropdownlist-by-enum.html' title='Bind DropdownList by an Enum'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-4417779935454504325</id><published>2009-08-24T21:02:00.000-07:00</published><updated>2009-08-27T05:42:47.017-07:00</updated><title type='text'>Commma Elemination from Comma Separatoe</title><content type='html'>&lt;p&gt;&lt;br /&gt;string ids= string.Empty;&lt;br /&gt;foreach (User objUser in dtUser)&lt;br /&gt;{&lt;br /&gt;ids= ids+ obiUser.UserId.ToString() + ",";&lt;br /&gt;}&lt;br /&gt;if (ids.Length &gt; 0)&lt;br /&gt;{&lt;br /&gt;ids= ids.Substring(0, ids.Length - 1);&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;Just devide the whole string into a substring upto the leangth -1 and place it to a string&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-4417779935454504325?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/4417779935454504325/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=4417779935454504325' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/4417779935454504325'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/4417779935454504325'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/08/commma-elemination-from-comma-separatoe.html' title='Commma Elemination from Comma Separatoe'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5795532571245069762</id><published>2009-08-23T22:57:00.000-07:00</published><updated>2009-08-23T23:09:15.412-07:00</updated><title type='text'>Enumaretion with C#</title><content type='html'>&lt;p&gt;&lt;strong&gt;&lt;span style="font-size:130%;"&gt;Enums Defined&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Enums are lists of strongly typed constants with members that has symbolic names, corresponding integral values.&lt;br /&gt;The System.Enum .NET Framework Class Library type is the base class of enum types and contains methods that allow you to work with enums in different ways, such as working with a list of names or values, converting from value to name, and converting from name to value.&lt;br /&gt;Enum base types can be changed and member values can be specified.&lt;br /&gt;Enums make working with strongly typed constants via symbolic names easy.&lt;br /&gt;Enums are value types, which mean they contain their own value, can't inherit or be inherited from, and assignment copies the value of one enum to another.&lt;br /&gt;&lt;br /&gt;Simply if a single number needs a definition to make it easier to read then weuse a constant like     &lt;/p&gt;&lt;p&gt;  public const int myVar = 0;&lt;br /&gt; if more than one related number needs a definition, then we can use an Enumeration      &lt;/p&gt;&lt;p&gt;&lt;strong&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;Difference Between ‘Enum’ and ‘enum’&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;The C# type, enum, inherits the Base Class Library type, Enum. Use the C# type, enum, to define new enums and use Enum, to implement static enum methods.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Creating an Enum&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Declaration&lt;br /&gt;[attributes] [modifiers] enum identifier [:base-type]&lt;br /&gt;{&lt;br /&gt;  enumerator-list [,]&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;·  The attributes is optional and is used to hold additional declarative information.&lt;br /&gt; The modifier is optional. The allowed modifiers are new, public, protected, internal and private.&lt;br /&gt; The keyword enum must be followed by an identifier that names the enum.&lt;br /&gt; The base-type of an enumeration may be one of the following; byte, sbyte, short, ushort, int, uint, long or ulong. If no base-type is declared, than the default of int is used.&lt;br /&gt; The enumerator-list contains the identifiers which are separated by commas&lt;br /&gt;The first enumerator begins at zero by default and each enumerator following is increased by 1. This can be overridden so that each member of the enumerator-list contains its own unrelated value.&lt;br /&gt;Two items in an enumeration can hold the same value, however, this will cause problems if you use an automated switch statement where all elements are added.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Text;        &lt;/p&gt;&lt;p&gt; // declares the enum&lt;/p&gt;&lt;p&gt;public enum Universe{  &lt;/p&gt;&lt;p&gt; Planet,  &lt;/p&gt;&lt;p&gt; Stars,   &lt;/p&gt;&lt;p&gt;Satellite&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;// demonstrates how to use the enum&lt;/p&gt;&lt;p&gt;class CreateEnum{  &lt;/p&gt;&lt;p&gt; static void Main()   &lt;/p&gt;&lt;p&gt;{      &lt;/p&gt;&lt;p&gt;// create and initialize      &lt;/p&gt;&lt;p&gt; // instance of enum type     &lt;/p&gt;&lt;p&gt;Universe varUniverse = Universe.Planet;     &lt;/p&gt;&lt;p&gt; // make decision based     &lt;/p&gt;&lt;p&gt; // on enum value      &lt;/p&gt;&lt;p&gt;switch (varUniverse)    &lt;/p&gt;&lt;p&gt;  {         &lt;/p&gt;&lt;p&gt;case varUniverse.Planet:         &lt;/p&gt;&lt;p&gt;   Console.WriteLine("Enum Picks the planet.");           &lt;/p&gt;&lt;p&gt; break;        &lt;/p&gt;&lt;p&gt; case varUniverse.Stars:            &lt;/p&gt;&lt;p&gt;Console.WriteLine("Enum pics the Stars.");          &lt;/p&gt;&lt;p&gt;  break;         &lt;/p&gt;&lt;p&gt;case varUniverse.Satellite:          &lt;/p&gt;&lt;p&gt;  Console.WriteLine("Enum picks the Satellite.");           &lt;/p&gt;&lt;p&gt; break;    &lt;/p&gt;&lt;p&gt;  }      &lt;/p&gt;&lt;p&gt;Console.ReadLine();   &lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;}&lt;br /&gt;Here I have declared an enum by using the enum keyword having a type identifier (Universe).The enum contains a comma separated list of values enclosed within curly braces.&lt;br /&gt;This enum is of type Universe and we use it to declare the varUniverse variable in the Main method. Since an enum is a value type, we can assign a value (Universe.Planet) to it directly, similar to the simple types such as int or double.&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Using Enums&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;Enum can be customized by changing its base type and its member values. By default, the list type of an enum is int.During enum declaration you can change this default by the base types include byte, sbyte, short, ushort, int, uint, long, and ulong.&lt;br /&gt;Another modification you can make to an enum is to set the value of any enum member. By default, the first member of an enum takes zero.You can change it to any number you want.Two or more list member can have the same value.But it would some logical error through your programme thereafter.&lt;br /&gt;using System;&lt;/p&gt;&lt;p&gt;// declares the enum&lt;/p&gt;&lt;p&gt;public enum Universe&lt;/p&gt;&lt;p&gt;{   &lt;/p&gt;&lt;p&gt;Planet=1,  &lt;/p&gt;&lt;p&gt; Stars,   &lt;/p&gt;&lt;p&gt;Satellite&lt;/p&gt;&lt;p&gt;}&lt;/p&gt;&lt;p&gt;// demonstrates how to use the enum&lt;br /&gt;class CreateEnum{ &lt;br /&gt; static void Main()  &lt;br /&gt;{     &lt;br /&gt;// create and initialize     &lt;br /&gt; // instance of enum type    &lt;br /&gt;Universe varUniverse = Universe.Planet;    &lt;br /&gt; // make decision based    &lt;br /&gt; // on enum value     &lt;br /&gt;switch (varUniverse)   &lt;br /&gt;  {        &lt;br /&gt;case varUniverse.Planet:        &lt;br /&gt;   Console.WriteLine("Enum Picks the planet.");          &lt;br /&gt; break;       &lt;br /&gt; case varUniverse.Stars:           &lt;br /&gt;Console.WriteLine("Enum pics the Stars.");         &lt;br /&gt;  break;        &lt;br /&gt;case varUniverse.Satellite:         &lt;br /&gt;  Console.WriteLine("Enum picks the Satellite.");          &lt;br /&gt; break;   &lt;br /&gt;  }     &lt;br /&gt;Console.ReadLine();  &lt;br /&gt;}&lt;br /&gt;} &lt;/p&gt;&lt;p&gt;The first member of the Universe enum, Planet, has its value changed to 1. You are restricted from creating forward references, circular references, and duplicate references in enum members.&lt;br /&gt;&lt;br /&gt;As the default value of Planet is changed to 1, so the rest values are Stars=2, Satellite=3&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Changing Enum Base Type&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;using System;&lt;br /&gt;// declares the enum&lt;br /&gt;public enum Universe : byte&lt;br /&gt;{  &lt;br /&gt;Planet=1, &lt;br /&gt; Stars,  &lt;br /&gt;Satellite&lt;br /&gt;}&lt;br /&gt;// demonstrates how to use the enumclass CreateEnum{   static void Main()   {      // create and initialize       // instance of enum type     Universe varUniverse = Universe.Planet;      // make decision based      // on enum value      switch (varUniverse)      {         case varUniverse.Planet:            Console.WriteLine("Enum Picks the planet.");            break;         case varUniverse.Stars:            Console.WriteLine("Enum pics the Stars.");            break;         case varUniverse.Satellite:            Console.WriteLine("Enum picks the Satellite.");            break;      }      Console.ReadLine();   }} &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5795532571245069762?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5795532571245069762/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5795532571245069762' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5795532571245069762'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5795532571245069762'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/08/enums-defined-enums-are-lists-of.html' title='Enumaretion with C#'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-6811990889097346899</id><published>2009-07-02T03:05:00.000-07:00</published><updated>2009-07-02T03:18:25.430-07:00</updated><title type='text'>Read Child Node From a XML and Bind a DropDown List By this</title><content type='html'>&lt;span style="font-size:85%;"&gt;My xml file is Like that&lt;br /&gt;&lt;weather_data&gt;&lt;br /&gt;Root Node := Weather_Data&lt;br /&gt;Parent Nade : = Weather&lt;br /&gt;&lt;br /&gt;Child Node Under Parent  "Weather"&lt;br /&gt;ChildNode : City&lt;br /&gt;ChildNode :Weather&lt;br /&gt;&lt;/weather_data&gt;&lt;br /&gt;  public ArrayList ReadValue(string tag, string key)&lt;br /&gt;    {&lt;br /&gt;        string _file = "Weather.xml";&lt;br /&gt;        ArrayList arr = new ArrayList();&lt;br /&gt;        string _path = Server.MapPath("~/");&lt;br /&gt;        //load the document into a stream&lt;br /&gt;        FileStream stream = new FileStream(_path + _file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);&lt;br /&gt;        XmlDocument doc = new XmlDocument();&lt;br /&gt;        //load the stream into an XML Document&lt;br /&gt;        doc.Load(stream);&lt;br /&gt;        //variable to hold the value&lt;br /&gt;        string returnValue = string.Empty;&lt;br /&gt;        //get all the elements for the specified tag&lt;br /&gt;        XmlNodeList nodeList = doc.GetElementsByTagName(tag);&lt;br /&gt;        //loop through the document&lt;br /&gt;        for (int i = 0; i &lt; nodeList.Count; i++)&lt;br /&gt;        {&lt;br /&gt;            for (int j = 0; j &lt; nodeList[i].ChildNodes.Count; j++)&lt;br /&gt;            {&lt;br /&gt;                //check to see if we have a match&lt;br /&gt;                if (nodeList[i].ChildNodes[j].Name == key)&lt;br /&gt;                {&lt;br /&gt;                    returnValue = nodeList[i].ChildNodes[j].InnerText;&lt;br /&gt;                    arr.Add(nodeList[i].ChildNodes[j].InnerText);&lt;br /&gt;                    //break;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        return arr;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Call the above method for bind your DropdownList Like&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;ArrayList arrList= ReadValue("Weather", "City");&lt;br /&gt;DropDownList1.DataSource = &lt;/span&gt;&lt;span style="font-size:85%;"&gt;arrList&lt;/span&gt;&lt;span style="font-size:85%;"&gt;;&lt;br /&gt;DropDownList1.DataBind();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;&lt;br /&gt;Hope This will help you&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-6811990889097346899?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/6811990889097346899/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=6811990889097346899' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6811990889097346899'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6811990889097346899'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/07/read-child-node-from-xml-and-bind.html' title='Read Child Node From a XML and Bind a DropDown List By this'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-1920514426851061536</id><published>2009-07-01T23:13:00.000-07:00</published><updated>2009-07-02T00:38:09.551-07:00</updated><title type='text'>HTTPWeb Request and Responses With Source Code</title><content type='html'>&lt;span style="font-weight: bold;"&gt;HTTP REQUEST /RESPONSES&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;p&gt;&lt;span style="font-size:85%;"&gt;Basically, an HTTP client initiates a request through web browser. It establishes a Transmission Control Protocol (TCP) connection to a particular port on a host server (port 80 by default). An HTTP server  that port waits for the client's  request message. After receiving  the request, the server sends back a status line, such as "HTTP/1.1 200 OK", and a message of its own, the body of which is may be the requested resource, an error message, or some other information.&lt;/span&gt;&lt;/p&gt; &lt;p&gt;&lt;span style="font-size:85%;"&gt;Resource accessing by the HTTP are identified using Uniform Resource Identifier (URI)or, more specifically, Uniform Resource Locator (URL) by the &lt;tt&gt;http:&lt;/tt&gt; or  https URI schemas.&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;span style="font-weight: bold;"&gt;HTTP REQUEST STYLE&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;1.&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;Request line (such as &lt;tt&gt;GET&lt;/tt&gt;)&lt;br /&gt;2.Header ( &lt;span style="font-family:monospace;"&gt;such as&lt;/span&gt;&lt;tt&gt; Accept-Language: en&lt;/tt&gt;)&lt;br /&gt;3.Empty Line&lt;br /&gt;4.Optional message body&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HTTP REQUEST METHODS&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Hyper Text Transfer Protocol (HTTP) defines eight methods for the next action for existing resource.I am giving you a short description on that eight methods.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HEAD&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;It is almost like a get request without the response body. This is useful for retrieving meta-information written in response headers, without sending the entire content.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;GET&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;Get requests a representation of the specified resource. &lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;POST&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;Post submits data to be processed from your form to the requesting resources. The data is included in the body of the request. It may create a new resource or update the existing resources or both.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PUT&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;Put uploads a representation of the specified resource.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DELETE&lt;/span&gt;&lt;br /&gt;  It deletes the specified resource.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TRACE&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;It returns back to the received request, so that a client can see what intermediate servers are adding or changing in existing the request.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;OPTIONS&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;It returns the HTTP methods that the server supports for specified URL. This can be used to check the functionality of a web server by requesting '*' instead of a specific resource.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CONNECT&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-size:85%;"&gt;Converts the request connection to a transparent TCP/IP tunnel, usually to facilitate SSL-encrypted communication (HTTPS) through an unencrypted HTTP proxy.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CREATING REQUEST AND GETTING RESPONSES&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;      // Create a request for the URL.       &lt;br /&gt;      WebRequest request = WebRequest.Create("http://www.google.com");&lt;br /&gt;      // If required by the server, set the credentials.&lt;br /&gt;      request.Credentials = CredentialCache.DefaultCredentials;&lt;br /&gt;      // Get the response.&lt;br /&gt;      HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;      // Display the status.&lt;br /&gt;      if (response.StatusDescription == "OK")&lt;br /&gt;      {&lt;br /&gt;          // Get the stream containing content returned by the server.&lt;br /&gt;          Stream dataStream = response.GetResponseStream();&lt;br /&gt;          // Open the stream using a StreamReader for easy access.&lt;br /&gt;          StreamReader reader = new StreamReader(dataStream);&lt;br /&gt;          // Read the content.&lt;br /&gt;          string responseFromServer = reader.ReadToEnd();&lt;br /&gt;          // Display the content.&lt;br /&gt;          Console.WriteLine(responseFromServer);&lt;br /&gt;          // Cleanup the streams and the response.&lt;br /&gt;          reader.Close();&lt;br /&gt;          dataStream.Close();&lt;br /&gt;          response.Close();&lt;br /&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CREATING REQUEST AND GETTING RESPONSES WITH AUTHENTICATION&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;pre&gt; strId = UserId_TextBox.Text;&lt;br /&gt;string strName = Name_TextBox.Text;&lt;br /&gt;&lt;br /&gt;ASCIIEncoding encoding=new ASCIIEncoding();&lt;br /&gt;string postData="userid="+strId;&lt;br /&gt;postData += ("&amp;amp;username="+strName);&lt;br /&gt;byte[]  data = encoding.GetBytes(postData);&lt;br /&gt;&lt;br /&gt;// Prepare web request...&lt;br /&gt;HttpWebRequest myRequest =&lt;br /&gt;(HttpWebRequest)WebRequest.Create("https://www.sandbox.paypal.com/cgi-bin/webscr");&lt;br /&gt;myRequest.Method = "POST";&lt;br /&gt;myRequest.ContentType="application/x-www-form-urlencoded";&lt;br /&gt;myRequest.ContentLength = data.Length;&lt;br /&gt;Stream newStream=myRequest.GetRequestStream();&lt;br /&gt;// Send the data.&lt;br /&gt;newStream.Write(data,0,data.Length);&lt;br /&gt;newStream.Close();&lt;br /&gt;&lt;/pre&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size:85%;"&gt;        // Write the request back IPN strings&lt;br /&gt;       StreamWriter stOut = new StreamWriter(req.GetRequestStream(), Encoding.ASCII);&lt;br /&gt;       stOut.Write(strNewValue);&lt;br /&gt;       stOut.Close(); &lt;br /&gt;&lt;br /&gt;       //send the request, read the response      &lt;br /&gt;       HttpWebResponse strResponse = (HttpWebResponse)req.GetResponse();&lt;br /&gt;       Stream IPNResponseStream = strResponse.GetResponseStream();&lt;br /&gt;       Encoding encode = System.Text.Encoding.GetEncoding("utf-8");&lt;br /&gt;       StreamReader readStream = new StreamReader(IPNResponseStream, encode);&lt;br /&gt;&lt;br /&gt;       char[] read = new char[257];&lt;br /&gt;       // Reads 256 characters at a time.&lt;br /&gt;int count = readStream.Read(read, 0, 256);           &lt;br /&gt;        readStream.Close();&lt;br /&gt;        strResponse.Close();&lt;br /&gt;&lt;/span&gt;                        &lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-1920514426851061536?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/1920514426851061536/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=1920514426851061536' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/1920514426851061536'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/1920514426851061536'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/07/httpweb-request-and-responses-with.html' title='HTTPWeb Request and Responses With Source Code'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-158463745413333343</id><published>2009-07-01T23:10:00.000-07:00</published><updated>2009-07-02T22:49:49.202-07:00</updated><title type='text'>Check URL Exsists Or Not(HttpWebResponse Status)</title><content type='html'>&lt;span style="font-size:85%;"&gt;Import the base class "System.Net" at the begining &lt;br /&gt;&lt;br /&gt;         string URL = TextBox1.Text;&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            //Create a HTTP Web Request for the URL.&lt;br /&gt;            WebRequest request = WebRequest.Create(URL);&lt;br /&gt;            request.Proxy = null;&lt;br /&gt;            //Get the HTTP Web Response.&lt;br /&gt;            HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;            //Display the status.&lt;br /&gt;            Response.Write(response.StatusDescription);&lt;br /&gt;&lt;br /&gt;            if (response.StatusDescription == "OK")&lt;br /&gt;            {&lt;br /&gt;                Response.Write("\n Site Exists.");&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                Response.Write("Does Not Exists.");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            throw new Exception("Request Incomplete..Please Contact with your System Administrator :" + ex);&lt;br /&gt;        }&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-158463745413333343?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/158463745413333343/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=158463745413333343' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/158463745413333343'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/158463745413333343'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/07/check-url-exsists-or-nothttpwebresponse.html' title='Check URL Exsists Or Not(HttpWebResponse Status)'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-6410887583132803248</id><published>2009-06-27T03:53:00.000-07:00</published><updated>2009-08-04T23:13:39.844-07:00</updated><title type='text'>Asp.Net Authentication</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5Csubhamay%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"\0022"; 	panose-1:0 0 0 0 0 0 0 0 0 0; 	mso-font-alt:"Times New Roman"; 	mso-font-charset:0; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:auto; 	mso-font-signature:0 0 0 0 0 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} p.MsoListBullet, li.MsoListBullet, div.MsoListBullet 	{mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} a:link, span.MsoHyperlink 	{color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{color:purple; 	text-decoration:underline; 	text-underline:single;} pre 	{margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Courier New"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* 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-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;Authentication is a process to check the user’s identity.The authenticated user information is stored in &lt;b&gt;HttpContext.User.Identity&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;There are three types of authentication in Asp.Net&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;font-family:&amp;quot;;font-size:100%;"  &gt;. &lt;/span&gt;&lt;span style="font-weight: bold;font-size:100%;" &gt;Forms authentication&lt;/span&gt; &lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;span style=";font-family:Symbol;font-size:100%;"  &gt;·&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:100%;"  &gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Windows authentication &lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;span style=";font-family:Symbol;font-size:100%;"  &gt;·&lt;/span&gt;&lt;span style=";font-family:&amp;quot;;font-size:100%;"  &gt; &lt;/span&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;Passport authentication&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;span style="font-size:100%;"&gt;&lt;b&gt;.    Custom Authentication&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Forms authentication&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;This authentication is based on cookies where the user name and the password are stored either in a &lt;a href="http://aspalliance.com/907" target="undefined"&gt;&lt;/a&gt;file or in the database. After a user get authenticated, the credentials are stored in a cookie to in that session. This authentication supports both session and persistent cookies.&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Windows authentication&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;This authentication relies upon IIS.After IIS authenticates a client, it passes a security token key to ASP.NET. ASP.NET constructs and attaches an object of the &lt;i style=""&gt;WindowsPrincipal&lt;/i&gt; Class to the application context based on the security token it receives from IIS&lt;/p&gt;  &lt;p class="MsoListBullet"&gt;&lt;b&gt;&lt;span style="font-family:Arial;"&gt;Pussport authentication&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;Passport authentication provider is a centralized authentication service provided by Microsoft that offers a single logon and core profile services for member sites. Passport is basically a forms-based authentication service. In this mode of authentication the Passport service grants a site-specific key. The Passport logon server uses this key to encrypt and decrypt the query strings passed between the member site and the Passport logon server.&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;Authentication modes can be specified in the application’s web.config file as shown below:&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;Example1&lt;/p&gt;  &lt;pre&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;configuration&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;authentication&lt;/span&gt;&lt;span style="color:black;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;mode&lt;/span&gt;&lt;span style="color:blue;"&gt;="[Windows/Forms/Passport/None]"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;authentication&lt;/span&gt;&lt;span style="color:blue;"&gt;&gt;&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;configuration&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal" style=""&gt;OR&lt;/p&gt;  &lt;p class="MsoNormal" style=""&gt;Example2&lt;/p&gt;  &lt;pre&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;configuration&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;authentication&lt;/span&gt;&lt;span style="color:black;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;mode&lt;/span&gt;&lt;span style="color:blue;"&gt;="Forms"&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;forms&lt;/span&gt;&lt;span style="color:black;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;name&lt;/span&gt;&lt;span style="color:blue;"&gt;="UserLogin"&lt;/span&gt;&lt;span style="color:red;"&gt;loginUrl&lt;/span&gt;&lt;span style="color:blue;"&gt;="UserLogin.aspx"&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;authorization&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;deny&lt;/span&gt;&lt;span style="color:black;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;users&lt;/span&gt;&lt;span style="color:blue;"&gt;="?"&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;authorization&lt;/span&gt;&lt;span style="color:blue;"&gt;&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:maroon;"&gt;configuration&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;b&gt;OR&lt;br /&gt;&lt;/b&gt;Example3&lt;/p&gt;  &lt;pre&gt;&lt;span style="color:blue;"&gt;if&lt;/span&gt;&lt;span style="color:black;"&gt; (Verify (txtUserName.Text, txtPassword.Text))&lt;br /&gt;{&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;FormsAuthentication.RedirectFromLoginPage(txtUserName.Text, False);&lt;br /&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;else&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;lblMessage.Text &lt;/span&gt;&lt;span style="color:red;"&gt;=&lt;/span&gt;&lt;span style="color:black;"&gt; &lt;/span&gt;&lt;span style="background: rgb(228, 228, 228) none repeat scroll 0% 0%; color: rgb(102, 102, 102); -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;"Invalid UserName/Password specified..."&lt;/span&gt;&lt;span style="color:black;"&gt;;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="color:blue;"&gt;private&lt;/span&gt;&lt;span style="color:black;"&gt; Verify(&lt;/span&gt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&lt;span style="color:black;"&gt; userName, &lt;/span&gt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;&lt;span style="color:black;"&gt; password)&lt;br /&gt;{&lt;br /&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;//Usual Code to connect to the DB &lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;&lt;span style=""&gt;      &lt;/span&gt;&lt;/span&gt;&lt;span style="color:green;"&gt;// and verify the user's credentials&lt;/span&gt;&lt;span style="color:black;"&gt;&lt;br /&gt;}&lt;/span&gt;&lt;/pre&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-6410887583132803248?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/6410887583132803248/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=6410887583132803248' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6410887583132803248'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6410887583132803248'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/06/aspnet-authentication.html' title='Asp.Net Authentication'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-6303488104634748201</id><published>2009-06-26T23:13:00.000-07:00</published><updated>2009-06-27T03:51:35.941-07:00</updated><title type='text'>Get Text Box/Dropdown Value By Javascript</title><content type='html'>&lt;script language="javascript" type="text/javascript"&gt;&lt;br /&gt;        function GetValue()&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            var test = document.getElementById('&lt;%=txtMyTextBox.ClientID %&gt;').value;&lt;br /&gt;            var test2 = document.getElementById('&lt;%=DropDownList1.ClientID %&gt;').value;&lt;br /&gt;            alert(test );&lt;br /&gt;             alert(test2 );&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;/script&gt; &lt;span style="font-size:85%;"&gt; &lt;span style="color: rgb(0, 0, 102);"&gt;&lt;script language="javascript" type="text/javascript"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;        function GetValue()&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;        {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;           // var test = document.getElementById('&lt;%=txtMyTextBox.ClientID %&gt;').value;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;             var test2 = document.getElementById('&lt;%=DropDownList1.ClientID %&gt;').value;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;            alert(test2);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;        }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;&lt;/script&gt;&lt;/span&gt;  function GetValue()&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;           // var test = document.getElementById('&lt;%=txtMyTextBox.ClientID %&gt;').value;&lt;br /&gt;             var test2 = document.getElementById('&lt;%=DropDownList1.ClientID %&gt;').value;&lt;br /&gt;            alert(test2);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 102);"&gt;  &lt;asp:button id="sss" runat="server" onclientclick="return GetValue();"&gt;&lt;/asp:button&gt;&lt;/span&gt;&lt;/span&gt;&lt;asp:button id="sss" runat="server" onclientclick="return GetValue();"&gt;&lt;/asp:Button&gt;&lt;br /&gt;&lt;script language="javascript" type="text/javascript"&gt;&lt;br /&gt;        function GetValue()&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;           // var test = document.getElementById('&lt;%=txtMyTextBox.ClientID %&gt;').value;&lt;br /&gt;             var test2 = document.getElementById('&lt;%=DropDownList1.ClientID %&gt;').value;&lt;br /&gt;            alert(test2);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;asp:button id="sss" runat="server" onclientclick="return GetValue();"&gt;&lt;/asp:button&gt;&lt;br /&gt;&lt;asp:button id="sss" runat="server" onclientclick="return GetValue();"&gt;&lt;/asp:button&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-6303488104634748201?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/6303488104634748201/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=6303488104634748201' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6303488104634748201'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6303488104634748201'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/06/get-text-boxdropdown-value-by.html' title='Get Text Box/Dropdown Value By Javascript'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5871438154260039276</id><published>2009-05-14T02:49:00.000-07:00</published><updated>2009-05-14T03:32:31.328-07:00</updated><title type='text'>Caching in Asp.Net</title><content type='html'>&lt;p&gt;   ASP.NET supports two important forms of caching: Page (including sub-page) caching, and Data caching.  &lt;/p&gt;         &lt;p&gt; &lt;span style="font-style: italic; font-weight: bold;"&gt;Page caching&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;allows the server to store a copy of the output of a dynamic page, and to use this to respond to requests instead of running the dynamic code again. Sub-page caching does the same thing, but for parts of pages.&lt;span style="font-style: italic;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-style: italic; font-weight: bold;"&gt;Data caching&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;allows a web application to store commonly used objects so that they are available for use across all pages in the site. While it was possible to do this kind of thing in ASP, using the Application object, it’s a whole lot better in ASP.NET. &lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Page Caching :&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Two types of page caching is there&lt;br /&gt;&lt;/p&gt;&lt;p&gt;                      a) Page Fragment Caching OR Partial Page Caching&lt;/p&gt;&lt;p&gt;                      b) Page Output Caching&lt;br /&gt;&lt;/p&gt;&lt;p&gt; &lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Page Output Caching:&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;When we say that the output of a web page is cached, we imply that the web page output is stored in the cache memory. Whenever a new page request is made, the ASP.NET Cache Engine is activated. It checks whether there is a corresponding cache entry for this page. If one is found, it is known as a Cache hit, else, we say that a cache miss has occurred. If there is a cache hit, i.e., if the ASP.NET Cache engine finds a corresponding cache entry for this page, the page is rendered from the cache, otherwise, the page being requested is rendered dynamically.&lt;/p&gt;&lt;p&gt;Page Output caching can be specified in any of the two ways&lt;/p&gt;&lt;p style="font-weight: bold; font-style: italic; color: rgb(0, 0, 153);"&gt;1. By declaration &lt;/p&gt;&lt;p&gt;&lt;%@ OutputCache Duration="no of seconds"&lt;br /&gt;Location="Any | Client | Downstream | Server | None"&lt;br /&gt;VaryByControl="control"&lt;br /&gt;VaryByCustom="browser |customstring"&lt;br /&gt;VaryByHeader="headers"&lt;br /&gt;VaryByParam="parameter" %&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;h4&gt;&lt;a name="3"&gt;Where the Cached Data Stored?&lt;/a&gt;&lt;/h4&gt;     &lt;p&gt;when some makes a request from a website there are two types of cache that may satisfy the request without  reaching the original server.&lt;/p&gt;&lt;p&gt; The first is the personal cache maintained by the user’s web browser (a ‘browser cache’).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The second is a shared cache present on the network between the user’s browser and the origin server (a ‘proxy cache’).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The page output cache maintained by ASP.NET on the web server is a further type of cache, but when you specify page caching - by setting the Location parameter - you can also make use of these first two sorts of caches.&lt;/p&gt;     &lt;p&gt;The values of the OutputCacheLocation  is given below. &lt;/p&gt;     &lt;table width="90%" align="center" border="1" cellpadding="3" cellspacing="0"&gt;    &lt;tbody&gt;&lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;Any [default]&lt;/td&gt;&lt;td class="csharp"&gt;The page can be cached on any of: the browser; the proxy server; the web server.&lt;/td&gt;    &lt;/tr&gt;    &lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;Client&lt;/td&gt;&lt;td class="csharp"&gt;The page is to be cached on the browser.&lt;/td&gt;    &lt;/tr&gt;    &lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;Client&lt;/td&gt;&lt;td class="csharp"&gt;The page can be cached on the browser or a proxy server.&lt;/td&gt;    &lt;/tr&gt;    &lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;None&lt;/td&gt;&lt;td class="csharp"&gt;The page is not to be cached.&lt;/td&gt;    &lt;/tr&gt;    &lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;Server&lt;/td&gt;&lt;td class="csharp"&gt;The page is to be cached on the web server.&lt;/td&gt;    &lt;/tr&gt;    &lt;tr valign="top"&gt;     &lt;td class="csharp"&gt;ServerAndClient&lt;/td&gt;&lt;td class="csharp"&gt;The page can be cached on the browser or on the server.&lt;/td&gt;    &lt;/tr&gt;   &lt;/tbody&gt;&lt;/table&gt;    &lt;p&gt;when caching occurs elsewhere rather than on the server, treate manipulation of the HTTP 1.1 headers that deal with caching.&lt;br /&gt;&lt;/p&gt;&lt;p style="font-style: italic;"&gt;&lt;span style="font-size:78%;"&gt;reference for details :‘Standard Caching over the Internet’ . &lt;/span&gt;&lt;/p&gt;    &lt;p&gt; &lt;b&gt;Cache Duration :&lt;/b&gt; &lt;/p&gt;     &lt;p&gt;   Pages remain in the cache for some length of time, determined by the Duration parameter. The value is set in seconds.  &lt;/p&gt;     &lt;p&gt; As we shall see later, if the page caching is set programmatically, rather than declaratively, one can also set a ‘Sliding Expiration’ value which increases the cache duration every time a page is requested. &lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;OR&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/p&gt;&lt;p style="font-weight: bold; font-style: italic; color: rgb(0, 0, 153);"&gt;2. By Program&lt;/p&gt;&lt;p class="textCode" nd="16"&gt;Response.Cache.SetCacheability (HttpCacheability.Server);&lt;/p&gt; &lt;p class="textCode" nd="17"&gt;It is also possible to set the OutputCache on all the pages in an ASP.NET application programmatically in the Global.asax page. Refer to the code snippet that follows:--&lt;/p&gt; &lt;p class="textCode" nd="18"&gt;void Application_BeginRequest(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.Server);&lt;br /&gt;    } &lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Page Fragment Caching :&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;It allows specific portions of the web page to be cached rather than caching the entire web page and is useful in situations where a particular web page can contain both static and dynamic content.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;Data Caching :&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-style: italic;"&gt;will be comming soon &lt;/span&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;h2 class="TextBoldBlue"&gt;Conclusion&lt;/h2&gt; Caching is a great tool that can be used to boost the performance web applications.&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5871438154260039276?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5871438154260039276/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5871438154260039276' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5871438154260039276'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5871438154260039276'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/05/caching-in-aspnet.html' title='Caching in Asp.Net'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-7546489902923495763</id><published>2009-05-14T01:28:00.000-07:00</published><updated>2009-10-23T05:02:26.561-07:00</updated><title type='text'>Cookies in Asp.Net</title><content type='html'>&lt;span style="font-size:180%;"&gt;&lt;strong&gt;Cookies&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;A Cookie is a small text file that the browser creates and stores on the hard drive                                     of client machine. Cookie just one or more pieces of information stored as text strings.                                     A Web server sends client a cookie and the browser stores it. The browser then returns                                     the cookie to the server the next time the page is referenced. The most common use                                     of a cookie is to store information about the User and preferences the user                                     makes.&lt;br /&gt;&lt;br /&gt;I order to create a cookie you have 2 variable must be defined as they are the &lt;strong&gt;cookie name&lt;/strong&gt; and the &lt;strong&gt;duration of the cookie before it expired&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;How To Create Cookies In Asp.net&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;&amp;amp; Get Cookie Value&lt;/strong&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;protected void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;    HttpCookie myCookie= new HttpCookie("Address");&lt;br /&gt;    myCookie["Country"] = "India";&lt;br /&gt;    myCookie["City"] = "Kolkata";&lt;br /&gt;    myCookie["Name"] = "Subhamay";&lt;br /&gt;    myCookie.Expires = DateTime.Now.AddDays(2);&lt;br /&gt;    Response.Cookies.Add(myCookie);&lt;br /&gt;    Label1.Text = "I have Created My own Cookie successfully!";&lt;br /&gt;&lt;br /&gt;    HttpCookie cookie = Request.Cookies["Address"];&lt;br /&gt;&lt;br /&gt;    if (cookie != null)&lt;br /&gt;    {&lt;br /&gt;        string country = cookie["Country"];&lt;br /&gt;        string city = cookie["City"];&lt;br /&gt;        string name = cookie["Name"];&lt;br /&gt;    &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;strong&gt;Cookies With Key Value : A Different Approach&lt;br /&gt;&lt;br /&gt;&lt;/strong&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 51);font-family:times new roman;font-size:130%;"  &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre&gt;Creating New Cookie&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;HttpCookie myCookie = new HttpCookie("Cars");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre&gt;add some key value to the cookie&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Values.Add("muffin", "chocolate");&lt;br /&gt;myCookie.Values.Add("babka", "cinnamon");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold; color: rgb(51, 51, 51);font-size:130%;" &gt;add the cookie to cookie collection&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;Response.Cookies.Add(myCookie);&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;//&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;how to get the keys and values stored in a cookie:&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;Response.Write(myCookie.Value.ToString());&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;The output to using this with the previous created cookie is this: "muffin=chocolate&amp;amp;babka=cinnamon".&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(100, 100, 100);"&gt;&lt;pre&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;&lt;span style="font-style: italic;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span style="font-weight: bold;"&gt;Set Life Time Of A cookie&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Expires = DateTime.Now.AddHours(12); Or&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Expires = DateTime.Now.AddDays(7);&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt;&lt;br /&gt;If Cookie Expires property is not set then cookie will be created for the current&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 0, 51);"&gt; browser instance&lt;/span&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;&lt;span style="font-family:monospace;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt; &lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;pre&gt;&lt;span style="font-weight: bold;"&gt;Setting the cookie's path&lt;/span&gt;&lt;b&gt;&lt;br /&gt;&lt;br /&gt;&lt;/b&gt;set a path for a cookie so that it will be available only for that path in your website&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Path = "/mydomain";&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;pre&gt;&lt;pre&gt;&lt;b&gt;&lt;span style="font-size:130%;"&gt;Setting the domain for a cookie&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;pre&gt;&lt;pre&gt;&lt;pre&gt;myCookie.Domain= "mydomain.mysite.com";&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size:130%;"&gt;&lt;span style="font-weight: bold;"&gt;How To Destroy A Cookie&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;there is no method called delete or destroy ..So you can use&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Expires = DateTime.Now.AddDays(-1);&lt;/span&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt;For Removing a subkey:&lt;br /&gt;&lt;br /&gt;&lt;span style=";font-family:Courier New,Courier,mono;font-size:85%;"  &gt;myCookie.Values.Remove("babka");&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/pre&gt;&lt;/pre&gt; &lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span style="color: rgb(51, 51, 51);font-size:130%;" &gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-7546489902923495763?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/7546489902923495763/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=7546489902923495763' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7546489902923495763'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/7546489902923495763'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/05/cookie-in-aspnet.html' title='Cookies in Asp.Net'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5037369760249082956</id><published>2009-05-12T01:03:00.000-07:00</published><updated>2009-05-12T02:21:22.747-07:00</updated><title type='text'>CheckBoxList</title><content type='html'>&lt;h3 class="sect3-title"&gt;&lt;a name="2681"&gt;&lt;/a&gt;&lt;a name="ch32lev2s"&gt;&lt;/a&gt;Populate CheckBoxList (List Control)&lt;br /&gt;&lt;/h3&gt;Creates a group of check boxes. Properties and events are identical to other  list controls, such as &lt;span class="fixed"&gt;DropDownList&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;Remove CheckBoxList Item By Item Text:&lt;/h3&gt;&lt;span&gt;&lt;span style="color:#646464;"&gt;&lt;pre&gt;if (CheckBoxList1.Items.FindByText(itemValue) != null)&lt;br /&gt;      {&lt;br /&gt;          string itemText = CheckBoxList1.Items.FindByText(itemValue).Text;&lt;br /&gt;          ListItem li = new ListItem();&lt;br /&gt;          li.Text = itemText;&lt;br /&gt;          li.Value = itemValue;&lt;br /&gt;          Label1.Text = "Removed Item Is: " + itemText;&lt;br /&gt;          CheckBoxList1.Items.Remove(li);&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;h3 class="sect3-title"&gt;Remove CheckBoxList Item By Item Value&lt;/h3&gt; &lt;span&gt;&lt;span style="color:#646464;"&gt;&lt;pre&gt;if (CheckBoxList1.Items.FindByValue(itemValue) != null)&lt;br /&gt;      {&lt;br /&gt;          string itemText = CheckBoxList1.Items.FindByValue(itemValue).Text;&lt;br /&gt;          ListItem li = new ListItem();&lt;br /&gt;          li.Text = itemText;&lt;br /&gt;          li.Value = itemValue;&lt;br /&gt;          Label1.Text = "Item Found and remove: " + itemText;&lt;br /&gt;          CheckBoxList1.Items.Remove(li);&lt;br /&gt;      }&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;Add ListItem with Item Text and Value in CheckBoxList:&lt;br /&gt;&lt;/h3&gt;&lt;br /&gt;&lt;span&gt;&lt;span style="color:#646464;"&gt;&lt;pre&gt;protected void Button1_Click(object sender, System.EventArgs e)&lt;br /&gt;   {&lt;br /&gt;       ListItem li = new ListItem();&lt;br /&gt;       li.Text = TextBox1.Text.ToString();&lt;br /&gt;       li.Value = TextBox2.Text.ToString();&lt;br /&gt;       CheckBoxList1.Items.Add(li);&lt;br /&gt;       Label1.Text = "ListItem added in CheckBoxList";&lt;br /&gt;      &lt;br /&gt;   }&lt;br /&gt;&lt;/pre&gt;&lt;/span&gt;&lt;/span&gt;&lt;h3 class="sect3-title"&gt;Use Theme &amp;amp; Skin In a Checkboxlist&lt;/h3&gt; &lt;asp:CheckBoxList ID="CheckBoxList1"&lt;br /&gt;     runat="server"&lt;br /&gt;     BorderColor="Gray"&lt;br /&gt;     BorderWidth="2"&lt;br /&gt;     BackColor="White"&lt;br /&gt;     ForeColor="Black"&lt;br /&gt;     Font-Bold="true"&lt;br /&gt;     Font-Italic="true" RepeatColumns="3"&lt;br /&gt;     &gt;&lt;br /&gt;&lt;/asp:CheckBoxList&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;Programatically Bind CheckBoxList and Retrive Value  with comma separator:&lt;br /&gt;&lt;/h3&gt;Bind:&lt;br /&gt;&lt;br /&gt;chkInterest.DataSource = dataTable1&lt;br /&gt;chkInterest.DataTextField = "Name"&lt;br /&gt;chkInterest.DataValueField = "Id"&lt;br /&gt;chkInterest.DataBind();&lt;br /&gt;&lt;br /&gt;Retrieve: &lt;br /&gt;&lt;br /&gt;protected void imgSubmit_Click(object sender, ImageClickEventArgs e)&lt;br /&gt;    {&lt;br /&gt;      &lt;br /&gt;&lt;br /&gt;        string strInterests = "";&lt;br /&gt;        string strHobbies = "";&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        for (int i = 0; i &lt; chkInterest.Items.Count; i++)&lt;br /&gt;        {&lt;br /&gt;            if (chkInterest.Items[i].Selected)&lt;br /&gt;            {&lt;br /&gt;                strInterests += chkInterest.Items[i].Text + ",";&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        strInterests = strInterests.Trim(new char[] { ',' });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        for (int j = 0; j &lt; chkListHobby.Items.Count; j++)&lt;br /&gt;        {&lt;br /&gt;            if (chkListHobby.Items[j].Selected)&lt;br /&gt;            {&lt;br /&gt;                strHobbies += chkListHobby.Items[j].Text + ",";&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        strHobbies = strHobbies.Trim(new char[] { ',' });&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5037369760249082956?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5037369760249082956/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5037369760249082956' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5037369760249082956'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5037369760249082956'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/05/checkboxlist.html' title='CheckBoxList'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-8549927545233756660</id><published>2009-05-12T00:19:00.000-07:00</published><updated>2009-05-12T00:59:06.667-07:00</updated><title type='text'>Array Class</title><content type='html'>&lt;h3 class="sect3-title"&gt;&lt;a name="405"&gt;&lt;/a&gt;&lt;a name="ch05lev2"&gt;&lt;/a&gt;Creating Arrays&lt;/h3&gt;The &lt;span class="fixed"&gt;Array&lt;/span&gt; class is abstract, so using constructor array class can not be created.To create an arrays we use the static &lt;span class="fixed"&gt;CreateInstance()&lt;/span&gt;  method.&lt;br /&gt;&lt;br /&gt;By this way type of the elements in advance is not necessary to be known, as the type is passed to the &lt;span class="fixed"&gt;CreateInstance()&lt;/span&gt; method as a &lt;span class="fixed"&gt;Type&lt;/span&gt;  object.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Array MyArray= Array.CreateInstance(typeof(int), 5);  //( type of Array,Size of Array)&lt;br /&gt;            for (int i = 0; i &lt; 5; i++)&lt;br /&gt;            {&lt;br /&gt;                MyArray.SetValue(33, i);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            for (int i = 0; i &lt; 5; i++)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine(MyArray.GetValue(i));&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;a name="407"&gt;&lt;/a&gt;&lt;a name="ch05lev2"&gt;&lt;/a&gt;Copying Arrays&lt;/h3&gt;&lt;br /&gt;&lt;p class="first-para"&gt;Arrays are reference types, assigning an array  variable to another one  it need two varriable referencing to the same array.  For copying arrays, the array implements the interface &lt;span class="fixed"&gt;ICloneable&lt;/span&gt;. The &lt;span class="fixed"&gt;Clone()&lt;/span&gt; method that  is defined with this interface creates a shallow copy of the array.&lt;/p&gt;&lt;p class="first-para"&gt;If the array contains reference types, the elements are not copied, just the  references&lt;/p&gt;&lt;p class="first-para"&gt;Car[] cars= {&lt;br /&gt;                        new Car("Car", "Toyota"),&lt;br /&gt;                        new Person("Bike", "Yahamaha")&lt;br /&gt;                      };&lt;br /&gt;            Car[] CarClone = (Car[])CarClone .Clone();&lt;br /&gt;&lt;/p&gt; int[] intArray1 = { 1, 2 };&lt;br /&gt;            int[] intArray2 = (int[])intArray1.Clone();&lt;br /&gt;&lt;br /&gt;&lt;h3 class="sect3-title"&gt;&lt;a name="411"&gt;&lt;/a&gt;&lt;a name="ch05lev2"&gt;&lt;/a&gt;Sorting Arrays&lt;/h3&gt;&lt;br /&gt;&lt;p class="first-para"&gt;The &lt;span class="fixed"&gt;Array&lt;/span&gt; class implements a  bubble-sort for sorting the elements in the array. The &lt;span class="fixed"&gt;Sort()&lt;/span&gt; method requires the interface &lt;span class="fixed"&gt;IComparable&lt;/span&gt; to be implemented by the elements in the array.  Simple types such as &lt;span class="fixed"&gt;System.String&lt;/span&gt; and &lt;span class="fixed"&gt;System.Int32&lt;/span&gt; implement &lt;span class="fixed"&gt;IComparable&lt;/span&gt;,  so you can sort elements containing these types.&lt;/p&gt;&lt;p class="first-para"&gt; string[] names = {&lt;br /&gt;                   "Subhamay",&lt;br /&gt;                   "Chaki",&lt;br /&gt;                   "Alok",&lt;br /&gt;                   "Gautam"&lt;br /&gt;                 };&lt;br /&gt;&lt;br /&gt;            Array.Sort(names);&lt;br /&gt;&lt;br /&gt;            foreach (string name in names)&lt;br /&gt;            {&lt;br /&gt;                Console.WriteLine(name);&lt;br /&gt;            }&lt;br /&gt;&lt;/p&gt;If you are using custom classes with the array, you must implement the interface  &lt;span class="fixed"&gt;IComparable&lt;/span&gt;. This interface defines just one method  &lt;span class="fixed"&gt;CompareTo()&lt;/span&gt; that must return 0 if the objects to  compare are equal, a value smaller than 0 if the instance should go before the  object from the parameter, and a value larger than 0 if the instance should go  after the object from the parameter.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-8549927545233756660?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/8549927545233756660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=8549927545233756660' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8549927545233756660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8549927545233756660'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/05/array-class.html' title='Array Class'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5945239641660710852</id><published>2009-05-11T22:33:00.000-07:00</published><updated>2009-05-12T00:18:11.938-07:00</updated><title type='text'>Array</title><content type='html'>&lt;h2 class="first-section-title"&gt;&lt;a name="385"&gt;&lt;/a&gt;&lt;a name="ch05lev1"&gt;&lt;/a&gt;Simple  Arrays&lt;/h2&gt;An array is a data structure that contains object/data of same type&lt;br /&gt;&lt;div class="section"&gt; &lt;h3 class="sect3-title"&gt;&lt;a name="386"&gt;&lt;/a&gt;&lt;a name="ch05lev2"&gt;&lt;/a&gt;Array  Declaration&lt;/h3&gt; &lt;p class="first-para"&gt;An array is declared by defining the type of the elements  inside the array followed by empty brackets and a variable name; for example, an  array containing integer elements is declared like this:&lt;/p&gt; &lt;div class="informalexample"&gt;&lt;pre class="programlisting"&gt;&lt;span style="background-color: rgb(192, 192, 192);"&gt;&lt;span style="color:#000000;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;int [] sampleArray&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;h3 class="sect3-title"&gt;&lt;a name="392"&gt;&lt;/a&gt;&lt;a name="ch05lev2"&gt;&lt;/a&gt;Using Reference  Types&lt;/h3&gt; &lt;p class="first-para"&gt; arrays can be declared of a type of a custom class. Let Us take an example of "Product" class having two constructor an ToString() method&lt;/p&gt;&lt;p class="first-para"&gt;&lt;br /&gt;&lt;/p&gt;&lt;p class="first-para"&gt;public class Product&lt;br /&gt;{&lt;br /&gt;    public Product()  //default constructor&lt;br /&gt;    {&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public Product(string name, string description)   //parametrized constructor&lt;br /&gt;    {&lt;br /&gt;        this.name = name;&lt;br /&gt;        this.description = description;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private string _name;&lt;br /&gt;    private string _description;&lt;br /&gt;&lt;br /&gt;    public string ProductName&lt;br /&gt;    {&lt;br /&gt;        get { return _name; }&lt;br /&gt;        set { _name = value; }&lt;br /&gt;    }  &lt;br /&gt;&lt;br /&gt;    public string Description&lt;br /&gt;    {&lt;br /&gt;        get { return _description; }&lt;br /&gt;        set { _description = value; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public override string ToString()&lt;br /&gt;    {&lt;br /&gt;        return name + " " + description;&lt;br /&gt;    }&lt;br /&gt;}&lt;/p&gt;&lt;p class="para"&gt;Now Declaring an array of four  is similar to declaring an array of &lt;span class="fixed"&gt;int&lt;/span&gt;:&lt;/p&gt;&lt;p class="para"&gt;Product [] myProduct = new Product[4]&lt;br /&gt;&lt;span style="font-family: monospace;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;p class="para"&gt;Here memory must be allocated for each array element otherwise a &lt;span class="fixed"&gt;NullReferenceException&lt;/span&gt; will be thrown.&lt;span style="font-family: monospace;"&gt;&lt;/span&gt;&lt;/p&gt; &lt;p class="first-para"&gt;&lt;br /&gt;&lt;/p&gt;&lt;h2 class="first-section-title"&gt;&lt;a name="396"&gt;&lt;/a&gt;&lt;a name="ch05lev1"&gt;&lt;/a&gt;Multidimensional Arrays&lt;/h2&gt; &lt;p class="first-para"&gt;1-dimension array are  indexed by a single integer. A multidimensional array is indexed by two or more  integers.&lt;/p&gt;&lt;h3 class="sect3-title"&gt;How To Declare Two Dimension Array&lt;br /&gt;&lt;/h3&gt; &lt;p class="first-para"&gt; int[,] myarray = new int[3, 3];&lt;br /&gt;        myarray[0, 0] = 1;&lt;br /&gt;        myarray[0, 1] = 2;&lt;br /&gt;        myarray[0, 2] = 3;&lt;br /&gt;        myarray[1, 0] = 4;&lt;br /&gt;        myarray[1, 1] = 5;&lt;br /&gt;        myarray[1, 2] = 6;&lt;br /&gt;        myarray[2, 0] = 7;&lt;br /&gt;        myarray[2, 1] = 8;&lt;br /&gt;        myarray[2, 2] = 9;&lt;br /&gt;&lt;/p&gt;&lt;a name="393"&gt;&lt;/a&gt;&lt;a name="IDX-"&gt;&lt;/a&gt; &lt;div class="informalexample"&gt;&lt;h3 class="sect3-title"&gt;How To Declare Three Dimension Array&lt;/h3&gt; &lt;pre class="programlisting"&gt;&lt;br /&gt;int[,,] threedim = {&lt;br /&gt;                    { { 1, 2 }, { 3, 4 } },&lt;br /&gt;                    { { 5, 6 }, { 7, 8 } },&lt;br /&gt;                    { { 9, 10 }, { 11, 12 } }&lt;br /&gt;                  };&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;h2 class="first-section-title"&gt;&lt;a name="399"&gt;&lt;/a&gt;&lt;a name="ch05lev1"&gt;&lt;/a&gt;Jagged  Arrays&lt;/h2&gt; &lt;p class="first-para"&gt;A 2-dimensional array has a rectangular size (for example 3  by 3 elements). A jagged array is more flexible in sizing the array. With a  jagged array every row can have a different size.&lt;/p&gt; &lt;p class="para"&gt; a  2-dimensional array that has 3x3 elements with a jagged array. The jagged array can  contains three rows where the first row would have elements, the second row would have elements, and the third would have three elements.&lt;/p&gt;&lt;span class="figuremediaobject"&gt;&lt;a href="images/fig188_01_0.jpg" target="_parent" name="IMG_9"&gt;&lt;/a&gt;&lt;/span&gt;&lt;a name="401"&gt;&lt;/a&gt;&lt;a name="IDX-"&gt;&lt;/a&gt; &lt;p class="para"&gt;  int[][] jagged = new int[3][];&lt;br /&gt;            jagged[0] = new int[2] { 1, 2 };&lt;br /&gt;            jagged[1] = new int[6] { 3, 4, 5, 6, 7, 8 };&lt;br /&gt;            jagged[2] = new int[3] { 9, 10, 11 };&lt;/p&gt;&lt;p class="para"&gt;Itaration through for loop&lt;br /&gt;&lt;/p&gt;&lt;p class="para"&gt; for (int row = 0; row &lt; jagged.Length; row++)&lt;br /&gt;            {&lt;br /&gt;                for (int element = 0; element &lt; jagged[row].Length; element++)&lt;br /&gt;                {&lt;br /&gt;                    Console.WriteLine("row: {0}, element: {1}, value: {2}",&lt;br /&gt;                       row, element, jagged[row][element]);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;pre class="programlisting"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;/div&gt;&lt;pre class="programlisting"&gt;&lt;/pre&gt;&lt;/div&gt;&lt;a name="387"&gt;&lt;/a&gt;&lt;a name="IDX-"&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5945239641660710852?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5945239641660710852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5945239641660710852' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5945239641660710852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5945239641660710852'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/05/array.html' title='Array'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-5414031298984406285</id><published>2009-02-20T00:47:00.000-08:00</published><updated>2009-02-20T01:44:24.981-08:00</updated><title type='text'>String and String Formatting</title><content type='html'>Inm Asp.Net framework format inline string expressions, including &lt;code&gt;&lt;span class="code-SDKkeyword"&gt;String&lt;/span&gt;.Format&lt;/code&gt;[&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemStringClassFormatTopic.asp" target="_blank"&gt;^&lt;/a&gt;], &lt;code&gt;StringBuilder.AppendFormat&lt;/code&gt;[&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemTextStringBuilderClassAppendFormatTopic.asp" target="_blank"&gt;^&lt;/a&gt;], and &lt;code&gt;TextWriter.Write&lt;/code&gt;[&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOTextWriterClassWriteTopic.asp" target="_blank"&gt;^&lt;/a&gt;] (and &lt;code&gt;WriteLine&lt;/code&gt;[&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemIOTextWriterClassWriteLineTopic.asp" target="_blank"&gt;^&lt;/a&gt;]), which the &lt;code&gt;Console&lt;/code&gt;[&lt;a href="http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemConsoleClassTopic.asp" target="_blank"&gt;^&lt;/a&gt;] class inherits&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DateTime String Formatting :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="margin-top: 0pt;" id="pre4" lang="cs"&gt;DateTime now = DateTime.Now;&lt;br /&gt;&lt;span class="code-keyword"&gt;string&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Short date: {0:d}"&lt;/span&gt;, now);&lt;br /&gt;&lt;span class="code-keyword"&gt;string&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Long date:          {0:D}"&lt;/span&gt;, now);&lt;br /&gt;&lt;span class="code-keyword"&gt;string&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Sortable date/time: {0:s}"&lt;/span&gt;, now);&lt;br /&gt;&lt;span class="code-keyword"&gt;string&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;Custom date:        {0:ddd, MMM dd, yyyy}"&lt;/span&gt;, now);&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;span style="font-weight: bold;"&gt;Currency String Formatting($3.00) :&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre style="margin-top: 0pt;" id="pre4" lang="cs"&gt;&lt;span class="code-keyword"&gt;Currency:     String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{0:C}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Decimal:      String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{0:C}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Scientific:   String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{1:E}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Fixed point:  String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{1:F}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;General:.     &lt;/span&gt;&lt;span class="code-keyword"&gt;String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;{0:G}&lt;span class="code-string"&gt;"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Number:       &lt;/span&gt;&lt;span class="code-keyword"&gt;String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{0:N}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Percent:. &lt;/span&gt;&lt;span class="code-keyword"&gt;    String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{1:P}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;span class="code-keyword"&gt;Round-trip:   &lt;/span&gt;&lt;span class="code-keyword"&gt;String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{1:R}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;Hexadecimal:  &lt;span class="code-keyword"&gt;String&lt;/span&gt;.Format(&lt;span class="code-string"&gt;"&lt;/span&gt;&lt;span class="code-string"&gt;{0:X}"&lt;/span&gt;, &lt;&gt;);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-5414031298984406285?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/5414031298984406285/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=5414031298984406285' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5414031298984406285'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/5414031298984406285'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2009/02/string-and-string-formatting.html' title='String and String Formatting'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-2448641023558826686</id><published>2008-10-31T00:47:00.000-07:00</published><updated>2008-10-31T00:52:09.818-07:00</updated><title type='text'></title><content type='html'>Put your DataTable value to ViewState such that you can rearrange the ViewState&lt;br /&gt;&lt;br /&gt; ViewState["userDataSource"] = dtTemp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public SortDirection GridViewSortDirection&lt;br /&gt;    {&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            if (ViewState["sortDirection"] == null)&lt;br /&gt;                ViewState["sortDirection"] = SortDirection.Ascending;&lt;br /&gt;            return (SortDirection)ViewState["sortDirection"];&lt;br /&gt;        }&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            ViewState["sortDirection"] = value;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    private void SortGridView(string sortExpression, string direction)&lt;br /&gt;    {&lt;br /&gt;        DataTable dt = ((DataTable)ViewState["userDataSource"]);&lt;br /&gt;        DataView dv = new DataView(dt);&lt;br /&gt;        dv.Sort = sortExpression + " " + direction;&lt;br /&gt;       &lt;br /&gt;        this.gvUser.DataSource = dv;&lt;br /&gt;        gvUser.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void gvUser_Sorting(object sender, GridViewSortEventArgs e)&lt;br /&gt;    {&lt;br /&gt;       &lt;br /&gt;        string sortExpression = e.SortExpression;&lt;br /&gt;        GridView dd = ((GridView)(object)sender);&lt;br /&gt;       &lt;br /&gt;        if (GridViewSortDirection == SortDirection.Ascending)&lt;br /&gt;        {&lt;br /&gt;            GridViewSortDirection = SortDirection.Descending;&lt;br /&gt;            SortGridView(sortExpression, "DESC");&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            GridViewSortDirection = SortDirection.Ascending;&lt;br /&gt;            SortGridView(sortExpression, "ASC");&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-2448641023558826686?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/2448641023558826686/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=2448641023558826686' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/2448641023558826686'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/2448641023558826686'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/10/put-your-datatable-value-to-viewstate.html' title=''/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-6123717252080512249</id><published>2008-10-31T00:32:00.000-07:00</published><updated>2008-10-31T00:47:02.515-07:00</updated><title type='text'>Pagination in DataList</title><content type='html'>Generally DataList Control does not support pagination by its default properties..But if you need it you have to do it by mannual coding.&lt;br /&gt;&lt;br /&gt;Add&lt;br /&gt; PagedDataSource pds = new PagedDataSource();&lt;br /&gt;at the top of your Page_Load(object sender, EventArgs e)   event&lt;br /&gt;&lt;br /&gt;Now Add  these methods in your code behind page&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public void BindDatalist()   //Get Data and Set Page Size ,Page Index&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        //dlstFeatureAlbum.DataSource = FeatureAlbum.GetAlbums();&lt;br /&gt;       // dlstFeatureAlbum.DataBind();&lt;br /&gt;&lt;br /&gt;        DataTable dt = new DataTable();&lt;br /&gt;&lt;br /&gt;        dt = FeatureAlbum.GetAlbums();&lt;br /&gt;        pds.DataSource = dt.DefaultView;&lt;br /&gt;        pds.AllowPaging = true;&lt;br /&gt;        pds.PageSize = 24;//Convert.ToInt16(ddlPageSize.SelectedValue);&lt;br /&gt;        if (dt.Rows.Count &lt;= 24)&lt;br /&gt;        {&lt;br /&gt;            divPageIndex.Visible = false;&lt;br /&gt;        }&lt;br /&gt;        if (dt.Rows.Count == 0)&lt;br /&gt;        {&lt;br /&gt;            lblEmptyList.Visible = true;&lt;br /&gt;        }&lt;br /&gt;        pds.CurrentPageIndex = CurrentPage;&lt;br /&gt;        lnkbtnNext.Enabled = !pds.IsLastPage;&lt;br /&gt;        lnkbtnPrevious.Enabled = !pds.IsFirstPage;&lt;br /&gt;&lt;br /&gt;        dlstFeatureAlbum.DataSource = pds;&lt;br /&gt;        dlstFeatureAlbum.DataBind();&lt;br /&gt;&lt;br /&gt;        doPaging();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    //Code for Pagination&lt;br /&gt;&lt;br /&gt;    public int CurrentPage                            //this method is for storing the current page index&lt;br /&gt;                                                                         //to view state&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        get&lt;br /&gt;        {&lt;br /&gt;            if (this.ViewState["CurrentPage"] == null)&lt;br /&gt;                return 0;&lt;br /&gt;            else&lt;br /&gt;                return Convert.ToInt16(this.ViewState["CurrentPage"].ToString());&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        set&lt;br /&gt;        {&lt;br /&gt;            this.ViewState["CurrentPage"] = value;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void doPaging()                          //Calculating total results and divide them into pages&lt;br /&gt;    {&lt;br /&gt;        DataTable dt = new DataTable();&lt;br /&gt;        dt.Columns.Add("PageIndex");&lt;br /&gt;        dt.Columns.Add("PageText");&lt;br /&gt;        for (int i = 0; i &lt; pds.PageCount; i++)&lt;br /&gt;        {&lt;br /&gt;            DataRow dr = dt.NewRow();&lt;br /&gt;            dr[0] = i;&lt;br /&gt;            dr[1] = i + 1;&lt;br /&gt;            dt.Rows.Add(dr);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        dlPaging.DataSource = dt;&lt;br /&gt;        dlPaging.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void dlPaging_ItemCommand(object source, DataListCommandEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (e.CommandName.Equals("lnkbtnPaging"))&lt;br /&gt;        {&lt;br /&gt;            CurrentPage = Convert.ToInt16(e.CommandArgument.ToString());&lt;br /&gt;            BindDatalist();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void lnkbtnPrevious_Click(object sender, EventArgs e)  //navigation&lt;br /&gt;    {&lt;br /&gt;        CurrentPage -= 1;&lt;br /&gt;        BindDatalist();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void lnkbtnNext_Click(object sender, EventArgs e)  //navigation&lt;br /&gt;    {&lt;br /&gt;        CurrentPage += 1;&lt;br /&gt;        BindDatalist();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void dlPaging_ItemDataBound(object sender, DataListItemEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        LinkButton lnkbtnPage = (LinkButton)e.Item.FindControl("lnkbtnPaging");&lt;br /&gt;        if (lnkbtnPage.CommandArgument.ToString() == CurrentPage.ToString())&lt;br /&gt;        {&lt;br /&gt;            lnkbtnPage.Enabled = false;&lt;br /&gt;            lnkbtnPage.Font.Bold = true;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    protected void ddlPageSize_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CurrentPage = 0;&lt;br /&gt;        BindDatalist();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    //End&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-6123717252080512249?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/6123717252080512249/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=6123717252080512249' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6123717252080512249'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/6123717252080512249'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/10/pagination-in-datalist.html' title='Pagination in DataList'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-4202457148200828815</id><published>2008-10-31T00:30:00.000-07:00</published><updated>2008-10-31T00:32:23.242-07:00</updated><title type='text'>Write XML from code behind</title><content type='html'>public void CreateXMLFile(string FileName)&lt;br /&gt;    {&lt;br /&gt;        DataTable dt = new DataTable();&lt;br /&gt;        dt = FeatureAlbum.GetAlbums();&lt;br /&gt;        string path;&lt;br /&gt;        path = System.AppDomain.CurrentDomain.BaseDirectory.ToString() + FileName + ".xml";&lt;br /&gt;        System.Xml.XmlDocument doc = new System.Xml.XmlDocument();&lt;br /&gt;        System.IO.FileInfo fileName = new System.IO.FileInfo(path);&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            if (!fileName.Exists)&lt;br /&gt;            {&lt;br /&gt;                StreamWriter sw = new StreamWriter(path, true);&lt;br /&gt;                sw.WriteLine("&lt;simpleviewergallery maximageheight="'1024'" maximagewidth="'1024'" textcolor="'0xFFFFFF'" framecolor="'0xffffff'" framewidth="'20'" stagepadding="'40'" thumbnailcolumns="'3'" thumbnailrows="'3'" navposition="'left'" title="'Madeira'" enablerightclickopen="'true'" backgroundimagepath="''" thumbpath="'thumb/'" imagepath="''"&gt;");&lt;br /&gt;                sw.WriteLine("&lt;/simpleviewergallery&gt;");&lt;br /&gt;                sw.Flush();&lt;br /&gt;                sw.Close();&lt;br /&gt;            }&lt;br /&gt;            doc.Load(path);&lt;br /&gt;            XmlElement newElem;&lt;br /&gt;            XmlElement newChElem;&lt;br /&gt;            XmlElement newSuperChElem;&lt;br /&gt;            XmlNode XNode;&lt;br /&gt;&lt;br /&gt;            for (int i = 0; i &lt; dt.Rows.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                newElem = doc.CreateElement("image");&lt;br /&gt;                doc.DocumentElement.AppendChild(newElem);&lt;br /&gt;                // newElem.SetAttribute("","");&lt;br /&gt;&lt;br /&gt;                newChElem = doc.CreateElement("filename");&lt;br /&gt;                newChElem.InnerText = dt.Rows[i]["Name"].ToString();&lt;br /&gt;                newElem.AppendChild(newChElem);&lt;br /&gt;&lt;br /&gt;                newChElem = doc.CreateElement("caption");&lt;br /&gt;                newChElem.InnerText = dt.Rows[i]["Description"].ToString();&lt;br /&gt;                newElem.AppendChild(newChElem);&lt;br /&gt;            }&lt;br /&gt;            //newChElem = doc.CreateElement("Time");&lt;br /&gt;            //newChElem.InnerText = "Time";&lt;br /&gt;            //newElem.AppendChild(newChElem);&lt;br /&gt;&lt;br /&gt;            XmlTextWriter writer = new XmlTextWriter(path, System.Text.Encoding.ASCII);&lt;br /&gt;            writer.Formatting = Formatting.Indented;&lt;br /&gt;            doc.Save(writer);&lt;br /&gt;            writer.Close();&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            //Your Catch block here...&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-4202457148200828815?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/4202457148200828815/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=4202457148200828815' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/4202457148200828815'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/4202457148200828815'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/10/write-xml-from-code-behind.html' title='Write XML from code behind'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-8615898244893776342</id><published>2008-08-06T05:25:00.000-07:00</published><updated>2008-08-06T05:27:13.424-07:00</updated><title type='text'>Friend Function</title><content type='html'>&lt;p&gt; A friend function is not a class member and yet it can have access to private and protected members of a class. Friends are not called by using member selection operators such as “ . or -&gt;” unless they are members of another class. Friend functions can be defined inside a class declaration. Friend functions declared within a class are inline just like other inline member functions. These functions act as though they were defined immediately after all class members have been seen but before the end of the class declaration. Even though friend functions are declared inside class declarations, they are not considered in the scope of the enclosing class. They are normally considered in the file scope. An entire class can be declared as a friend of another class. &lt;/p&gt;&lt;p&gt;To declare a function as a friend of a class, put the word “friend” before the function prototype in the class definition. For example, you want to show that ClassTwo is a friend of ClassOne, simply put the word “friend” in front of ClassTwo like:&lt;/p&gt;&lt;p&gt;friend class ClassTwo;&lt;/p&gt;&lt;p&gt;This line should be inside the definition of class ClassOne and declared explicitly. The friendship between ClassOne and ClassTwo is neither symmetric nor transitive. This means that ClassTwo is a friend of ClassOne but ClassOne cannot be assumed to be a friend of ClassTwo. Same concept applies when you have multiple classes connected by multiple friendships. Friendship can only go one way. &lt;/p&gt;&lt;p&gt;A partial example of friends accessing private members of a class goes something like this:&lt;/p&gt;&lt;p&gt;class ClassOne{&lt;br /&gt;// friend declaration should appear before the declaration of public and private member function&lt;br /&gt;friend void ClassTwo ( ClassOne &amp;amp;, int); // friend declaration&lt;br /&gt;public:&lt;br /&gt;Count( ) { x = 0; } // constructor&lt;br /&gt;Void print( ) const { cout &lt;&lt; x &lt;&lt; endl;} // output&lt;br /&gt;Private:&lt;br /&gt;Int x; // data member&lt;br /&gt;};&lt;/p&gt;&lt;p&gt;//ClassTwo is declared as a friend function of ClassOne&lt;br /&gt;void ClassTwo( ClassOne &amp;amp;c, int val)&lt;br /&gt;{&lt;br /&gt;c.x = val;&lt;br /&gt;}&lt;br /&gt;int main( )&lt;br /&gt;{&lt;br /&gt;ClassOne counter;&lt;br /&gt;counter.print ( );&lt;br /&gt;ClassTwo( counter,10); // set x with a friend&lt;br /&gt;Counter.print( );&lt;br /&gt;Return 0;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;The purpose of using friend function is to improve performance. Sometimes when a member function cannot be used in a certain operation, using friends would be able to solve that problem. &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-8615898244893776342?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/8615898244893776342/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=8615898244893776342' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8615898244893776342'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/8615898244893776342'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/08/friend-function.html' title='Friend Function'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-1998894081228982127</id><published>2008-08-05T00:06:00.001-07:00</published><updated>2008-08-05T00:07:53.820-07:00</updated><title type='text'>Devide Tree Menu in Two Diff Column</title><content type='html'>public void GetCategoryTree()&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;         BpBL.ProjectCategory objCat = new BpBL.ProjectCategory();&lt;br /&gt;&lt;br /&gt;      //  PopulateTreeViewControl(categoryList);&lt;br /&gt;        DataTable dtTemp= new DataTable();&lt;br /&gt;        DataTable dtSubCat = new DataTable();&lt;br /&gt;        DataTable dtDemoTable1;&lt;br /&gt;        DataTable dtDemoTable2;&lt;br /&gt;      &lt;br /&gt;        dtTemp=objCat.SelectMainCategory();&lt;br /&gt;        dtDemoTable1 = dtTemp.Clone();&lt;br /&gt;        dtDemoTable2 = dtTemp.Clone();&lt;br /&gt;        int count = Convert.ToInt32(dtTemp.Rows.Count);&lt;br /&gt;        int i=0;&lt;br /&gt;&lt;br /&gt;        foreach(DataRow drMain in dtTemp.Rows)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            if (i++ % 2 == 0)&lt;br /&gt;            {&lt;br /&gt;                dtDemoTable1.LoadDataRow(drMain.ItemArray, true);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                dtDemoTable2.LoadDataRow(drMain.ItemArray, true);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        dtTemp.Clear();&lt;br /&gt;        TreeNode parentNode = null;&lt;br /&gt;        //Binding First Tree View&lt;br /&gt;        foreach (DataRow dr in dtDemoTable1.Rows)&lt;br /&gt;        {&lt;br /&gt;            parentNode = new TreeNode(dr["CategoryName"].ToString(), dr["Id"].ToString());&lt;br /&gt;            dtSubCat = objCat.SelectSubCategory(dr["Id"].ToString());&lt;br /&gt;            foreach (DataRow drSubcat in dtSubCat.Rows)&lt;br /&gt;            {&lt;br /&gt;               // TreeNode childNode = new TreeNode(product.ProductName, product.ProductID.ToString());&lt;br /&gt;                TreeNode childNode = new TreeNode(drSubcat["CategoryName"].ToString(), drSubcat["Id"].ToString());&lt;br /&gt;&lt;br /&gt;                parentNode.ChildNodes.Add(childNode);&lt;br /&gt;            }&lt;br /&gt;       &lt;br /&gt;        parentNode.Collapse();&lt;br /&gt;       &lt;br /&gt;        treeViewProjCat.ShowCheckBoxes = TreeNodeTypes.All;&lt;br /&gt;        treeViewProjCat.Nodes.Add(parentNode);&lt;br /&gt;   &lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        //Binding 2nd Tree View&lt;br /&gt;&lt;br /&gt;        foreach (DataRow dr in dtDemoTable2.Rows)&lt;br /&gt;        {&lt;br /&gt;            parentNode = new TreeNode(dr["CategoryName"].ToString(), dr["Id"].ToString());&lt;br /&gt;            dtSubCat = objCat.SelectSubCategory(dr["Id"].ToString());&lt;br /&gt;            foreach (DataRow drSubcat in dtSubCat.Rows)&lt;br /&gt;            {&lt;br /&gt;                // TreeNode childNode = new TreeNode(product.ProductName, product.ProductID.ToString());&lt;br /&gt;                TreeNode childNode = new TreeNode(drSubcat["CategoryName"].ToString(), drSubcat["Id"].ToString());&lt;br /&gt;&lt;br /&gt;                parentNode.ChildNodes.Add(childNode);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            parentNode.Collapse();&lt;br /&gt;&lt;br /&gt;            treeViewProjCat2.ShowCheckBoxes = TreeNodeTypes.All;&lt;br /&gt;            treeViewProjCat2.Nodes.Add(parentNode);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-1998894081228982127?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/1998894081228982127/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=1998894081228982127' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/1998894081228982127'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/1998894081228982127'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/08/devide-tree-menu-in-two-diff-column.html' title='Devide Tree Menu in Two Diff Column'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-3454178472375659495</id><published>2008-07-23T02:28:00.000-07:00</published><updated>2008-07-23T02:34:48.548-07:00</updated><title type='text'>execute parameterized stored procedure from code behind</title><content type='html'>Add This to your Web.config file&lt;br /&gt;&lt;configuration&gt;&lt;br /&gt; &lt;br /&gt;    &lt;appsettings&gt;&lt;br /&gt;                &lt;add key="connStr" value="Persist Security Info=False;server=db-srv;User ID=sa;Password=sa@1234; Database=bp"&gt;&lt;br /&gt;&lt;/appsettings&gt;&lt;br /&gt;&lt;/configuration&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["ConStr"]);&lt;br /&gt;                SqlCommand cmd = new SqlCommand("spCheckProjectStatus", conn);&lt;br /&gt;                cmd.CommandType = CommandType.StoredProcedure;&lt;br /&gt;&lt;br /&gt;                SqlParameter sqlParam = new SqlParameter();&lt;br /&gt;                sqlParam = cmd.Parameters.Add("@ProjectId",SqlDbType.VarChar);&lt;br /&gt;                sqlParam.Direction = ParameterDirection.Input;&lt;br /&gt;                sqlParam.Value = dtTemp.Rows[i]["Pid"].ToString();&lt;br /&gt;&lt;br /&gt;                SqlParameter sqlParam2 = new SqlParameter();&lt;br /&gt;                sqlParam2 = cmd.Parameters.Add("@BiderId",SqlDbType.VarChar);&lt;br /&gt;                sqlParam2.Direction = ParameterDirection.Input;&lt;br /&gt;                sqlParam2.Value = dtTemp.Rows[i]["Bid"].ToString();&lt;br /&gt;&lt;br /&gt;                conn.Open();&lt;br /&gt;                SqlDataReader dr = cmd.ExecuteReader();&lt;br /&gt;                conn.Close();&lt;br /&gt;&lt;br /&gt;hope this will help you....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-3454178472375659495?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/3454178472375659495/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=3454178472375659495' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/3454178472375659495'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/3454178472375659495'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/07/execute-parameterized-stored-procedure.html' title='execute parameterized stored procedure from code behind'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3500377907910657119.post-3794482061160371328</id><published>2008-07-22T21:06:00.000-07:00</published><updated>2008-07-22T21:12:55.678-07:00</updated><title type='text'>Generate Random Key with integer and character</title><content type='html'>&lt;span style="font-family: arial;"&gt;use&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;System.Security;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt; System.Security.Cryptography;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;in the include section&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;private string GetUniqueKey()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;  {&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      int maxSize = 8;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      int minSize = 5;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      char[] chars = new char[62];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      string a;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      chars = a.ToCharArray();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      int size = maxSize;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      byte[] data = new byte[1];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      RNGCryptoServiceProvider crypto = new RNGCryptoServiceProvider();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      crypto.GetNonZeroBytes(data);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      size = maxSize;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      data = new byte[size];&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      crypto.GetNonZeroBytes(data);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      StringBuilder result = new StringBuilder(size);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      foreach (byte b in data)&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      {&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;          result.Append(chars[b % (chars.Length - 1)]);&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      }&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;      return result.ToString();&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;  }&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-family: arial;"&gt;hope it will help you&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3500377907910657119-3794482061160371328?l=aspdotnetwithweb.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetwithweb.blogspot.com/feeds/3794482061160371328/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=3500377907910657119&amp;postID=3794482061160371328' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/3794482061160371328'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3500377907910657119/posts/default/3794482061160371328'/><link rel='alternate' type='text/html' href='http://aspdotnetwithweb.blogspot.com/2008/07/generate-random-key-with-integer-and.html' title='Generate Random Key with integer and character'/><author><name>Subhamay</name><uri>http://www.blogger.com/profile/01604674564424056851</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://bp0.blogger.com/_76_SOrXkY1A/SIqjq12Fr4I/AAAAAAAAACM/CbY_UaskaM0/S220/ssssss.JPG'/></author><thr:total>1</thr:total></entry></feed>
