Congratulations!

[Valid RSS] This is a valid RSS feed.

Recommendations

This feed is valid, but interoperability with the widest range of feed readers could be improved by implementing the following recommendations.

Source: http://dotnetfarrukhabbas.blogspot.com/feeds/posts/default?alt=rss

  1. <?xml version='1.0' encoding='UTF-8'?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearchrss/1.0/" xmlns:blogger="http://schemas.google.com/blogger/2008" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-2888154610211197125</atom:id><lastBuildDate>Wed, 27 Mar 2024 06:38:17 +0000</lastBuildDate><category>Asp.Net</category><category>Tips</category><category>JavaScript</category><category>C#</category><category>Convert IList into Datatable</category><category>CrystalReport Connection</category><category>Custom Pagign</category><category>Custom Sorting</category><category>Database</category><category>Dynamic DataTable</category><category>Generic List into DataTable</category><category>MVC</category><category>MVC 5.0</category><category>Pdf watermark</category><category>asp.net C#</category><category>dynamic paging</category><category>dynamic sorting</category><category>iTextSharp</category><category>pager control</category><category>paging control</category><title>M.Farrukh Abbas</title><description>I have worked on no of technologies including C# .Net, VB .Net, ASP.Net, LINQ, WCF, X++, and SharePoint,Oracle,Crystal Reports.</description><link>http://dotnetfarrukhabbas.blogspot.com/</link><managingEditor>noreply@blogger.com (M. Farrukh Abbas)</managingEditor><generator>Blogger</generator><openSearch:totalResults>28</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1133434010293717968</guid><pubDate>Tue, 11 Apr 2017 08:15:00 +0000</pubDate><atom:updated>2017-04-11T01:15:02.029-07:00</atom:updated><title>PDF Arabic watermark using MVC and iTextSharp</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
  2. &lt;br /&gt;
  3. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  4. &lt;/h2&gt;
  5. &lt;h2 style=&quot;text-align: center;&quot;&gt;
  6. PDF full page Arabic watermark using MVC and iTextSharp&lt;/h2&gt;
  7. &lt;div&gt;
  8. &lt;br /&gt;&lt;/div&gt;
  9. &lt;div&gt;
  10. &lt;br /&gt;&lt;/div&gt;
  11. &lt;div&gt;
  12. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  13. &lt;b&gt;Download :&amp;nbsp;&lt;a href=&quot;https://drive.google.com/file/d/0BxzDBhhoZIjLYk1ySDdPRm1ibU0/view&quot;&gt;Source Code&lt;/a&gt;&lt;/b&gt;&lt;/h2&gt;
  14. &lt;/div&gt;
  15. &lt;div&gt;
  16. &lt;div class=&quot;MsoNormal&quot;&gt;
  17. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Most
  18. of the time we have requirement to&amp;nbsp;&lt;/span&gt;generate pdf with water mark to
  19. secure and tried to protect from forgery. Here, I will explain how to implement
  20. iTextSharp dll in MVC application to create full page watermark in existing pdf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
  21. &lt;div class=&quot;MsoNormal&quot;&gt;
  22. &lt;br /&gt;&lt;/div&gt;
  23. &lt;h3 style=&quot;text-align: left;&quot;&gt;
  24. Step 1:&lt;/h3&gt;
  25. &lt;h1&gt;
  26. &lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
  27. &lt;div class=&quot;MsoNormal&quot;&gt;
  28. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;First
  29. of all create MVC web application and install iTextSharp package through Nuget package
  30. manager or nugget command mentioned below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
  31. &lt;div class=&quot;MsoNormal&quot;&gt;
  32. &lt;br /&gt;&lt;/div&gt;
  33. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  34. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;60&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  35. &lt;div class=&quot;MsoNormal&quot;&gt;
  36. &lt;br /&gt;&lt;/div&gt;
  37. &lt;div class=&quot;MsoNormal&quot;&gt;
  38. &lt;br /&gt;&lt;/div&gt;
  39. &lt;div class=&quot;MsoNormal&quot;&gt;
  40. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;More
  41. detail:&lt;/span&gt; &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://www.nuget.org/packages/itextsharp.xfaworker&quot;&gt;https://www.nuget.org/packages/itextsharp.xfaworker&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
  42. &lt;div class=&quot;MsoNormal&quot;&gt;
  43. &lt;br /&gt;
  44. &lt;b&gt;Step 2:&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
  45. &lt;b&gt;&lt;br /&gt;&lt;/b&gt;
  46. Add font &quot;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;ARIAL.TTF&quot; in your solution download from&amp;nbsp;&lt;a href=&quot;http://www5.miele.nl/apps/vg/nl/miele/mielea02.nsf/0e87ea0c369c2704c12568ac005c1831/07583f73269e053ac1257274003344e0?OpenDocument&quot;&gt;download font&lt;/a&gt;&amp;nbsp;or search in google.&lt;/span&gt;&lt;/div&gt;
  47. &lt;h3 style=&quot;text-align: left;&quot;&gt;
  48. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Step
  49. 3:&lt;/span&gt;&lt;/h3&gt;
  50. &lt;div class=&quot;MsoNormal&quot;&gt;
  51. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
  52. &lt;div class=&quot;MsoNormal&quot;&gt;
  53. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Open
  54. the controller Home from controller folder in MVC application and add the
  55. following &lt;/span&gt;&lt;span style=&quot;color: #0070c0; font-size: 13.5pt; line-height: 107%;&quot;&gt;ActionResult
  56. &lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;method in
  57. the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
  58. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
  59. &lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
  60. &lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
  61. &lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; ActionResult &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;GetArabicWaterMarkPdf&lt;/span&gt;()
  62.        {
  63.            &lt;span style=&quot;color: #888888;&quot;&gt;// Source File Path&lt;/span&gt;
  64.            &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; originalFile = Server.MapPath(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;~/Attachment/Sample.pdf&quot;&lt;/span&gt;);
  65.  
  66.            &lt;span style=&quot;color: #888888;&quot;&gt;// Destination File path&lt;/span&gt;
  67.            &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; destinationpath = Server.MapPath(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;~/Attachment/SamplewithArabicWaterMark.pdf&quot;&lt;/span&gt;);
  68.  
  69.            &lt;span style=&quot;color: #888888;&quot;&gt;// Read file from file location&lt;/span&gt;
  70.            PdfReader reader = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfReader(originalFile);
  71.  
  72.            &lt;span style=&quot;color: #888888;&quot;&gt;//define font size and style&lt;/span&gt;
  73.            &lt;span style=&quot;color: #888888;&quot;&gt;// use specific font for arabic text&lt;/span&gt;
  74.            BaseFont bf = BaseFont.CreateFont(Server.MapPath(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;~/fonts/ARIAL.TTF&quot;&lt;/span&gt;), BaseFont.IDENTITY_H, BaseFont.EMBEDDED);
  75.            Font f = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Font(bf, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;12&lt;/span&gt;);
  76.  
  77.            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;using&lt;/span&gt; (MemoryStream memoryStream = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; MemoryStream())
  78.            {
  79.                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;var&lt;/span&gt; pdfStamper = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfStamper(reader, memoryStream, &lt;span style=&quot;color: #0044dd;&quot;&gt;&#39;\0&#39;&lt;/span&gt;))
  80.                {
  81.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Getting total number of pages of the Existing Document&lt;/span&gt;
  82.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;int&lt;/span&gt; pageCount = reader.NumberOfPages;
  83.  
  84.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Create two New Layer for Watermark&lt;/span&gt;
  85.                    PdfLayer layer = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfLayer(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;WatermarkLayer&quot;&lt;/span&gt;, pdfStamper.Writer);
  86.                    PdfLayer layer2 = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfLayer(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;WatermarkLayer2&quot;&lt;/span&gt;, pdfStamper.Writer);
  87.  
  88.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Loop through each Page&lt;/span&gt;
  89.  
  90.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; layerwarkmarktxt = &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;نموذج&quot;&lt;/span&gt;; &lt;span style=&quot;color: #888888;&quot;&gt;// define text for &lt;/span&gt;
  91.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; Layer2warkmarktxt = &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;خاص وسري&quot;&lt;/span&gt;;
  92.                    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;int&lt;/span&gt; i = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;; i &amp;lt;= pageCount; i++)
  93.                    {
  94.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Getting the Page Size&lt;/span&gt;
  95.                        Rectangle rect = reader.GetPageSize(i);
  96.  
  97.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Get the ContentByte object&lt;/span&gt;
  98.                        PdfContentByte cb = pdfStamper.GetUnderContent(i);
  99.  
  100.  
  101.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Tell the cb that the next commands should be &quot;bound&quot; to this new layer&lt;/span&gt;
  102.  
  103.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Start Layer&lt;/span&gt;
  104.  
  105.                        cb.BeginLayer(layer);
  106.  
  107.  
  108.                        PdfGState gState = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfGState();
  109.  
  110.                        gState.FillOpacity = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0.1f&lt;/span&gt;; &lt;span style=&quot;color: #888888;&quot;&gt;// define opacity level&lt;/span&gt;
  111.                        cb.SetGState(gState);
  112.  
  113.                        &lt;span style=&quot;color: #888888;&quot;&gt;// set font size and style for layer water mark text to generate full page&lt;/span&gt;
  114.                        cb.SetFontAndSize(BaseFont.CreateFont(
  115.                                 BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED), &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;10&lt;/span&gt;);
  116.  
  117.                        List&amp;lt;&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;&amp;gt; watermarkList = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; List&amp;lt;&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;&amp;gt;();
  118.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; singleWaterMarkWidth = cb.GetEffectiveStringWidth(layerwarkmarktxt, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;false&lt;/span&gt;);
  119.  
  120.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; fontHeight = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;10&lt;/span&gt;;
  121.  
  122.                        &lt;span style=&quot;color: #888888;&quot;&gt;//Work out the Watermark for a Single Line on the Page based on the Page Width&lt;/span&gt;
  123.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; currentWaterMarkWidth = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;;
  124.                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; (currentWaterMarkWidth + singleWaterMarkWidth &amp;lt; rect.Width)
  125.                        {
  126.                            watermarkList.Add(layerwarkmarktxt);
  127.                            currentWaterMarkWidth = cb.GetEffectiveStringWidth(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, watermarkList), &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;false&lt;/span&gt;);
  128.                        }
  129.  
  130.                        &lt;span style=&quot;color: #888888;&quot;&gt;//Fill the Page with Lines of Watermarks&lt;/span&gt;
  131.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; currentYPos = rect.Height;
  132.  
  133.                        &lt;span style=&quot;color: #888888;&quot;&gt;//cb.BeginText();&lt;/span&gt;
  134.                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; (currentYPos &amp;gt; &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;)
  135.                        {
  136.                            ColumnText.ShowTextAligned(cb, Element.ALIGN_CENTER, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Phrase(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, watermarkList), f), rect.Width / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, currentYPos, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;, PdfWriter.RUN_DIRECTION_RTL, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;);
  137.  
  138.                            currentYPos -= fontHeight;
  139.                        }
  140.  
  141.  
  142.                        cb.EndLayer();
  143.  
  144.                        &lt;span style=&quot;color: #888888;&quot;&gt;// End First Layer&lt;/span&gt;
  145.  
  146.                        &lt;span style=&quot;color: #888888;&quot;&gt;//**************************************************************//&lt;/span&gt;
  147.  
  148.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Start Layer 2&lt;/span&gt;
  149.  
  150.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Tell the cb that the next commands should be &quot;bound&quot; to this new layer&lt;/span&gt;
  151.                        cb.BeginLayer(layer2);
  152.                        cb.SetFontAndSize(bf, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;50&lt;/span&gt;);
  153.                        Font fl = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Font(bf, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;50&lt;/span&gt;);
  154.                        gState = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfGState();
  155.                        gState.FillOpacity = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0.1f&lt;/span&gt;;
  156.                        cb.SetGState(gState);
  157.  
  158.                        cb.SetColorFill(BaseColor.BLACK);
  159.  
  160.                        &lt;span style=&quot;color: #888888;&quot;&gt;//cb.BeginText();&lt;/span&gt;
  161.                        ColumnText.ShowTextAligned(cb, Element.ALIGN_CENTER, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Phrase(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, Layer2warkmarktxt), fl), rect.Width / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, rect.Height / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;45f&lt;/span&gt;, PdfWriter.RUN_DIRECTION_RTL, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;);
  162.  
  163.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Close the layer&lt;/span&gt;
  164.                        cb.EndLayer();
  165.  
  166.                        &lt;span style=&quot;color: #888888;&quot;&gt;// End Layer 2&lt;/span&gt;
  167.                    }
  168.  
  169.  
  170.  
  171.  
  172.                }
  173.  
  174.                &lt;span style=&quot;color: #888888;&quot;&gt;// Save file to destination location if required&lt;/span&gt;
  175.                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; (System.IO.File.Exists(destinationpath))
  176.                {
  177.                    System.IO.File.Delete(destinationpath);
  178.                }
  179.                System.IO.File.WriteAllBytes(destinationpath, memoryStream.ToArray());
  180.            }
  181.  
  182.            &lt;span style=&quot;color: #888888;&quot;&gt;// send file to browse to open it from destination location.&lt;/span&gt;
  183.            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;File&lt;/span&gt;(destinationpath, &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;application/pdf&quot;&lt;/span&gt;);
  184.        }
  185. &lt;/pre&gt;
  186. &lt;/div&gt;
  187. &lt;br /&gt;
  188. &lt;br /&gt;
  189. Now after paste this code we need to call&amp;nbsp;&lt;span style=&quot;background-color: #f6f8ff; color: #000020;&quot;&gt;GetWaterMarkPdf() method from&amp;nbsp;&lt;/span&gt;view&lt;br /&gt;
  190. &lt;br /&gt;
  191. Open the Index View in Home folder delete all the html text and add one action link like shown as below.&lt;br /&gt;
  192. &lt;br /&gt;
  193. &lt;br /&gt;&lt;/div&gt;
  194. &lt;div&gt;
  195. &lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
  196. &lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: red;&quot;&gt;  &lt;/span&gt;@&lt;span style=&quot;color: #333333;&quot;&gt;Html.ActionLink(&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0; color: #333333;&quot;&gt;&quot;Download Arabicwatermark pdf&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0; color: #333333;&quot;&gt;&quot;GetArabicWaterMarkPdf&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0; color: #333333;&quot;&gt;&quot;Home&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt; { target &lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0; color: #333333;&quot;&gt;&quot;_blank&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;background-color: #ffaaaa; color: red;&quot;&gt;@&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0; color: #333333;&quot;&gt;&quot;btn btn-primary&quot;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt; })&lt;/span&gt;
  197. &lt;/pre&gt;
  198. &lt;/div&gt;
  199. &lt;/div&gt;
  200. &lt;div&gt;
  201. &lt;br /&gt;
  202. After adding action link in the view run the web applicaiton and you will see the page looks like below.&lt;br /&gt;
  203. &lt;br /&gt;
  204. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  205. &lt;/div&gt;
  206. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  207. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLzqDcerWvBFfLJLBrjvEiKNZj5ZZDHauRpnsQ15jyXWzNM_Cl65BXWKdXN3q4Wue6d-nx8ndTeEIp27MgIOv6FSybAtmfeyYR3V2DQmOql_QSmT3iTerla0Xeuh8BjjgVKGaEPj4CjP0/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;192&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgLzqDcerWvBFfLJLBrjvEiKNZj5ZZDHauRpnsQ15jyXWzNM_Cl65BXWKdXN3q4Wue6d-nx8ndTeEIp27MgIOv6FSybAtmfeyYR3V2DQmOql_QSmT3iTerla0Xeuh8BjjgVKGaEPj4CjP0/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  208. &lt;br /&gt;
  209. Press the download water mark pdf button and then browser will open the watermark pdf file as shown below.&lt;br /&gt;
  210. &lt;br /&gt;
  211. &lt;br /&gt;
  212. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  213. &lt;/div&gt;
  214. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  215. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisoowo_Cn47fZcGPvRUYTxJgtIWxQPfyl60u7tLi9qrf-67GDlnlEYIiuMvQ0DSd_wa5jDMI2IcdcPabjV8EfnJKfdazI6P4OlZLxi5WnnFsLzOHAO5KKHMcg_sTttYAWmEMjmXphv_tY/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;334&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEisoowo_Cn47fZcGPvRUYTxJgtIWxQPfyl60u7tLi9qrf-67GDlnlEYIiuMvQ0DSd_wa5jDMI2IcdcPabjV8EfnJKfdazI6P4OlZLxi5WnnFsLzOHAO5KKHMcg_sTttYAWmEMjmXphv_tY/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  216. &lt;br /&gt;
  217. You can see in the background watermark text emboss below the text and image as well as &quot;خاص وسري&quot; written in the middle of the page at 45 degree angle.&lt;br /&gt;
  218. &lt;br /&gt;
  219. &lt;br /&gt;
  220. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  221. &lt;b&gt;Download :&amp;nbsp;&lt;a href=&quot;https://drive.google.com/file/d/0BxzDBhhoZIjLYk1ySDdPRm1ibU0/view&quot;&gt;Source Code&lt;/a&gt;&lt;/b&gt;&lt;/h2&gt;
  222. &lt;br /&gt;&lt;/div&gt;
  223. &lt;/div&gt;
  224. </description><link>http://dotnetfarrukhabbas.blogspot.com/2017/04/pdf-arabic-watermark-using-mvc-and.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s72-c/Capture.PNG" height="72" width="72"/><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1709674192215767207</guid><pubDate>Mon, 10 Apr 2017 10:29:00 +0000</pubDate><atom:updated>2017-04-10T05:01:32.309-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">iTextSharp</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">MVC 5.0</category><category domain="http://www.blogger.com/atom/ns#">Pdf watermark</category><title>Full page waternark using MVC and iTextSharp</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
  225. &lt;br /&gt;
  226. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  227. &lt;/h2&gt;
  228. &lt;h2 style=&quot;text-align: center;&quot;&gt;
  229. PDF full page watermark using MVC and iTextSharp&lt;/h2&gt;
  230. &lt;div&gt;
  231. &lt;br /&gt;&lt;/div&gt;
  232. &lt;div&gt;
  233. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  234. &lt;b&gt;Download :&amp;nbsp;&lt;a href=&quot;https://drive.google.com/file/d/0BxzDBhhoZIjLcUxCZ2YxWDUtSDQ/view&quot;&gt;Source Code&lt;/a&gt;&lt;/b&gt;&lt;/h2&gt;
  235. &lt;/div&gt;
  236. &lt;div&gt;
  237. &lt;div class=&quot;MsoNormal&quot;&gt;
  238. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Most
  239. of the time we have requirement to&amp;nbsp;&lt;/span&gt;generate pdf with water mark to
  240. secure and tried to protect from forgery. Here, I will explain how to implement
  241. iTextSharp dll in MVC application to create full page watermark in existing pdf.&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
  242. &lt;div class=&quot;MsoNormal&quot;&gt;
  243. &lt;br /&gt;&lt;/div&gt;
  244. &lt;h3 style=&quot;text-align: left;&quot;&gt;
  245. Step 1:&lt;/h3&gt;
  246. &lt;h1&gt;
  247. &lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
  248. &lt;div class=&quot;MsoNormal&quot;&gt;
  249. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;First
  250. of all create MVC web application and install iTextSharp package through Nuget package
  251. manager or nugget command mentioned below.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
  252. &lt;div class=&quot;MsoNormal&quot;&gt;
  253. &lt;br /&gt;&lt;/div&gt;
  254. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  255. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;60&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  256. &lt;div class=&quot;MsoNormal&quot;&gt;
  257. &lt;br /&gt;&lt;/div&gt;
  258. &lt;div class=&quot;MsoNormal&quot;&gt;
  259. &lt;br /&gt;&lt;/div&gt;
  260. &lt;div class=&quot;MsoNormal&quot;&gt;
  261. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;More
  262. detail:&lt;/span&gt; &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;a href=&quot;https://www.nuget.org/packages/itextsharp.xfaworker&quot;&gt;https://www.nuget.org/packages/itextsharp.xfaworker&lt;/a&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
  263. &lt;div class=&quot;MsoNormal&quot;&gt;
  264. &lt;br /&gt;&lt;/div&gt;
  265. &lt;h3 style=&quot;text-align: left;&quot;&gt;
  266. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Step
  267. 2:&lt;/span&gt;&lt;/h3&gt;
  268. &lt;div class=&quot;MsoNormal&quot;&gt;
  269. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
  270. &lt;div class=&quot;MsoNormal&quot;&gt;
  271. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;Open
  272. the controller Home from controller folder in MVC application and add the
  273. following &lt;/span&gt;&lt;span style=&quot;color: #0070c0; font-size: 13.5pt; line-height: 107%;&quot;&gt;ActionResult
  274. &lt;/span&gt;&lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;method in
  275. the page.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
  276. &lt;span style=&quot;font-size: 13.5pt; line-height: 107%;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
  277. &lt;div class=&quot;MsoNormal&quot;&gt;
  278. &lt;br /&gt;&lt;/div&gt;
  279. &lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
  280. &lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
  281. &lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;public&lt;/span&gt; ActionResult &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;GetWaterMarkPdf&lt;/span&gt;()
  282.        {
  283.            &lt;span style=&quot;color: #888888;&quot;&gt;// Source File Path&lt;/span&gt;
  284.            &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; originalFile = Server.MapPath(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;~/Attachment/Sample.pdf&quot;&lt;/span&gt;);
  285.  
  286.            &lt;span style=&quot;color: #888888;&quot;&gt;// Destination File path&lt;/span&gt;
  287.            &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; destinationpath = Server.MapPath(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;~/Attachment/SamplewithWaterMark.pdf&quot;&lt;/span&gt;);
  288.  
  289.            &lt;span style=&quot;color: #888888;&quot;&gt;// Read file from file location&lt;/span&gt;
  290.            PdfReader reader = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfReader(originalFile);
  291.  
  292.            &lt;span style=&quot;color: #888888;&quot;&gt;//define font size and style&lt;/span&gt;
  293.            Font font = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Font(FontFamily.HELVETICA, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;10&lt;/span&gt;);
  294.  
  295.            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;using&lt;/span&gt; (MemoryStream memoryStream = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; MemoryStream())
  296.            {
  297.                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;using&lt;/span&gt; (&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;var&lt;/span&gt; pdfStamper = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfStamper(reader, memoryStream, &lt;span style=&quot;color: #0044dd;&quot;&gt;&#39;\0&#39;&lt;/span&gt;))
  298.                {
  299.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Getting total number of pages of the Existing Document&lt;/span&gt;
  300.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;int&lt;/span&gt; pageCount = reader.NumberOfPages;
  301.  
  302.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Create two New Layer for Watermark&lt;/span&gt;
  303.                    PdfLayer layer = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfLayer(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;WatermarkLayer&quot;&lt;/span&gt;, pdfStamper.Writer);
  304.                    PdfLayer layer2 = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfLayer(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;WatermarkLayer2&quot;&lt;/span&gt;, pdfStamper.Writer);
  305.  
  306.                    &lt;span style=&quot;color: #888888;&quot;&gt;// Loop through each Page&lt;/span&gt;
  307.  
  308.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; layerwarkmarktxt = &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;water mark&quot;&lt;/span&gt;; &lt;span style=&quot;color: #888888;&quot;&gt;// define text for &lt;/span&gt;
  309.                    &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt; Layer2warkmarktxt = &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Confidential&quot;&lt;/span&gt;;
  310.                    &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;for&lt;/span&gt; (&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;int&lt;/span&gt; i = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;; i &amp;lt;= pageCount; i++)
  311.                    {
  312.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Getting the Page Size&lt;/span&gt;
  313.                        Rectangle rect = reader.GetPageSize(i);
  314.  
  315.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Get the ContentByte object&lt;/span&gt;
  316.                        PdfContentByte cb = pdfStamper.GetUnderContent(i);
  317.  
  318.  
  319.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Tell the cb that the next commands should be &quot;bound&quot; to this new layer&lt;/span&gt;
  320.  
  321.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Start Layer&lt;/span&gt;
  322.  
  323.                        cb.BeginLayer(layer);
  324.  
  325.  
  326.                        PdfGState gState = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfGState();
  327.  
  328.                        gState.FillOpacity = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0.1f&lt;/span&gt;; &lt;span style=&quot;color: #888888;&quot;&gt;// define opacity level&lt;/span&gt;
  329.                        cb.SetGState(gState);
  330.  
  331.                        &lt;span style=&quot;color: #888888;&quot;&gt;// set font size and style for layer water mark text&lt;/span&gt;
  332.                        cb.SetFontAndSize(BaseFont.CreateFont(BaseFont.HELVETICA, BaseFont.CP1252, BaseFont.NOT_EMBEDDED), &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;10&lt;/span&gt;);
  333.  
  334.                        List&amp;lt;&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;&amp;gt; watermarkList = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; List&amp;lt;&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;&amp;gt;();
  335.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; singleWaterMarkWidth = cb.GetEffectiveStringWidth(layerwarkmarktxt, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;false&lt;/span&gt;);
  336.  
  337.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; fontHeight = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;10&lt;/span&gt;;
  338.  
  339.                        &lt;span style=&quot;color: #888888;&quot;&gt;//Work out the Watermark for a Single Line on the Page based on the Page Width&lt;/span&gt;
  340.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; currentWaterMarkWidth = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;;
  341.                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; (currentWaterMarkWidth + singleWaterMarkWidth &amp;lt; rect.Width)
  342.                        {
  343.                            watermarkList.Add(layerwarkmarktxt);
  344.                            currentWaterMarkWidth = cb.GetEffectiveStringWidth(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, watermarkList), &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;false&lt;/span&gt;);
  345.                        }
  346.  
  347.                        &lt;span style=&quot;color: #888888;&quot;&gt;//Fill the Page with Lines of Watermarks&lt;/span&gt;
  348.                        &lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;float&lt;/span&gt; currentYPos = rect.Height;
  349.  
  350.                        &lt;span style=&quot;color: #888888;&quot;&gt;//cb.BeginText();&lt;/span&gt;
  351.                        &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;while&lt;/span&gt; (currentYPos &amp;gt; &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;)
  352.                        {
  353.                            ColumnText.ShowTextAligned(cb, Element.ALIGN_CENTER, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Phrase(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, watermarkList), font), rect.Width / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, currentYPos, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0&lt;/span&gt;, PdfWriter.RUN_DIRECTION_RTL, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;);
  354.                          
  355.                            currentYPos -= fontHeight;
  356.                        }
  357.  
  358.  
  359.                        cb.EndLayer();
  360.  
  361.                        &lt;span style=&quot;color: #888888;&quot;&gt;// End First Layer&lt;/span&gt;
  362.  
  363.                        &lt;span style=&quot;color: #888888;&quot;&gt;//**************************************************************//&lt;/span&gt;
  364.  
  365.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Start Layer 2&lt;/span&gt;
  366.  
  367.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Tell the cb that the next commands should be &quot;bound&quot; to this new layer&lt;/span&gt;
  368.                        cb.BeginLayer(layer2);
  369.                        Font f = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Font(FontFamily.HELVETICA, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;50&lt;/span&gt;);                        
  370.  
  371.                        gState = &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; PdfGState();
  372.                        gState.FillOpacity = &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;0.1f&lt;/span&gt;;
  373.                        cb.SetGState(gState);
  374.  
  375.                        cb.SetColorFill(BaseColor.BLACK);
  376.  
  377.                        &lt;span style=&quot;color: #888888;&quot;&gt;//cb.BeginText();&lt;/span&gt;
  378.                        ColumnText.ShowTextAligned(cb, Element.ALIGN_CENTER, &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; Phrase(&lt;span style=&quot;color: #333399; font-weight: bold;&quot;&gt;string&lt;/span&gt;.Join(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot; &quot;&lt;/span&gt;, Layer2warkmarktxt), f), rect.Width / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, rect.Height / &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;2&lt;/span&gt;, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;45f&lt;/span&gt;, PdfWriter.RUN_DIRECTION_RTL, &lt;span style=&quot;color: #6600ee; font-weight: bold;&quot;&gt;1&lt;/span&gt;);
  379.                        
  380.                        &lt;span style=&quot;color: #888888;&quot;&gt;// Close the layer&lt;/span&gt;
  381.                        cb.EndLayer();
  382.  
  383.                        &lt;span style=&quot;color: #888888;&quot;&gt;// End Layer 2&lt;/span&gt;
  384.                    }
  385.  
  386.  
  387.  
  388.  
  389.                }
  390.  
  391.               &lt;span style=&quot;color: #888888;&quot;&gt;// Save file to destination location if required&lt;/span&gt;
  392.                &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;if&lt;/span&gt; (System.IO.File.Exists(destinationpath))
  393.                {
  394.                    System.IO.File.Delete(destinationpath);
  395.                }
  396.                System.IO.File.WriteAllBytes(destinationpath, memoryStream.ToArray());
  397.            }
  398.  
  399.            &lt;span style=&quot;color: #888888;&quot;&gt;// send file to browse to open it from destination location.&lt;/span&gt;
  400.            &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;return&lt;/span&gt; &lt;span style=&quot;color: #0066bb; font-weight: bold;&quot;&gt;File&lt;/span&gt;(destinationpath, &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;application/pdf&quot;&lt;/span&gt;);
  401.        }
  402. &lt;/pre&gt;
  403. &lt;/div&gt;
  404. &lt;div&gt;
  405. &lt;br /&gt;
  406. &lt;br /&gt;
  407. Now after paste this code we need to call&amp;nbsp;&lt;span style=&quot;background-color: #f6f8ff; color: #000020;&quot;&gt;GetWaterMarkPdf() method from&amp;nbsp;&lt;/span&gt;view&lt;br /&gt;
  408. &lt;br /&gt;
  409. Open the Index View in Home folder delete all the html text and add one action link like shown as below.&lt;br /&gt;
  410. &lt;br /&gt;
  411. &lt;br /&gt;&lt;/div&gt;
  412. &lt;div&gt;
  413. &lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
  414. &lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;background-color: #ffaaaa; color: red;&quot;&gt;@&lt;/span&gt;Html.ActionLink(&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Download water mark pdf&quot;&lt;/span&gt;, &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;GetWaterMarkPdf&quot;&lt;/span&gt;, &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;Home&quot;&lt;/span&gt;,  &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;null&lt;/span&gt;,  &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;new&lt;/span&gt; { target &lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&quot;_blank&quot;&lt;/span&gt; })
  415. &lt;/pre&gt;
  416. &lt;/div&gt;
  417. &lt;/div&gt;
  418. &lt;div&gt;
  419. &lt;br /&gt;
  420. After adding action link in the view run the web applicaiton and you will see the page looks like below.&lt;br /&gt;
  421. &lt;br /&gt;
  422. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  423. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNG_BGmshwQGagEq_nGLSzdrPoSuoIIIIFwtbCNvm2OZFkoGm9lavKojFWaRn0pdeAtv2o0gr1qU_yuPOiqm22WCu9i9hz48rI1De6H3LzOhEuEuJvYhiEjhjNAJJfHBfGZ0YTasoTprA/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;316&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNG_BGmshwQGagEq_nGLSzdrPoSuoIIIIFwtbCNvm2OZFkoGm9lavKojFWaRn0pdeAtv2o0gr1qU_yuPOiqm22WCu9i9hz48rI1De6H3LzOhEuEuJvYhiEjhjNAJJfHBfGZ0YTasoTprA/s640/Capture.PNG&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  424. &lt;br /&gt;
  425. Press the download water mark pdf button and then browser will open the watermark pdf file as shown below.&lt;br /&gt;
  426. &lt;br /&gt;
  427. &lt;br /&gt;
  428. &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
  429. &lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGju4pooXzyyou2BG9wk34MmnoQPbNcvPRxeFTlNSx8xwApHCXEroF9uzUUAcyGw-zRoI74he0nmle-Wno37NvxzNxepQ0OMKCU_1Ut0mSJ6Od3OfF_M6WsUzFLUqct_cjOwc2TWqkD6w/s1600/Capture.PNG&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;640&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjGju4pooXzyyou2BG9wk34MmnoQPbNcvPRxeFTlNSx8xwApHCXEroF9uzUUAcyGw-zRoI74he0nmle-Wno37NvxzNxepQ0OMKCU_1Ut0mSJ6Od3OfF_M6WsUzFLUqct_cjOwc2TWqkD6w/s640/Capture.PNG&quot; width=&quot;606&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
  430. &lt;br /&gt;
  431. You can see in the background watermark text emboss below the text and image as well as &quot;confidential&quot; written in the middle of the page at 45 degree angle.&lt;br /&gt;
  432. &lt;br /&gt;
  433. &lt;br /&gt;
  434. &lt;h2 style=&quot;text-align: left;&quot;&gt;
  435. &lt;b&gt;Download :&amp;nbsp;&lt;a href=&quot;https://drive.google.com/file/d/0BxzDBhhoZIjLcUxCZ2YxWDUtSDQ/view&quot;&gt;Source Code&lt;/a&gt;&lt;/b&gt;&lt;/h2&gt;
  436. &lt;br /&gt;&lt;/div&gt;
  437. &lt;/div&gt;
  438. &lt;/div&gt;
  439. </description><link>http://dotnetfarrukhabbas.blogspot.com/2017/04/full-page-waternark-using-mvc-and.html</link><author>noreply@blogger.com (Anonymous)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi-UXWM0JeojMDZbtKbPhdvCSRh-868Js_zc9a9NP1FThQQu6A0LN82j0GgRSdMqf7JxQ8gdAWpwoN6nS7zdCkVwYG9TIHSj-aHIFaKgo8ftjk1mFDMhFoQASWSfoNOE-hXnXF9IEegTEM/s72-c/Capture.PNG" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1871613019985055057</guid><pubDate>Wed, 12 Jun 2013 10:40:00 +0000</pubDate><atom:updated>2013-07-07T02:11:30.758-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">asp.net C#</category><category domain="http://www.blogger.com/atom/ns#">Custom Pagign</category><category domain="http://www.blogger.com/atom/ns#">Custom Sorting</category><category domain="http://www.blogger.com/atom/ns#">dynamic paging</category><category domain="http://www.blogger.com/atom/ns#">dynamic sorting</category><category domain="http://www.blogger.com/atom/ns#">pager control</category><category domain="http://www.blogger.com/atom/ns#">paging control</category><title>Generic Custom Paging and Sorting Using SQL Server and .Net C#</title><description>&lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:63e0142f-4280-460e-a26c-de8ec9835943&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  440. Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Custom+Sorting&quot; rel=&quot;tag&quot;&gt;&lt;span style=&quot;color: #218abb;&quot;&gt;Custom Sorting&lt;/span&gt;&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Custom+Paging&quot; rel=&quot;tag&quot;&gt;&lt;span style=&quot;color: #218abb;&quot;&gt;Custom Paging&lt;/span&gt;&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Dynamic+Sorting&quot; rel=&quot;tag&quot;&gt;&lt;span style=&quot;color: #218abb;&quot;&gt;Dynamic Sorting&lt;/span&gt;&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Dynamic+Paging&quot; rel=&quot;tag&quot;&gt;&lt;span style=&quot;color: #218abb;&quot;&gt;Dynamic Paging&lt;/span&gt;&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Paging+Control&quot; rel=&quot;tag&quot;&gt;&lt;span style=&quot;color: #218abb;&quot;&gt;Paging Control&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
  441. &lt;br /&gt;
  442. &lt;div class=&quot;MsoNormal&quot; style=&quot;margin: 0cm 0cm 10pt;&quot;&gt;
  443. &lt;span style=&quot;color: #2a2a2a; font-family: &#39;Segoe UI&#39;,&#39;sans-serif&#39;; line-height: 115%;&quot;&gt;Compared to default paging, custom paging can improve the performance of paging through data by several orders of magnitude, through custom paging large amounts of data can reterive more efficiently than implementing default paging, however, especially when adding sorting to the mix. In this tutorial, we&#39;ll extend the example from the preceding one to include support for sorting&lt;span class=&quot;apple-converted-space&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: Calibri;&quot;&gt;&lt;i style=&quot;-webkit-text-stroke-width: 0px; word-spacing: 0px;&quot;&gt;and&lt;/i&gt;&lt;span class=&quot;apple-converted-space&quot;&gt;&lt;span style=&quot;-webkit-text-stroke-width: 0px; float: none; word-spacing: 0px;&quot;&gt;&amp;nbsp;&lt;/span&gt;custom paging.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
  444. &lt;o:p&gt;&lt;/o:p&gt;&lt;br /&gt;
  445. Implementation of Custom paging&amp;nbsp;required following three parts. &lt;br /&gt;
  446. &lt;ul&gt;
  447. &lt;li&gt;Pager Control
  448. &lt;/li&gt;
  449. &lt;li&gt;Stored Procedure
  450. &lt;/li&gt;
  451. &lt;li&gt;Web page &lt;/li&gt;
  452. &lt;/ul&gt;
  453. &lt;strong&gt;Pager Control&lt;/strong&gt; we need user control for add navigation buttons like move next, pervious, first and last button and later on to join with grid or any other control like repeater etc&amp;nbsp;where we need paging functionality. You should&amp;nbsp;perform following step to create user control. 1. Add user control from Open Visual Studio 2008 and choose File &amp;gt; New Item &amp;gt;User Control and rename the name with “Navigator.ascx” 2. Add four button for navigation move next, pervious, last and first record. 3. I use image button and add images through resource files &lt;br /&gt;
  454. &lt;h5&gt;
  455. &amp;nbsp;&lt;/h5&gt;
  456. &lt;h3&gt;
  457. Code&lt;/h3&gt;
  458. &lt;br /&gt;
  459. &lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:9D7513F9-C04C-4721-824A-2B34F0212519:95393605-6a7b-4c6e-bc40-880637d88ded&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  460. &lt;pre style=&quot;background-color: white; font-family: Arial; height: 540px; overflow: scroll; width: 736px;&quot;&gt;&lt;div&gt;
  461. &lt;!--
  462.  
  463. Code highlighting produced by Actipro CodeHighlighter (freeware)
  464. http://www.CodeHighlighter.com/
  465.  
  466. --&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;@ Control Language&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;C#&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; AutoEventWireup&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; Codebehind&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;Navigator.ascx.cs&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;
  467.    Inherits&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;DMS.Controls.Navigator&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;   &lt;/span&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;border&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;0&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;100%&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  468.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:HiddenField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;hdnCurrentPage&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  469.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:HiddenField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;hdnTotalPages&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  470.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:HiddenField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;hdnSelectedValue&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  471.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  472.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  473.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;width: 100%&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  474.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  475.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;align&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;center&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  476.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:ImageButton &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnFirst&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; CausesValidation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;False&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  477.                            AlternateText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;First&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnFirstResource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  478.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:ImageButton &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnPrevious&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; CausesValidation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;False&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  479.                            AlternateText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Previous&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnPreviousResource2&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  480.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label3&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Total Records: &quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  481.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label3Resource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  482.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lbltotalItem&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  483.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lbltotalItemResource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  484.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label4&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;, Page &quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  485.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label4Resource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  486.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblcurrentpage&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;/&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  487.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lblcurrentpageResource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  488.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label6&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot; of &quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  489.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Label6Resource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  490.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lbltotalpages&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  491.                            meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;lbltotalpagesResource1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  492.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:ImageButton &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnNext&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; CausesValidation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;False&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  493.                            AlternateText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Next&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnNextResource2&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;  &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&amp;amp;nbsp;&amp;amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  494.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:ImageButton &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnLast&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; CausesValidation&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;False&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;
  495.                            AlternateText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Last&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; meta:resourcekey&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnLastResource2&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  496.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  497.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  498.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  499.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  500.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
  501. &lt;/pre&gt;
  502. &lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
  503. &lt;style type=&quot;text/css&quot;&gt;
  504.  
  505. .csharpcode, .csharpcode pre
  506. {
  507. font-size: small;
  508. color: black;
  509. font-family: consolas, &quot;Courier New&quot;, courier, monospace;
  510. background-color: #ffffff;
  511. /*white-space: pre;*/
  512. }
  513. .csharpcode pre { margin: 0em; }
  514. .csharpcode .rem { color: #008000; }
  515. .csharpcode .kwrd { color: #0000ff; }
  516. .csharpcode .str { color: #006080; }
  517. .csharpcode .op { color: #0000c0; }
  518. .csharpcode .preproc { color: #cc6633; }
  519. .csharpcode .asp { background-color: #ffff00; }
  520. .csharpcode .html { color: #800000; }
  521. .csharpcode .attr { color: #ff0000; }
  522. .csharpcode .alt
  523. {
  524. background-color: #f4f4f4;
  525. width: 100%;
  526. margin: 0em;
  527. }
  528. .csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;
  529. &lt;h3&gt;
  530. &lt;strong&gt;&lt;span style=&quot;font-size: medium;&quot;&gt;Code Behind&lt;/span&gt;&lt;/strong&gt;&lt;/h3&gt;
  531. &lt;br /&gt;
  532. &lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:9D7513F9-C04C-4721-824A-2B34F0212519:68f988e3-249f-4d64-b78e-86239c12857d&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  533. &lt;pre style=&quot;background-color: white; font-family: Arial; font-size: 12px; height: 540px; overflow: scroll; width: 736px;&quot;&gt;&lt;div&gt;
  534. &lt;!--
  535.  
  536. Code highlighting produced by Actipro CodeHighlighter (freeware)
  537. http://www.CodeHighlighter.com/
  538.  
  539. --&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System;
  540. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Data;
  541. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Configuration;
  542. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Collections;
  543. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web;
  544. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.Security;
  545. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI;
  546. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI.WebControls;
  547. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI.WebControls.WebParts;
  548. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI.HtmlControls;
  549. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Globalization;
  550.  
  551. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Controls
  552. {
  553.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;partial&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Navigator : System.Web.UI.UserControl
  554.    {
  555.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Fields&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  556.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _TotalRecord;
  557.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _PageSize;
  558.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  559.  
  560.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Events&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  561.        &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; Delegates event for button click&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;event&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; DataGridPageChangedEventHandler PageIndexChanged;
  562.      
  563.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  564.  
  565.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Properties&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  566.  
  567.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; PageSize
  568.        {
  569.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _PageSize; }
  570.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { _PageSize &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; value; }
  571.        }
  572.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalRecord
  573.        {
  574.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _TotalRecord; }
  575.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  576.            {
  577.                _TotalRecord &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; value;
  578.                lbltotalItem.Text &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Convert.ToString(_TotalRecord);
  579.            }
  580.        }
  581.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  582.  
  583.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Data&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  584.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Initialize(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; totalRecords, &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; pageSize)
  585.        {
  586.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  587.            {
  588.                TotalRecord &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; totalRecords;
  589.                _PageSize &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; pageSize;
  590.  
  591.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ((_TotalRecord &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _PageSize) &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  592.                    TotalPages &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _TotalRecord &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _PageSize;
  593.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  594.                    TotalPages &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (_TotalRecord &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _PageSize) &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  595.  
  596.                CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  597.  
  598.                EnableLinks();
  599.            }
  600.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  601.            {
  602.              
  603.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  604.            }
  605.        }
  606.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; EnableLinks()
  607.        {
  608.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  609.            {
  610.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  611.                {
  612.  
  613.                    btnFirst.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;FirstImageD&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  614.                    btnFirst.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  615.                    btnPrevious.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;PreviousImageD&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  616.                    btnPrevious.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  617.  
  618.  
  619.                }
  620.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  621.                {
  622.                    btnFirst.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;FirstImageE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  623.                    btnFirst.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  624.                    btnPrevious.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;PreviousImageE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  625.                    btnPrevious.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  626.                }
  627.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalPages)
  628.                {
  629.                    btnNext.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;NextImageD&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  630.                    btnNext.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  631.                    btnLast.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LastImageD&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  632.                    btnLast.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  633.                }
  634.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  635.                {
  636.                    btnNext.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;NextImageE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  637.                    btnNext.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  638.                    btnLast.ImageUrl &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; HttpContext.GetGlobalResourceObject(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Resource&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;LastImageE&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;).ToString();
  639.                    btnLast.Enabled &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  640.  
  641.                }
  642.  
  643.  
  644.            }
  645.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  646.            {
  647.              
  648.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  649.            }
  650.        }
  651.  
  652.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  653.  
  654.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; OnPageIndexChanged(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender)
  655.        {
  656.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  657.            {
  658.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (PageIndexChanged &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  659.                    PageIndexChanged(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; DataGridPageChangedEventArgs(sender, CurrentPage));
  660.                EnableLinks();
  661.            }
  662.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  663.            {
  664.              
  665.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  666.            }
  667.        }
  668.  
  669.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Event Handlers&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  670.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; btnFirst_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, ImageClickEventArgs e)
  671.        {
  672.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  673.            {
  674.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  675.                    CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  676.  
  677.                OnPageIndexChanged(sender);
  678.                &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;EnableLinks();&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;            }
  679.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  680.            {
  681.              
  682.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  683.            }
  684.        }
  685.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; btnPrevious_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, ImageClickEventArgs e)
  686.        {
  687.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  688.            {
  689.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  690.                    CurrentPage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;--&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  691.  
  692.                OnPageIndexChanged(sender);
  693.                &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;EnableLinks();&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;            }
  694.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  695.            {
  696.              
  697.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  698.            }
  699.        }
  700.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; btnNext_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, ImageClickEventArgs e)
  701.        {
  702.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  703.            {
  704.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalPages)
  705.                    CurrentPage&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;++&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  706.  
  707.                OnPageIndexChanged(sender);
  708.            }
  709.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  710.            {
  711.              
  712.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  713.            }
  714.        }
  715.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; btnLast_Click(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, ImageClickEventArgs e)
  716.        {
  717.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  718.            {
  719.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalPages)
  720.                    CurrentPage &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalPages;
  721.  
  722.                OnPageIndexChanged(sender);
  723.            }
  724.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  725.            {
  726.              
  727.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  728.            }
  729.        }
  730.  
  731.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  732.  
  733.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Web Form Designer generated code&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  734.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; OnInit(EventArgs e)
  735.        {
  736.            InitializeComponent();
  737.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.OnInit(e);
  738.            &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;CreateControls();&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        }
  739.  
  740.        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;
  741.        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;      Required method for Designer support - do not modify
  742.        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;      the contents of this method with the code editor.
  743.        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;///&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; InitializeComponent()
  744.        {
  745.            &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;this.Load += new System.EventHandler(this.Page_Load);&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  746.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.btnFirst.Click &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ImageClickEventHandler(btnFirst_Click);
  747.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.btnPrevious.Click &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ImageClickEventHandler(btnPrevious_Click);
  748.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.btnNext.Click &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ImageClickEventHandler(btnNext_Click);
  749.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.btnLast.Click &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ImageClickEventHandler(btnLast_Click);
  750.        }
  751.  
  752.  
  753.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  754.  
  755.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#region&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Hidden Fields&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  756.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; CurrentPage
  757.        {
  758.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.Parse((&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.IsNullOrEmpty(hdnCurrentPage.Value) &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;?&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; hdnCurrentPage.Value : &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)); }
  759.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  760.            {
  761.                hdnCurrentPage.Value &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Convert.ToString(value);
  762.                lblcurrentpage.Text &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Convert.ToString(hdnCurrentPage.Value,CultureInfo.CurrentCulture);
  763.            }
  764.        }
  765.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalPages
  766.        {
  767.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.Parse(hdnTotalPages.Value); }
  768.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  769.            {
  770.                hdnTotalPages.Value &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Convert.ToString(value);
  771.                lbltotalpages.Text &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; hdnTotalPages.Value;
  772.            }
  773.        }
  774.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; SelectedValue
  775.        {
  776.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;get&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;return&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.hdnSelectedValue.Value; }
  777.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;set&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; { &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.hdnSelectedValue.Value &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; value; }
  778.        }
  779.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;#endregion&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  780.    }
  781. }
  782.  
  783. &lt;/span&gt;&lt;/div&gt;
  784. &lt;/pre&gt;
  785. &lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
  786. &lt;br /&gt;
  787. &lt;h3&gt;
  788. &amp;nbsp;&lt;strong&gt;Stored Procedure&lt;/strong&gt;&lt;/h3&gt;
  789. Create the Table&amp;nbsp;name customer add some major fields like customer name ,Customer ID , Phone No etc &amp;nbsp;and insert dummy data then we will create the stored procedure for custom paging and sorting&lt;br /&gt;
  790. &lt;br /&gt;
  791. &lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:9D7513F9-C04C-4721-824A-2B34F0212519:678ec8a2-4fc8-49ad-9da4-e89066f15857&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  792. &lt;pre style=&quot;background-color: white; font-family: Times New Roman; height: 678px; overflow: auto; width: 784px;&quot;&gt;&lt;div&gt;
  793. &lt;!--
  794.  
  795. Code highlighting produced by Actipro CodeHighlighter (freeware)
  796. http://www.CodeHighlighter.com/
  797.  
  798. --&gt;&lt;span style=&quot;color: teal;&quot;&gt;/*&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;***** Object:  StoredProcedure [dbo].[usp_CustomerSearch]    Script Date: 11/24/2011 12:34:19 *****&lt;/span&gt;&lt;span style=&quot;color: teal;&quot;&gt;*/&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ANSI_NULLS &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; QUOTED_IDENTIFIER &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;CREATE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;PROCEDURE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;usp_CustomerSearch&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  799.  
  800.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_ID&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  801.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_Name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  802.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Phone_No&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  803.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Address&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;varchar&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;MAX&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,    
  804.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortDir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;               &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;30&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ASC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  805.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortOrder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;max&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_Name&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ,
  806.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageNumber&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  807.    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageSize&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;         &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BEGIN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  808.        
  809.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; NOCOUNT &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  810.  
  811.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@FirstRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  812.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@LastRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;      &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;INT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  813.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; XACT_ABORT &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ON&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  814.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DECLARE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SQL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NVARCHAR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;4000&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  815.    
  816.    
  817.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@FirstRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageNumber&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageSize&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,
  818.            &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@LastRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageSize&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageNumber&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@PageSize&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  819.    
  820.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IF&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortORder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;IS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;OR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortOrder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  821.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SET&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortOrder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  822.        
  823.    
  824.        
  825.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WITH&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    TempCustomer &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  826.        (
  827.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; , ROW_NUMBER() &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  828.  
  829.            &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortDir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  830.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  831.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  832.                        &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortOrder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  833.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_ID&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;),Customer_ID)
  834.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_Name&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Customer_Name
  835.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Phone_No&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Phone_No
  836.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Address&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Address
  837.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Customer_Name
  838.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    
  839.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ASC&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberAsc,
  840.            ROW_NUMBER() &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;OVER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ORDER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;BY&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  841.            &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortDir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  842.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ASC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;NULL&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  843.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  844.                        &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortOrder&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  845.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_ID&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CONVERT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;VARCHAR&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;50&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;),Customer_ID)
  846.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_Name&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Customer_Name
  847.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Phone_No&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Phone_No
  848.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Address&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Address
  849.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Customer_Name
  850.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    
  851.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberDesc
  852.  
  853.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (        
  854.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_ID&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer_Name&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Phone_No&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;, &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Address&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;dbo&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Customer&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;]&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;   (NOLOCK)
  855.  
  856.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  857.                &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon; font-weight: bold;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  858.                &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;LOWER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(Customer_Name) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;LIKE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_Name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_Name&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)  
  859.                &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;LOWER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(Phone_No) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;LIKE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Phone_No&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Phone_No&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)  
  860.                          &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;LOWER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(Address) &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;LIKE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Address&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;+&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Address&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)  
  861.                        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;LOWER&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(Customer_ID)&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_ID&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;or&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@Customer_ID&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;is&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)  
  862.                
  863.            )  &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TempRow
  864.        )
  865.  
  866.    
  867.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;,(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;COUNT&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;*&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TempCustomer) &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;AS&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TotalRecords
  868.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;FROM&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; TempCustomer
  869.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHERE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;    &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortDir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberDesc &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberAsc &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  870.        &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;BETWEEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@FirstRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;AND&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@LastRow&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  871.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;Order&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;By&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;CASE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;@SortDir&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  872.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;WHEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DESC&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;THEN&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberDesc
  873.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;ELSE&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; RowNumberAsc
  874.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  875.  
  876.    
  877.            
  878.            
  879.            
  880. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;END&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;GO&lt;/span&gt;&lt;/div&gt;
  881. &lt;/pre&gt;
  882. &lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
  883. In Above stored procedure some fields extra taking as input like SortDir,SortOrder,PageNumber and PageSize.&lt;br /&gt;
  884. &lt;h4&gt;
  885. &lt;strong&gt;&lt;u&gt;Fields Details&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;
  886. &lt;strong&gt;SortDir &lt;/strong&gt;: Use for order by direction means “ASC” or “DESC”&lt;br /&gt;
  887. &lt;strong&gt;SortOrder&lt;/strong&gt;: Field name on which you want to sort like “Customer_Name” or “Phone_No” etc&lt;br /&gt;
  888. &lt;strong&gt;PageNumber&lt;/strong&gt;: Current page number e.g ( when user click next then current page number 2 and so on)&lt;br /&gt;
  889. &lt;strong&gt;PageSize &lt;/strong&gt;: Grid page size how many records wants to show in a grid&lt;br /&gt;
  890. &lt;br /&gt;
  891. &lt;h2&gt;
  892. &lt;span style=&quot;font-size: small;&quot;&gt;Aspx Page Code to populate and binding of grid.&lt;/span&gt;&lt;/h2&gt;
  893. Add Grid in a aspx page also add navigator control for created before for paging as shown example given below&lt;br /&gt;
  894. &lt;h4&gt;
  895. HTML Page&lt;/h4&gt;
  896. &lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:9D7513F9-C04C-4721-824A-2B34F0212519:a4312c8f-f61b-454f-878e-a0b16ef2e6f4&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  897. &lt;pre style=&quot;background-color: white; font-family: Arial; height: 400px; overflow: auto; width: 707px;&quot;&gt;&lt;div&gt;
  898. &lt;!--
  899.  
  900. Code highlighting produced by Actipro CodeHighlighter (freeware)
  901. http://www.CodeHighlighter.com/
  902.  
  903. --&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;@ Page Language&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;C#&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; AutoEventWireup&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; CodeBehind&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;Default.aspx.cs&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; Inherits&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;WebApplication1._Default&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;
  904.    EnableEventValidation&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;@ Register Src&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;Navigator.ascx&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; TagName&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;Navigator&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; TagPrefix&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;uc1&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;background-color: whitesmoke; color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;background-color: yellow; color: black;&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: magenta;&quot;&gt;DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;html &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;xmlns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;http://www.w3.org/1999/xhtml&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;head &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  905.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  906.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;form &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;form1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  907.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  908.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;div&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  909.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:GridView &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;GridView1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; AllowSorting&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;true&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  910.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  911.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Customer_ID&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Customer ID&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; SortExpression&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Customer_ID&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  912.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;HeaderStyle &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;10%&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  913.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  914.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Customer_Name&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Contact Person&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; SortExpression&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Customer_Name&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  915.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;HeaderStyle &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;20%&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  916.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  917.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Address&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Address&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; SortExpression&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Address&quot;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  918.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;HeaderStyle &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;20%&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  919.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  920.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;DataField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Phone_No&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; HeaderText&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Phone No&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; SortExpression&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Phone_No&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  921.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;HeaderStyle &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;10%&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  922.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:BoundField&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  923.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;Columns&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  924.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asp:GridView&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  925.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;uc1:Navigator &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Navigator1&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  926.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&lt;/span&gt;&lt;/div&gt;
  927. &lt;/pre&gt;
  928. &lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
  929. &lt;h3&gt;
  930. Code Behind &lt;/h3&gt;
  931. &lt;div class=&quot;wlWriterEditableSmartContent&quot; contenteditable=&quot;false&quot; id=&quot;scid:9D7513F9-C04C-4721-824A-2B34F0212519:5a8f0128-1cc8-4fe5-9561-f5a0a2906421&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  932. &lt;pre style=&quot;background-color: white; font-family: Arial; height: 600px; overflow: auto; width: 707px;&quot;&gt;&lt;div&gt;
  933. &lt;!--
  934.  
  935. Code highlighting produced by Actipro CodeHighlighter (freeware)
  936. http://www.CodeHighlighter.com/
  937.  
  938. --&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System;
  939. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Collections.Generic;
  940. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Linq;
  941. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web;
  942. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI;
  943. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Web.UI.WebControls;
  944. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Data;
  945. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;using&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; System.Globalization;
  946.  
  947. &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;namespace&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; WebApplication1
  948. {
  949.    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;public&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;partial&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;class&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _Default : System.Web.UI.Page
  950.    {
  951.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Page_Load(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, EventArgs e)
  952.        {
  953.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;!&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;IsPostBack)
  954.            {
  955.            }
  956.        }
  957.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;protected&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;override&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; OnInit(EventArgs e)
  958.        {
  959.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;base&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.OnInit(e);
  960.            Initializer();
  961.  
  962.        }
  963.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;private&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Initializer()
  964.        {
  965.            Page.Load &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; EventHandler(Page_Load);
  966.            GridView1.Sorting &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; GridViewSortEventHandler(GridView1_Sorting);
  967.            Navigator1.PageIndexChanged &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;+=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; DataGridPageChangedEventHandler(Navigator1_PageIndexChanged);
  968.  
  969.        }
  970.  
  971.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Navigator1_PageIndexChanged(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; source, DataGridPageChangedEventArgs e)
  972.        {
  973.            DoSearchAndSetData(Convert.ToString(ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortOrder&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]), e.NewPageIndex);
  974.        }
  975.  
  976.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; GridView1_Sorting(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;object&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sender, GridViewSortEventArgs e)
  977.        {
  978.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  979.            {
  980.                ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;desc&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  981.            }
  982.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Convert.ToString(ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]).ToLower() &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;desc&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  983.            {
  984.                ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;asc&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  985.            }
  986.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  987.            {
  988.                ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;desc&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  989.            }
  990.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;[] sort &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; e.SortExpression.Split(&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);
  991.  
  992.            ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortOrder&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;] &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; e.SortExpression;
  993.  
  994.  
  995.  
  996.            DoSearchAndSetData(e.SortExpression, &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;);
  997.        }
  998.        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;void&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; DoSearchAndSetData(&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;string&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sortExperssion, &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; pageNumber)
  999.        {
  1000.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;int&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _pageSize &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;25&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  1001.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;try&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  1002.            {
  1003.  
  1004.  
  1005.                ModelCustomer objModel &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; ModelCustomer();
  1006.                objModel.SortOrder &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; sortExperssion;
  1007.                objModel.SortDir &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; Convert.ToString(ViewState[&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;sortdir&lt;/span&gt;&lt;span style=&quot;color: maroon;&quot;&gt;&quot;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;]);
  1008.  
  1009.                objModel.PageNo &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; pageNumber;
  1010.                objModel.PageSize &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; _pageSize;
  1011.  
  1012.  
  1013.  
  1014.                List&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ModelCustomer&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; colModel &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;new&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; List&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;ModelCustomer&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;();
  1015.                colModel &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; DalCustomer.Search(objModel);
  1016.  
  1017.  
  1018.  
  1019.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (colModel.Count &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; colModel &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;!=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;null&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  1020.                {
  1021.                    Navigator1.Visible &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;true&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  1022.  
  1023.                    &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;if&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (pageNumber &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;==&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;)
  1024.                        &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;this&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;.Navigator1.Initialize(Convert.ToInt32(colModel[&lt;/span&gt;&lt;span style=&quot;color: purple;&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;].TotalRecords, CultureInfo.CurrentCulture), _pageSize);
  1025.                }
  1026.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;else&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;
  1027.                {
  1028.                    Navigator1.Visible &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;false&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  1029.  
  1030.                }
  1031.  
  1032.                GridView1.DataSource &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; colModel;
  1033.                GridView1.DataBind();
  1034.            }
  1035.            &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;catch&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt; (Exception ex)
  1036.            {
  1037.  
  1038.                &lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;throw&lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;;
  1039.  
  1040.            }
  1041.        }
  1042.  
  1043.  
  1044.  
  1045.    }
  1046. }
  1047. &lt;/span&gt;&lt;/div&gt;
  1048. &lt;/pre&gt;
  1049. &lt;!-- Code inserted with Steve Dunn&#39;s Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
  1050. </description><link>http://dotnetfarrukhabbas.blogspot.com/2013/06/generic-custom-paging-and-sorting-using.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-6970891908361187580</guid><pubDate>Sun, 09 Oct 2011 10:01:00 +0000</pubDate><atom:updated>2011-10-09T03:01:53.981-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>Moving,Sorting and Searching Items between two Generic Listbox controls</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;I will explain you how to create user control using two listbox control and moving,filtering and searching items between them.First of all you should add two listbox and add the buttons like given below.&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;%@ Control Language=&lt;span class=&quot;str&quot;&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; AutoEventWireup=&lt;span class=&quot;str&quot;&gt;&amp;quot;true&amp;quot;&lt;/span&gt; CodeFile=&lt;span class=&quot;str&quot;&gt;&amp;quot;ucListBox.ascx.cs&amp;quot;&lt;/span&gt; Inherits=&lt;span class=&quot;str&quot;&gt;&amp;quot;ucListBox&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&amp;lt;%@ Register Assembly=&lt;span class=&quot;str&quot;&gt;&amp;quot;AjaxControlToolkit&amp;quot;&lt;/span&gt; Namespace=&lt;span class=&quot;str&quot;&gt;&amp;quot;AjaxControlToolkit&amp;quot;&lt;/span&gt; TagPrefix=&lt;span class=&quot;str&quot;&gt;&amp;quot;cc1&amp;quot;&lt;/span&gt; %&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script type=&lt;span class=&quot;str&quot;&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt; language=&lt;span class=&quot;str&quot;&gt;&amp;quot;javascript&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;    var ddlText, ddlValue, ddl, lblMesg;&lt;br /&gt;    function CacheItems() {&lt;br /&gt;&lt;br /&gt;        ddlText = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Array();&lt;br /&gt;        ddlValue = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Array();&lt;br /&gt;        ddl = document.getElementById(&lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;lt;%=lstAvailable.ClientID %&amp;gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (var i = 0; i &amp;lt; ddl.options.length; i++) {&lt;br /&gt;            ddlText[ddlText.length] = ddl.options[i].text;&lt;br /&gt;            ddlValue[ddlValue.length] = ddl.options[i].&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    window.onload = CacheItems;&lt;br /&gt;&lt;br /&gt;    function FilterItems(&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) {&lt;br /&gt;    &lt;br /&gt;        ddl.options.length = 0;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (var i = 0; i &amp;lt; ddlText.length; i++) {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (ddlText[i].toLowerCase().indexOf(&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) != -1) {&lt;br /&gt;                AddItem(ddlText[i], ddlValue[i]);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (ddl.options.length == 0) {&lt;br /&gt;            AddItem(&lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;quot;&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    function AddItem(text, &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) {&lt;br /&gt;&lt;br /&gt;        var opt = document.createElement(&lt;span class=&quot;str&quot;&gt;&amp;quot;option&amp;quot;&lt;/span&gt;);&lt;br /&gt;        opt.text = text;&lt;br /&gt;        opt.&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt; = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;;&lt;br /&gt;        ddl = document.getElementById(&lt;span class=&quot;str&quot;&gt;&amp;quot;&amp;lt;%=lstAvailable.ClientID %&amp;gt;&amp;quot;&lt;/span&gt;);&lt;br /&gt;        ddl.options.add(opt);&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;table width=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt; border=&lt;span class=&quot;str&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;    &amp;lt;tr&amp;gt;&lt;br /&gt;        &amp;lt;td style=&lt;span class=&quot;str&quot;&gt;&amp;quot;width: 19%; height: 24px;&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; id=&lt;span class=&quot;str&quot;&gt;&amp;quot;tdd&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;            &amp;lt;span style=&lt;span class=&quot;str&quot;&gt;&amp;quot;font-size: 8pt&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;strong&amp;gt;&lt;br /&gt;                &amp;lt;asp:Label runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; Text=&lt;span class=&quot;str&quot;&gt;&amp;quot;Search&amp;quot;&lt;/span&gt; ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblSearch&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblSearchResource1&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;            &amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;        &amp;lt;/td&amp;gt;&lt;br /&gt;        &amp;lt;td&amp;gt;&lt;br /&gt;            &amp;lt;asp:TextBox ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;txtSearch&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; onkeyup=&lt;span class=&quot;str&quot;&gt;&amp;quot;FilterItems(this.value)&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;txtSearchResource1&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;        &amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;br /&gt;&amp;lt;table width=&lt;span class=&quot;str&quot;&gt;&amp;quot;60%&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;    &amp;lt;tr&amp;gt;&lt;br /&gt;        &amp;lt;td&amp;gt;&lt;br /&gt;        &amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;/tr&amp;gt;&lt;br /&gt;    &amp;lt;tr align=&lt;span class=&quot;str&quot;&gt;&amp;quot;center&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;        &amp;lt;td align=&lt;span class=&quot;str&quot;&gt;&amp;quot;center&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;            &amp;lt;!-- Start  list box--&amp;gt;&lt;br /&gt;            &amp;lt;table width=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                &amp;lt;tr&amp;gt;&lt;br /&gt;                    &amp;lt;td valign=&lt;span class=&quot;str&quot;&gt;&amp;quot;top&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                        &amp;lt;table border=&lt;span class=&quot;str&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; width=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;span style=&lt;span class=&quot;str&quot;&gt;&amp;quot;font-size: 8pt&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;strong&amp;gt;&lt;br /&gt;                                        &amp;lt;asp:Label runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblAvailable&amp;quot;&lt;/span&gt; Text=&lt;span class=&quot;str&quot;&gt;&amp;quot;Available&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblAvailableResource2&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                                    &amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td style=&lt;span class=&quot;str&quot;&gt;&amp;quot;height: 200px&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ListBox ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;lstAvailable&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; Font-Size=&lt;span class=&quot;str&quot;&gt;&amp;quot;8pt&amp;quot;&lt;/span&gt; Height=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt; SelectionMode=&lt;span class=&quot;str&quot;&gt;&amp;quot;Multiple&amp;quot;&lt;/span&gt;&lt;br /&gt;                                        Width=&lt;span class=&quot;str&quot;&gt;&amp;quot;300px&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;lstAvailableResource1&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:ListBox&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                        &amp;lt;/table&amp;gt;&lt;br /&gt;                    &amp;lt;/td&amp;gt;&lt;br /&gt;                    &amp;lt;td align=&lt;span class=&quot;str&quot;&gt;&amp;quot;center&amp;quot;&lt;/span&gt; valign=&lt;span class=&quot;str&quot;&gt;&amp;quot;top&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                        &amp;lt;table border=&lt;span class=&quot;str&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; cellpadding=&lt;span class=&quot;str&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt; cellspacing=&lt;span class=&quot;str&quot;&gt;&amp;quot;0&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;br /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;br /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnAddAll&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/Last.png&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnAdd&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/Next.png&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnRemove&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/Previous.png&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnRemoveAll&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/First.png&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                        &amp;lt;/table&amp;gt;&lt;br /&gt;                    &amp;lt;/td&amp;gt;&lt;br /&gt;                    &amp;lt;td valign=&lt;span class=&quot;str&quot;&gt;&amp;quot;top&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                        &amp;lt;table width=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;span style=&lt;span class=&quot;str&quot;&gt;&amp;quot;font-size: 8pt&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;strong&amp;gt;&lt;br /&gt;                                        &amp;lt;asp:Label runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblAdded&amp;quot;&lt;/span&gt; Text=&lt;span class=&quot;str&quot;&gt;&amp;quot;Added&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;lblAddedResource2&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;                                    &amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td style=&lt;span class=&quot;str&quot;&gt;&amp;quot;height: 200px&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ListBox ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;lstAdded&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; Font-Size=&lt;span class=&quot;str&quot;&gt;&amp;quot;8pt&amp;quot;&lt;/span&gt; Height=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt; SelectionMode=&lt;span class=&quot;str&quot;&gt;&amp;quot;Multiple&amp;quot;&lt;/span&gt;&lt;br /&gt;                                        Width=&lt;span class=&quot;str&quot;&gt;&amp;quot;300px&amp;quot;&lt;/span&gt; meta:resourcekey=&lt;span class=&quot;str&quot;&gt;&amp;quot;lstAddedResource1&amp;quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:ListBox&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                        &amp;lt;/table&amp;gt;&lt;br /&gt;                    &amp;lt;/td&amp;gt;&lt;br /&gt;                    &amp;lt;td&amp;gt;&lt;br /&gt;                        &amp;lt;table width=&lt;span class=&quot;str&quot;&gt;&amp;quot;100%&amp;quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnMoveUp&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/MoveUp.png&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                            &amp;lt;tr&amp;gt;&lt;br /&gt;                                &amp;lt;td&amp;gt;&lt;br /&gt;                                    &amp;lt;asp:ImageButton ID=&lt;span class=&quot;str&quot;&gt;&amp;quot;btnMoveDown&amp;quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&amp;quot;server&amp;quot;&lt;/span&gt; CausesValidation=&lt;span class=&quot;str&quot;&gt;&amp;quot;False&amp;quot;&lt;/span&gt; ImageUrl=&lt;span class=&quot;str&quot;&gt;&amp;quot;~/Images/Movedown.png&amp;quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;                                &amp;lt;/td&amp;gt;&lt;br /&gt;                            &amp;lt;/tr&amp;gt;&lt;br /&gt;                        &amp;lt;/table&amp;gt;&lt;br /&gt;                    &amp;lt;/td&amp;gt;&lt;br /&gt;                &amp;lt;/tr&amp;gt;&lt;br /&gt;            &amp;lt;/table&amp;gt;&lt;br /&gt;            &amp;lt;!-- end  list box--&amp;gt;&lt;br /&gt;        &amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;/table&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type=&quot;text/css&quot;&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;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type=&quot;text/css&quot;&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;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type=&quot;text/css&quot;&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;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now let’s, create a method for Moving the items between two ListBox. Here’s the code block below:&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI.WebControls;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Collections;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;partial&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; ucListBox : System.Web.UI.UserControl&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#region&lt;/span&gt; Property&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; IList _DataSourceAvailable = &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; IList _DataSourceAdded = &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _dataTextFieldAvailable = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _dataValueFieldAvailable = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _dataTextFieldAdded = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _dataValueFieldAdded = &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.Empty;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _availableItemText = &lt;span class=&quot;str&quot;&gt;&amp;quot;Available Items&amp;quot;&lt;/span&gt;;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; _addedItemText =  &lt;span class=&quot;str&quot;&gt;&amp;quot;Added Items&amp;quot;&lt;/span&gt;;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; ArrayList arlList = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ArrayList();&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the available item text.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The available item text.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &lt;/span&gt;&lt;br /&gt;   &lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; AvailableItemText {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _availableItemText; }&lt;br /&gt;        set { _availableItemText = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the added items text.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The added items text.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; AddedItemsText&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _addedItemText; }&lt;br /&gt;        set { _addedItemText = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets the available items.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The available items.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; ListItemCollection AvailableItems&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; lstAvailable.Items; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets the added items.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The added items.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; ListItemCollection AddedItems&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; lstAdded.Items; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data source for the available items listbox.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data source for available items.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; IList DataSourceAvailable&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _DataSourceAvailable; }&lt;br /&gt;        set { _DataSourceAvailable = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data source for the added items listbox.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data source for added items.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; IList DataSourceAdded&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _DataSourceAdded; }&lt;br /&gt;        set { _DataSourceAdded = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data text field available.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data text field available.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; DataTextFieldAvailable&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _dataTextFieldAvailable; }&lt;br /&gt;        set { _dataTextFieldAvailable = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data value field available.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data value field available.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; DataValueFieldAvailable&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _dataValueFieldAvailable; }&lt;br /&gt;        set { _dataValueFieldAvailable = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data text field added.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data text field added.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; DataTextFieldAdded&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _dataTextFieldAdded; }&lt;br /&gt;        set { _dataTextFieldAdded = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Gets or sets the data value field added.&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;value&amp;gt;The data value field added.&amp;lt;/value&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; DataValueFieldAdded&lt;br /&gt;    {&lt;br /&gt;        get { &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; _dataValueFieldAdded; }&lt;br /&gt;        set { _dataValueFieldAdded = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;; }&lt;br /&gt;    }&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#region&lt;/span&gt; Method&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;override&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; OnInit(EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;base&lt;/span&gt;.OnInit(e);&lt;br /&gt;        Initializer();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Initializer()&lt;br /&gt;    {&lt;br /&gt;        btnAdd.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnAdd_Click);&lt;br /&gt;        btnAddAll.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnAddAll_Click);&lt;br /&gt;        btnRemove.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnRemove_Click);&lt;br /&gt;        btnRemoveAll.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnRemoveAll_Click);&lt;br /&gt;        btnMoveUp.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnMoveUp_Click);&lt;br /&gt;        btnMoveDown.Click += &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ImageClickEventHandler(btnMoveDown_Click);&lt;br /&gt;        lblAdded.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AddedItemsText;&lt;br /&gt;        lblAvailable.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AvailableItemText;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; BindAvailableList()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Set the Header Text of the Available and Added Items&lt;/span&gt;&lt;br /&gt;        lblAdded.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AddedItemsText;&lt;br /&gt;        lblAvailable.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AvailableItemText;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Bind the Added List Control&lt;/span&gt;&lt;br /&gt;        lstAvailable.DataSource = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataSourceAvailable;&lt;br /&gt;        lstAvailable.DataTextField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataTextFieldAvailable;&lt;br /&gt;        lstAvailable.DataValueField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataValueFieldAvailable;&lt;br /&gt;        lstAvailable.DataBind();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; BindAddedList()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Set the Header Text of the Available and Added Items&lt;/span&gt;&lt;br /&gt;        lblAdded.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AddedItemsText;&lt;br /&gt;        lblAvailable.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AvailableItemText;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Bind the Available List Control&lt;/span&gt;&lt;br /&gt;        lstAdded.DataSource = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataSourceAdded;&lt;br /&gt;        lstAdded.DataTextField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataTextFieldAdded;&lt;br /&gt;        lstAdded.DataValueField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataValueFieldAdded;&lt;br /&gt;        lstAdded.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; BindList()&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Set the Header Text of the Available and Added Items&lt;/span&gt;&lt;br /&gt;        lblAdded.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AddedItemsText;&lt;br /&gt;        lblAvailable.Text = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.AvailableItemText;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//Bind the Available and Added List Controls&lt;/span&gt;&lt;br /&gt;        lstAdded.DataSource = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataSourceAdded;&lt;br /&gt;        lstAdded.DataTextField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataTextFieldAdded;&lt;br /&gt;        lstAdded.DataValueField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataValueFieldAdded;&lt;br /&gt;        lstAdded.DataBind();&lt;br /&gt;&lt;br /&gt;        lstAvailable.DataSource = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataSourceAvailable;&lt;br /&gt;        lstAvailable.DataTextField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataTextFieldAvailable;&lt;br /&gt;        lstAvailable.DataValueField = &lt;span class=&quot;kwrd&quot;&gt;this&lt;/span&gt;.DataValueFieldAvailable;&lt;br /&gt;        lstAvailable.DataBind();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;preproc&quot;&gt;#region&lt;/span&gt; Remove intersection Record&lt;br /&gt;        ArrayList ary = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ArrayList();&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; lstAvailable.Items.Count; i++)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; j = 0; j &amp;lt; lstAdded.Items.Count; j++)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAvailable.Items[i].Value == lstAdded.Items[j].Value)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;rem&quot;&gt;// lstAvailable.RemoveAt(i);&lt;/span&gt;&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!ary.Contains(lstAvailable.Items[i]))&lt;br /&gt;                    {&lt;br /&gt;                        ary.Add(lstAvailable.Items[i]);&lt;br /&gt;                        j = -1;&lt;br /&gt;                    }&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;break&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; ary.Count; i++)&lt;br /&gt;        {&lt;br /&gt;            lstAvailable.Items.Remove(((ListItem)ary[i]));&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;preproc&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;        ScriptManager.RegisterStartupScript(Page, &lt;span class=&quot;kwrd&quot;&gt;typeof&lt;/span&gt;(Page), &lt;span class=&quot;str&quot;&gt;&amp;quot;myscript&amp;quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&amp;quot;CacheItems();&amp;quot;&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;);&lt;br /&gt;        &lt;span class=&quot;rem&quot;&gt;//ScriptManager.RegisterStartupScript(Page, typeof(Page), &amp;quot;myscript&amp;quot;, &amp;quot;UploadFileToParent();&amp;quot;, true);&lt;/span&gt;&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#region&lt;/span&gt; Navigation&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Add all the selected items from the Available Items to the Added Items&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnAdd_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAvailable.SelectedIndex &amp;gt;= 0)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; lstAvailable.Items.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAvailable.Items[i].Selected)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!arlList.Contains(lstAvailable.Items[i]))&lt;br /&gt;                        arlList.Add(lstAvailable.Items[i]);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; arlList.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!lstAdded.Items.Contains((ListItem)arlList[i]))&lt;br /&gt;                    lstAdded.Items.Add((ListItem)arlList[i]);&lt;br /&gt;                lstAvailable.Items.Remove((ListItem)arlList[i]);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Add all the items from the Available items to the Added Items&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnAddAll_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;foreach&lt;/span&gt; (ListItem list &lt;span class=&quot;kwrd&quot;&gt;in&lt;/span&gt; lstAvailable.Items)&lt;br /&gt;        {&lt;br /&gt;            lstAdded.Items.Add(list);&lt;br /&gt;        }&lt;br /&gt;        lstAvailable.Items.Clear();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Moves the Selected items from the Added items to the Available items&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnRemove_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAdded.SelectedIndex &amp;gt;= 0)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; lstAdded.Items.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAdded.Items[i].Selected)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!arlList.Contains(lstAdded.Items[i]))&lt;br /&gt;                        arlList.Add(lstAdded.Items[i]);&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; arlList.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!lstAvailable.Items.Contains((ListItem)arlList[i]))&lt;br /&gt;                    lstAvailable.Items.Add((ListItem)arlList[i]);&lt;br /&gt;                lstAdded.Items.Remove((ListItem)arlList[i]);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Moves all the items from the Added items to the Available items&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;The source of the event.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;The &amp;lt;see cref=&amp;quot;System.EventArgs&amp;quot;/&amp;gt; instance containing the event data.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnRemoveAll_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;foreach&lt;/span&gt; (ListItem list &lt;span class=&quot;kwrd&quot;&gt;in&lt;/span&gt; lstAdded.Items)&lt;br /&gt;        {&lt;br /&gt;            lstAvailable.Items.Add(list);&lt;br /&gt;        }&lt;br /&gt;        lstAdded.Items.Clear();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Move item to upwards&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnMoveDown_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, ImageClickEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; startindex = lstAdded.Items.Count - 1;&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = startindex; i &amp;gt; -1; i--)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAdded.Items[i].Selected)&lt;span class=&quot;rem&quot;&gt;//identify the selected item&lt;/span&gt;&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;rem&quot;&gt;//swap with the lower item(move down)&lt;/span&gt;&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (i &amp;lt; startindex &amp;amp;&amp;amp; !lstAdded.Items[i + 1].Selected)&lt;br /&gt;                    {&lt;br /&gt;                        ListItem bottom = lstAdded.Items[i];&lt;br /&gt;                        lstAdded.Items.Remove(bottom);&lt;br /&gt;                        lstAdded.Items.Insert(i + 1, bottom);&lt;br /&gt;                        lstAdded.Items[i + 1].Selected = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// Move Item To down Words&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;sender&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;/// &amp;lt;param name=&amp;quot;e&amp;quot;&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnMoveUp_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, ImageClickEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; lstAdded.Items.Count; i++)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (lstAdded.Items[i].Selected)&lt;span class=&quot;rem&quot;&gt;//identify the selected item&lt;/span&gt;&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;rem&quot;&gt;//swap with the top item(move up)&lt;/span&gt;&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (i &amp;gt; 0 &amp;amp;&amp;amp; !lstAdded.Items[i - 1].Selected)&lt;br /&gt;                    {&lt;br /&gt;                        ListItem bottom = lstAdded.Items[i];&lt;br /&gt;                        lstAdded.Items.Remove(bottom);&lt;br /&gt;                        lstAdded.Items.Insert(i - 1, bottom);&lt;br /&gt;                        lstAdded.Items[i - 1].Selected = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;preproc&quot;&gt;#endregion&lt;/span&gt;&lt;br /&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/10/movingsorting-and-searching-items.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>4</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-7065282228075258918</guid><pubDate>Sun, 28 Aug 2011 09:39:00 +0000</pubDate><atom:updated>2011-08-28T02:53:26.090-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><title>FileUpload Control File Type and File Size Validations</title><description>&lt;div&gt;&lt;/div&gt;  &lt;div&gt;   &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:65999b12-bc37-4c7f-a882-df4cb883ec08&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/FileUpload+Control+validation+on+file+type&quot; rel=&quot;tag&quot;&gt;FileUpload Control validation on file type&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/file+size&quot; rel=&quot;tag&quot;&gt;file size&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/increace+file+upload+control+limit&quot; rel=&quot;tag&quot;&gt;increace file upload control limit&lt;/a&gt;&lt;/div&gt; &lt;/div&gt;  &lt;div&gt;&lt;/div&gt;  &lt;div align=&quot;justify&quot;&gt;Normally we need validation to restrict the user for uploading any kind of files on a Web Server due to security or application requirement also we need to limit the file size to upload on web server.There are many ways to implement validation on file upload control its depend upon application requirement which method you can used .Here I will explain only three validation method you can implement on file upload controls.&lt;/div&gt;  &lt;div align=&quot;justify&quot;&gt;&amp;#160;&lt;/div&gt;  &lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;  &lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;  &lt;div align=&quot;justify&quot;&gt;&lt;/div&gt;  &lt;h1&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjFOYHyU3gL2l0yKX0_dBptP_-7Sp4nTmN6ayAEcrvSboWNBTXtUnhKT3eNBlN1PsHf7QPjweSJN8vezEkWHMCG2wJCtaMiBHZ3wUn0gNNCrDn7hFbLS5wkO1P6y7APG0oTdppcI4LEnuHj/s1600-h/Upload-Control4.png&quot;&gt;&lt;img style=&quot;background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px&quot; title=&quot;Upload Control&quot; border=&quot;0&quot; alt=&quot;Upload Control&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfUlSwYadJcN3m_D6AG6FLMzrwd0tvIXDZO4Untzxx-cebSk4pAbo9PKwAbAXRT7yUN2fxPnlkECM_IpyA9EBjlBJlvjatSfXjHEtaqofm32L20IoV6DUH8ThtYjxdI-TAO6wqi8ehQVtc//?imgmax=800&quot; width=&quot;479&quot; height=&quot;331&quot; /&gt;&lt;/a&gt;&lt;/h1&gt;  &lt;p&gt;&lt;strong&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;Validation using Custom Vali&lt;/span&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;dator on Client Side&lt;/span&gt;&lt;/strong&gt;     &lt;br /&gt;    &lt;br /&gt;&lt;strong&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;&lt;/span&gt;&lt;/strong&gt;You can used custom validator to implement fileupload validation on client side.This validation is faster and easy to implement.     &lt;br /&gt;&lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;asp&quot;&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;Default2.aspx.cs&amp;quot; Inherits=&amp;quot;Default2&amp;quot; %&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;PUBLIC&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;html&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;xmlns&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;head&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Untitled Page&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;title&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;head&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;form&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;form1&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;script&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;language&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;javascript&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;function&lt;/span&gt; ValidateAttachment(Source, args)&lt;br /&gt;        {&lt;br /&gt;          &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; UploadControl = document.getElementById(&lt;span class=&quot;str&quot;&gt;&#39;&amp;lt;%= UploadControl.ClientID %&amp;gt;&#39;&lt;/span&gt;); &lt;br /&gt;          &lt;br /&gt;          &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; FilePath = UploadControl.value;&lt;br /&gt;         &lt;br /&gt;          &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt;(FilePath ==&lt;span class=&quot;str&quot;&gt;&#39;&#39;&lt;/span&gt;) &lt;br /&gt;          {            &lt;br /&gt;            args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;span class=&quot;rem&quot;&gt;//No file found&lt;/span&gt;&lt;br /&gt;          }&lt;br /&gt;          &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;          {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; Extension = FilePath.substring(FilePath.lastIndexOf(&lt;span class=&quot;str&quot;&gt;&#39;.&#39;&lt;/span&gt;) + 1).toLowerCase();&lt;br /&gt;         &lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (Extension == &lt;span class=&quot;str&quot;&gt;&amp;quot;doc&amp;quot;&lt;/span&gt; || Extension == &lt;span class=&quot;str&quot;&gt;&amp;quot;txt&amp;quot;&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;              args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;; &lt;span class=&quot;rem&quot;&gt;// Valid file type&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;              args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;; &lt;span class=&quot;rem&quot;&gt;// Not valid file type&lt;/span&gt;&lt;br /&gt;            }&lt;br /&gt;           }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;script&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:FileUpload&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;UploadControl&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;attr&quot;&gt;&amp;amp;nbsp;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Button&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;btnUpload&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;Upload&amp;quot;&lt;/span&gt; &lt;br /&gt;            &lt;span class=&quot;attr&quot;&gt;onclick&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;btnUpload_Click&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;style&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;height: 26px&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;br&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:CustomValidator&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;CustomValidator1&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ClientValidationFunction&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;ValidateAttachment&amp;quot;&lt;/span&gt;&lt;br /&gt;            &lt;span class=&quot;attr&quot;&gt;ErrorMessage&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;Please select valid .doc or .txt file&amp;quot;&lt;/span&gt; &lt;br /&gt;            &lt;span class=&quot;attr&quot;&gt;onservervalidate&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;CustomValidator1_ServerValidate&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:CustomValidator&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Label&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;StatusLabel&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;Upload status: &amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;br /&gt;       &lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;div&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;strong&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;Validation using Custom Vali&lt;/span&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;dator on Server Side&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/strong&gt;You can also apply validation on server using custom validator its slower than client side but its more secure than client side. &lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt; &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; CustomValidator1_ServerValidate(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; source, ServerValidateEventArgs args)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; UploadFileName = UploadControl.PostedFile.FileName;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(UploadFileName))&lt;br /&gt;        {&lt;br /&gt;            args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;        }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; Extension = UploadFileName.Substring(UploadFileName.LastIndexOf(&lt;span class=&quot;str&quot;&gt;&#39;.&#39;&lt;/span&gt;) + 1).ToLower();&lt;br /&gt;&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (Extension == &lt;span class=&quot;str&quot;&gt;&amp;quot;doc&amp;quot;&lt;/span&gt; || Extension == &lt;span class=&quot;str&quot;&gt;&amp;quot;txt&amp;quot;&lt;/span&gt;)&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (UploadControl.PostedFile.ContentLength &amp;lt; 102400)&lt;br /&gt;                {&lt;br /&gt;                    args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;                }&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;                {&lt;br /&gt;                    args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br /&gt;                    CustomValidator1.ErrorMessage = &lt;span class=&quot;str&quot;&gt;&amp;quot;File size should be less than 100 kb&amp;quot;&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                args.IsValid = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;; &lt;span class=&quot;rem&quot;&gt;// Not valid file type&lt;/span&gt;&lt;br /&gt;                CustomValidator1.ErrorMessage = &lt;span class=&quot;str&quot;&gt;&amp;quot;File Type should be .doc or .txt&amp;quot;&lt;/span&gt;;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;By default, the maximum size of a file to be uploaded to the server using the &lt;strong&gt;FileUpload&lt;/strong&gt; control is around 4MB. You cannot upload anything that is larger than this limit. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Change File Upload Limit&lt;/h3&gt;&lt;br /&gt;In the web.config file, find a node called &lt;strong&gt;&amp;lt;httpRuntime&amp;gt;&lt;/strong&gt; that looks like the following: &lt;br /&gt;&lt;br /&gt;&lt;pre style=&quot;width: 100%; height: 298px&quot; class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;httpRuntime&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;executionTimeout&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;110&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;maxRequestLength&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;4096&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;requestLengthDiskThreshold&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;80&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;useFullyQualifiedRedirectUrl&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;minFreeThreads&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;8&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;minLocalRequestFreeThreads&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;4&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;appRequestQueueLimit&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;5000&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;enableKernelOutputCache&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;enableVersionHeader&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;requireRootedSaveAsPath&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;enable&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;shutdownTimeout&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;90&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;delayNotificationTimeout&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;5&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;waitChangeNotification&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;maxWaitChangeNotification&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;0&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;enableHeaderChecking&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;sendCacheControlHeader&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;attr&quot;&gt;apartmentThreading&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;false&amp;quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;lot is going on in this single node, but the setting that takes care of the size of the files to be uploaded is the &lt;strong&gt;maxRequestLength&lt;/strong&gt; attribute. By default, this is set to &lt;strong&gt;4096&lt;/strong&gt; kilobytes (KB). Simply change this value to increase the size of the files that you can upload to the server. If you want to allow 10 megabyte (MB) files to be uploaded to the server, set the &lt;strong&gt;maxRequestLength&lt;/strong&gt; value to &lt;strong&gt;11264&lt;/strong&gt;, meaning that the application allows files that are up to 11000 KB to be uploaded to the server. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;for futher detail check this &lt;a href=&quot;http://msdn.microsoft.com/en-us/library/aa479405.aspx&quot;&gt;Working Around File Size Limitations&lt;/a&gt;. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;strong&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;Direct Vali&lt;/span&gt;&lt;span style=&quot;font-family: times new roman; font-size: large&quot;&gt;dation on Upload Button&lt;/span&gt; &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;In this method you don’t need to used custom validator you can directly write the code on button click and manually show message using label control.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt; &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnUpload_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (UploadControl.HasFile)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;&lt;br /&gt;            {&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (UploadControl.PostedFile.ContentType == &lt;span class=&quot;str&quot;&gt;&amp;quot;image/jpeg&amp;quot;&lt;/span&gt;)&lt;br /&gt;                {&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (UploadControl.PostedFile.ContentLength &amp;lt; 102400)&lt;br /&gt;                    {&lt;br /&gt;                        &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; filename = Path.GetFileName(UploadControl.FileName);&lt;br /&gt;                        UploadControl.SaveAs(Server.MapPath(&lt;span class=&quot;str&quot;&gt;&amp;quot;~/&amp;quot;&lt;/span&gt;) + filename);&lt;br /&gt;                        StatusLabel.Text = &lt;span class=&quot;str&quot;&gt;&amp;quot;Upload status: File uploaded!&amp;quot;&lt;/span&gt;;&lt;br /&gt;                    }&lt;br /&gt;                    &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;                        StatusLabel.Text = &lt;span class=&quot;str&quot;&gt;&amp;quot;Upload status: The file has to be less than 100 kb!&amp;quot;&lt;/span&gt;;&lt;br /&gt;                }&lt;br /&gt;                &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br /&gt;                    StatusLabel.Text = &lt;span class=&quot;str&quot;&gt;&amp;quot;Upload status: Only .doc or .txt files are accepted!&amp;quot;&lt;/span&gt;;&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                StatusLabel.Text = &lt;span class=&quot;str&quot;&gt;&amp;quot;Upload status: The file could not be uploaded. The following error occured: &amp;quot;&lt;/span&gt; + ex.Message;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/08/fileupload-control-file-type-and-file.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfUlSwYadJcN3m_D6AG6FLMzrwd0tvIXDZO4Untzxx-cebSk4pAbo9PKwAbAXRT7yUN2fxPnlkECM_IpyA9EBjlBJlvjatSfXjHEtaqofm32L20IoV6DUH8ThtYjxdI-TAO6wqi8ehQVtc/s72-c/?imgmax=800" height="72" width="72"/><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-7554123405915445528</guid><pubDate>Wed, 17 Aug 2011 10:29:00 +0000</pubDate><atom:updated>2011-08-19T02:45:19.396-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><title>Dynamic Load or Add User Control and Maintain the View State</title><description>&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:34df3856-cb83-484d-a7d5-a4b11f3b63ce&quot; style=&quot;display: inline; float: none; margin: 0px; padding: 0px;&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/dynamic+add+user+control&quot; rel=&quot;tag&quot;&gt;dynamic add user control&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/dynamic+load+user+control&quot; rel=&quot;tag&quot;&gt;dynamic load user control&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Dynamic+Web+Controls&quot; rel=&quot;tag&quot;&gt;Dynamic Web Controls&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Postbacks&quot; rel=&quot;tag&quot;&gt;Postbacks&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/and+View+State&quot; rel=&quot;tag&quot;&gt;and View State&lt;/a&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In this post I will explain you how to add or load user control in a page or any other user control and maintain the view state.Normally we are facing problem when we load user control on button click or any business condition in this case when page will post back control will lost its view state or in other words losing form field values on post back.This is happen because we are adding user control after page Load View State Stage for further detail you should learn asp.net page lifecycle.That means, if we want our dynamic controls to persist view state itself we must add them to the control hierarchy in the page&#39;s &lt;span style=&quot;font-family: Arial;&quot;&gt;&lt;code&gt;Init&lt;/code&gt; event.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
  1051. &lt;br /&gt;
  1052. Here, I will explain the example when we want to add user control on any event.I have two user controls one is Grid view and second I will take login control and load on it into two submit buttons.&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;Adding Reference or Directive on a Webpage&lt;/strong&gt;&lt;/div&gt;&lt;div align=&quot;justify&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&amp;nbsp;&lt;/div&gt;&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;The first thing we have to do, is declare our UserControls. It can be done either in each page where it&#39;s used, or globally in the web.config file. There is no performance difference, but when declaring UserControls in the web.config file, the controls have to reside in a different directory than the page(s) using it for further detail check my pervious post &lt;a href=&quot;http://dotnetfarrukhabbas.blogspot.com/2011/05/register-custom-user-control-in.html&quot;&gt;Register Custom User Control in Web.Config File&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
  1053. &lt;span style=&quot;font-size: small;&quot;&gt;So in the webform, add the following directive:&lt;/span&gt;&lt;br /&gt;
  1054. &lt;br /&gt;
  1055. &lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;background: rgb(255, 238, 98);&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;@ &lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Register &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Controls/GridView.ascx&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;tagname&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;GridView&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;tagprefix&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;uc1&quot; &lt;/span&gt;&lt;span style=&quot;background: rgb(255, 238, 98);&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
  1056. &lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;background: rgb(255, 238, 98);&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;@ &lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Register &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Controls/LoginControl.ascx&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;tagname&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;LoginControl&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;tagprefix&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;uc2&quot; &lt;/span&gt;&lt;span style=&quot;background: rgb(255, 238, 98);&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
  1057. &lt;h4&gt;Loading dynamically&lt;/h4&gt;&lt;span style=&quot;font-size: small;&quot;&gt;For loading user control on a page you should need to drag and drop the place holder where you want to show user control.&lt;/span&gt;&lt;br /&gt;
  1058. &lt;br /&gt;
  1059. &lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;PlaceHolder &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;PlaceHolder1&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;PlaceHolder&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;
  1060. Also add the two buttons to add user control on button click .&lt;br /&gt;
  1061. &lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Button &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnGrindControl&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Button&quot; /&amp;gt;
  1062. &amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;asp&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;color: #a31515;&quot;&gt;Button &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;btnLoginControl&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;server&quot; &lt;/span&gt;&lt;span style=&quot;color: red;&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: blue;&quot;&gt;=&quot;Button&quot; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;span style=&quot;font-size: small;&quot;&gt;your aspx page look like this,&lt;/span&gt;&lt;br /&gt;
  1063. &lt;br /&gt;
  1064. &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;asp&quot;&gt;&amp;lt;%@ Page Title=&quot;&quot; Language=&quot;C#&quot; MasterPageFile=&quot;~/MasterPage.master&quot; AutoEventWireup=&quot;true&quot;
  1065. CodeFile=&quot;Default.aspx.cs&quot; Inherits=&quot;_Default&quot; %&amp;gt;&lt;/span&gt;
  1066.  
  1067. &lt;span class=&quot;asp&quot;&gt;&amp;lt;%@ Register Src=&quot;Controls/GridView.ascx&quot; TagName=&quot;GridView&quot; TagPrefix=&quot;uc1&quot; %&amp;gt;&lt;/span&gt;
  1068. &lt;span class=&quot;asp&quot;&gt;&amp;lt;%@ Register Src=&quot;Controls/LoginControl.ascx&quot; TagName=&quot;LoginControl&quot; TagPrefix=&quot;uc2&quot; %&amp;gt;&lt;/span&gt;
  1069. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Content&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Content1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;head&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Server&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  1070. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Content&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  1071. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Content&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Content2&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ContentPlaceHolderID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;ContentPlaceHolder1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Server&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  1072.  
  1073. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Button&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;btnGrindControl&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Button&quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;
  1074. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Button&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;btnLoginControl&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;Button&quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt;
  1075. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:PlaceHolder&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;PlaceHolder1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:PlaceHolder&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  1076.  
  1077. &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Content&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;
  1078. &lt;/pre&gt;&lt;br /&gt;
  1079. &lt;style type=&quot;text/css&quot;&gt;
  1080. .csharpcode, .csharpcode pre
  1081. {
  1082. font-size: small;
  1083. color: black;
  1084. font-family: consolas, &quot;Courier New&quot;, courier, monospace;
  1085. background-color: #ffffff;
  1086. /*white-space: pre;*/
  1087. }
  1088. .csharpcode pre { margin: 0em; }
  1089. .csharpcode .rem { color: #008000; }
  1090. .csharpcode .kwrd { color: #0000ff; }
  1091. .csharpcode .str { color: #006080; }
  1092. .csharpcode .op { color: #0000c0; }
  1093. .csharpcode .preproc { color: #cc6633; }
  1094. .csharpcode .asp { background-color: #ffff00; }
  1095. .csharpcode .html { color: #800000; }
  1096. .csharpcode .attr { color: #ff0000; }
  1097. .csharpcode .alt
  1098. {
  1099. background-color: #f4f4f4;
  1100. width: 100%;
  1101. margin: 0em;
  1102. }
  1103. .csharpcode .lnum { color: #606060; }
  1104. &lt;/style&gt;&lt;br /&gt;
  1105. &lt;br /&gt;
  1106. &lt;h4&gt;Code Behind&lt;/h4&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In the Code Behind of the page, we add the control like this:&lt;/span&gt; &lt;br /&gt;
  1107. &lt;pre class=&quot;code&quot;&gt;PlaceHolder1.Controls.Add(LoadControl(&lt;span style=&quot;color: #a31515;&quot;&gt;&quot;~/UserControl.ascx&quot;&lt;/span&gt;));&lt;/pre&gt;&lt;br /&gt;
  1108. &lt;br /&gt;
  1109. &lt;span style=&quot;font-size: small;&quot;&gt;In order to maintain the Viewstate of user control you should maintain the UserControl complete path and used this path every time on postback and load the control.&lt;/span&gt;&lt;br /&gt;
  1110. &lt;br /&gt;
  1111. &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System;
  1112. &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Collections.Generic;
  1113. &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web;
  1114. &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI;
  1115. &lt;span class=&quot;kwrd&quot;&gt;using&lt;/span&gt; System.Web.UI.WebControls;
  1116.  
  1117. &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;partial&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; _Default : System.Web.UI.Page
  1118. {
  1119. &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; ControlPath
  1120. {
  1121. get
  1122. {
  1123. &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (ViewState[&lt;span class=&quot;str&quot;&gt;&quot;controlPath&quot;&lt;/span&gt;] != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;)
  1124. &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; Convert.ToString(ViewState[&lt;span class=&quot;str&quot;&gt;&quot;controlPath&quot;&lt;/span&gt;]);
  1125. &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;
  1126. &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;
  1127. }
  1128.  
  1129. set
  1130. {
  1131. ViewState[&lt;span class=&quot;str&quot;&gt;&quot;controlPath&quot;&lt;/span&gt;] = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;;
  1132. }
  1133. }
  1134. &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
  1135. {
  1136. LoadUserControl();
  1137.  
  1138. }
  1139. &lt;span class=&quot;kwrd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; LoadUserControl()
  1140. {
  1141. &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt;.IsNullOrEmpty(ControlPath))
  1142. {
  1143. PlaceHolder1.Controls.Clear();
  1144. UserControl uc = (UserControl)LoadControl(ControlPath);
  1145. PlaceHolder1.Controls.Add(uc);
  1146. }
  1147. }
  1148.  
  1149.  
  1150.  
  1151. &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnGrindControl_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
  1152. {
  1153. ControlPath = &lt;span class=&quot;str&quot;&gt;&quot;Controls/GridView.ascx&quot;&lt;/span&gt;;
  1154. LoadUserControl();
  1155. }
  1156. &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnLoginControl_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)
  1157. {
  1158. ControlPath = &lt;span class=&quot;str&quot;&gt;&quot;Controls/LoginControl.ascx&quot;&lt;/span&gt;;
  1159. LoadUserControl();
  1160. }
  1161. }&lt;/pre&gt;&lt;style type=&quot;text/css&quot;&gt;
  1162. .csharpcode, .csharpcode pre
  1163. {
  1164. font-size: small;
  1165. color: black;
  1166. font-family: consolas, &quot;Courier New&quot;, courier, monospace;
  1167. background-color: #ffffff;
  1168. /*white-space: pre;*/
  1169. }
  1170. .csharpcode pre { margin: 0em; }
  1171. .csharpcode .rem { color: #008000; }
  1172. .csharpcode .kwrd { color: #0000ff; }
  1173. .csharpcode .str { color: #006080; }
  1174. .csharpcode .op { color: #0000c0; }
  1175. .csharpcode .preproc { color: #cc6633; }
  1176. .csharpcode .asp { background-color: #ffff00; }
  1177. .csharpcode .html { color: #800000; }
  1178. .csharpcode .attr { color: #ff0000; }
  1179. .csharpcode .alt
  1180. {
  1181. background-color: #f4f4f4;
  1182. width: 100%;
  1183. margin: 0em;
  1184. }
  1185. .csharpcode .lnum { color: #606060; }
  1186. &lt;/style&gt;&lt;br /&gt;
  1187. &lt;br /&gt;
  1188. &lt;div align=&quot;justify&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In above example I create one property name “&lt;strong&gt;ControlPath” &lt;/strong&gt;for maintaining the Url of user control on button click .In &lt;strong&gt;LoadUserContol() &lt;/strong&gt;I am just clearing the placeholder and adding the user control.In postback user control&amp;nbsp;is adding&amp;nbsp;everytime beacuse&amp;nbsp; user control&amp;nbsp;was added&amp;nbsp;after the page load and view state&amp;nbsp;stage .There are few good articles written by &lt;/span&gt;&lt;a href=&quot;http://www.scottonwriting.net/sowBlog/&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Scott Mitchell&lt;/span&gt;&lt;/a&gt;&lt;span style=&quot;font-size: small;&quot;&gt; on dynamically loading Controls which you will find in the following links:&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;
  1189. &lt;ul&gt;&lt;li&gt;&lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/081402-1.aspx&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Dynamic Controls in ASP.NET&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  1190. &lt;li&gt;&lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/082102-1.aspx&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Working with Dynamically Created Controls&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  1191. &lt;li&gt;&lt;a href=&quot;http://aspnet.4guysfromrolla.com/articles/092904-1.aspx&quot;&gt;&lt;span style=&quot;font-size: small;&quot;&gt;Dynamic Web Controls, Postbacks, and View State&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
  1192. &lt;/ul&gt;&lt;br /&gt;
  1193. &lt;h4&gt;Conclusion&lt;/h4&gt;&lt;span style=&quot;font-size: small;&quot;&gt;In this article we saw how to work with dynamic controls so that their values and view state can be correctly persisted across postbacks.&lt;/span&gt;</description><link>http://dotnetfarrukhabbas.blogspot.com/2011/08/dynamic-load-or-add-user-control-and.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1167776920174633627</guid><pubDate>Wed, 03 Aug 2011 07:07:00 +0000</pubDate><atom:updated>2011-08-03T00:41:02.187-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><title>Debugging Asp.net application using XML Serialization</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;   &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:880c4479-a5dc-4ce1-b810-6935c69f7b92&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/XML+Serialization&quot; rel=&quot;tag&quot;&gt;XML Serialization&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Debugging+through+XML+Serialization.&quot; rel=&quot;tag&quot;&gt;Debugging through XML Serialization.&lt;/a&gt;&lt;/div&gt; &lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;Debugging on Test or Production server is very difficult task for developers.First of all developers do not have any rights to touch the Test or Production environment and he received the list of bugs mainly due to data problem on production or Test Server.When developers try to reproduce the bugs on development environment is not possible because data development environment is accurate.So I have found out the solution of this problem through XML Serialization techniques which describe as below:-&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;In this article I am taking a example of simple Employee Detail.I will explain how we can debug using XML Serialize data.&lt;/p&gt;  &lt;h1&gt;Example&lt;/h1&gt;  &lt;p&gt;First I have declare a Employee class and create one method for creating employee details. &lt;/p&gt;  &lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; Employee&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; EmployeeName { get; set; }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; Address { get; set; }&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; MobilNo { get; set; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; List&amp;lt;Employee&amp;gt; GetEmployees()&lt;br /&gt;        {&lt;br /&gt;            List&amp;lt;Employee&amp;gt; Emplst = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; List&amp;lt;Employee&amp;gt;();&lt;br /&gt;&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)&lt;br /&gt;            {&lt;br /&gt;                Employee emp = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Employee();&lt;br /&gt;                emp.EmployeeName = &lt;span class=&quot;str&quot;&gt;&amp;quot;Employee&amp;quot;&lt;/span&gt; + &lt;span class=&quot;str&quot;&gt;&amp;quot;-&amp;quot;&lt;/span&gt; + i.ToString();&lt;br /&gt;                emp.Address = &lt;span class=&quot;str&quot;&gt;&amp;quot;Address&amp;quot;&lt;/span&gt; + &lt;span class=&quot;str&quot;&gt;&amp;quot;-&amp;quot;&lt;/span&gt; + i.ToString(); &lt;br /&gt;                emp.MobilNo = 9899 + (i + 2);&lt;br /&gt;                Emplst.Add(emp);&lt;br /&gt;            }&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; Emplst;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Now create one page and call the GetEmployee() Method and fill the grid.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt; &lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;partial&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;class&lt;/span&gt; _Default : System.Web.UI.Page&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            Employee objEmp= &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Employee();&lt;br /&gt;&lt;br /&gt;            GridView1.DataSource = objEmp.GetEmployees();&lt;br /&gt;            GridView1.DataBind();&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1 align=&quot;justify&quot;&gt;Scenario 1&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;It is very simple code to populate grid from GetEmployees() method but you assume that data is coming from the database and populating the grid and at this time you are facing problem .Now you can track or debug the application with XML Serialization.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;protected void &lt;/span&gt;Page_Load(&lt;span style=&quot;color: blue&quot;&gt;object &lt;/span&gt;sender, &lt;span style=&quot;color: #2b91af&quot;&gt;EventArgs &lt;/span&gt;e)&lt;br /&gt;       {&lt;br /&gt;           &lt;span style=&quot;color: #2b91af&quot;&gt;Employee &lt;/span&gt;objEmp = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;Employee&lt;/span&gt;();&lt;br /&gt;&lt;br /&gt;           SaveXMLData(objEmp.GetEmployees(), &lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;Employee.XML&amp;quot;&lt;/span&gt;);&lt;br /&gt;           GridView1.DataSource = ReadXMLData&amp;lt;&lt;span style=&quot;color: #2b91af&quot;&gt;Employee&lt;/span&gt;&amp;gt;(&lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;Employee.XML&amp;quot;&lt;/span&gt;);&lt;br /&gt;           GridView1.DataBind();&lt;br /&gt;       }&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;       &lt;span style=&quot;color: blue&quot;&gt;#region &lt;/span&gt;For Serialization Code&lt;br /&gt;&lt;br /&gt;       &lt;span style=&quot;color: blue&quot;&gt;public void &lt;/span&gt;SaveXMLData&amp;lt;T&amp;gt;(&lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt; list, &lt;span style=&quot;color: blue&quot;&gt;string &lt;/span&gt;fileName)&lt;br /&gt;       {&lt;br /&gt;           &lt;span style=&quot;color: #2b91af&quot;&gt;XmlSerializer &lt;/span&gt;serializer = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;XmlSerializer&lt;/span&gt;(&lt;span style=&quot;color: blue&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt;));&lt;br /&gt;           {&lt;br /&gt;               &lt;span style=&quot;color: #2b91af&quot;&gt;TextWriter &lt;/span&gt;writer = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;StreamWriter&lt;/span&gt;(Server.MapPath(&lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;~\\XMLFiles&amp;quot;&lt;/span&gt;) + &lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;\\&amp;quot; &lt;/span&gt;+ fileName);&lt;br /&gt;               serializer.Serialize(writer, list);&lt;br /&gt;               writer.Close();&lt;br /&gt;              &lt;br /&gt;           }&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       &lt;span style=&quot;color: blue&quot;&gt;public &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt; ReadXMLData&amp;lt;T&amp;gt;(&lt;span style=&quot;color: blue&quot;&gt;string &lt;/span&gt;filename)&lt;br /&gt;       {&lt;br /&gt;           &lt;span style=&quot;color: #2b91af&quot;&gt;XmlSerializer &lt;/span&gt;deserializer = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;XmlSerializer&lt;/span&gt;(&lt;span style=&quot;color: blue&quot;&gt;typeof&lt;/span&gt;(&lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt;));&lt;br /&gt;           &lt;span style=&quot;color: #2b91af&quot;&gt;TextReader &lt;/span&gt;textReader = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;StreamReader&lt;/span&gt;(Server.MapPath(&lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;~\\XMLFiles&amp;quot;&lt;/span&gt;) + &lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;\\&amp;quot; &lt;/span&gt;+ filename);&lt;br /&gt;           &lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt; list;&lt;br /&gt;           list = (&lt;span style=&quot;color: #2b91af&quot;&gt;List&lt;/span&gt;&amp;lt;T&amp;gt;)deserializer.Deserialize(textReader);&lt;br /&gt;           textReader.Close();&lt;br /&gt;&lt;br /&gt;           &lt;span style=&quot;color: blue&quot;&gt;return &lt;/span&gt;list;&lt;br /&gt;       }&lt;br /&gt;&lt;br /&gt;       &lt;span style=&quot;color: blue&quot;&gt;#endregion&lt;br /&gt;   &lt;/span&gt;}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;If you see the code on page load I have save the data first into XML and then retrieve and display into the grid due to this every time save data into XML So if&amp;#160; you find any problem in module you will get the XML file from Production or Test Server and Load into development environment through ReadXMLData() method and debug it.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Here is the XML Generate file from the above SaveXMLData() method.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;xml&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;version&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;encoding&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt; ?&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;ArrayOfEmployee&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;xmlns:xsi&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema-instance&amp;quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;xmlns:xsd&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&amp;quot;http://www.w3.org/2001/XMLSchema&amp;quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Employee-0&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Address-0&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;9901&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Employee-1&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Address-1&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;9902&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Employee-2&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Address-2&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;9903&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Employee-3&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Address-3&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;9904&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;- &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Employee-4&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;EmployeeName&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Address-4&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Address&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;9905&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;MobilNo&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;Employee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;ArrayOfEmployee&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Scenario 2&lt;/h1&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;If you are thinking for every time save and read data from XML then application performance will affected so you can change the code like this only when exception will raise it will save the data into xml and then if you want to debug write ReadXMLData() method in a code where you want.&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre class=&quot;code&quot;&gt;&lt;span style=&quot;color: blue&quot;&gt;protected void &lt;/span&gt;Page_Load(&lt;span style=&quot;color: blue&quot;&gt;object &lt;/span&gt;sender, &lt;span style=&quot;color: #2b91af&quot;&gt;EventArgs &lt;/span&gt;e)&lt;br /&gt;        {&lt;br /&gt;            &lt;span style=&quot;color: blue&quot;&gt;try&lt;br /&gt;            &lt;/span&gt;{&lt;br /&gt;                &lt;span style=&quot;color: #2b91af&quot;&gt;Employee &lt;/span&gt;objEmp = &lt;span style=&quot;color: blue&quot;&gt;new &lt;/span&gt;&lt;span style=&quot;color: #2b91af&quot;&gt;Employee&lt;/span&gt;();&lt;br /&gt;                GridView1.DataSource = objEmp.GetEmployees();&lt;br /&gt;                GridView1.DataBind();&lt;br /&gt;            }&lt;br /&gt;            &lt;span style=&quot;color: blue&quot;&gt;catch &lt;/span&gt;(&lt;span style=&quot;color: #2b91af&quot;&gt;Exception &lt;/span&gt;ex)&lt;br /&gt;            {&lt;br /&gt;                SaveXMLData(objEmp.GetEmployees(), &lt;span style=&quot;color: #a31515&quot;&gt;&amp;quot;Employee.XML&amp;quot;&lt;/span&gt;);&lt;br /&gt;                &lt;span style=&quot;color: blue&quot;&gt;throw&lt;/span&gt;;&lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;        }&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;Conclusion&lt;/h3&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;We have seen in above samples that how we can take advantage of serialization mechanism provided by .Net. In this tutorial I have tried to keep things as simple as possible so you can understand and using the basic concepts of XML serialization for debugging the application. Feel free to share your comments. &lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/08/debugging-aspnet-application-using-xml.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-8934074349662466554</guid><pubDate>Sun, 24 Jul 2011 06:12:00 +0000</pubDate><atom:updated>2011-07-27T04:16:51.787-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Validate different controls on different buttons in a same page</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:43ed6b26-922d-4095-97a4-c961674484f9&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Different+validation+group&quot; rel=&quot;tag&quot;&gt;Different validation group&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/calling+different+validation+on+different+buttons&quot; rel=&quot;tag&quot;&gt;calling different validation on different buttons&lt;/a&gt;&lt;/div&gt; &lt;p align=&quot;justify&quot;&gt;Normally developers have a requirement to validate different controls on different buttons in this situation developers face problem when user click on any button all validation will be fire which are not belongs to that button functionality.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;ASP.NET V2 introduces a new “ValidationGroup” property on validation and input controls that now makes this possible. This allows page developers to group different controls together for more granular validation behavior.&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;For example two groups – a “&lt;strong&gt;Group1&lt;/strong&gt;” and a “&lt;strong&gt;Group2&lt;/strong&gt;” of validators. There are then two buttons on the page – when button1 is clicked, the first group of validators will fire. When button2 is clicked, the second group of validators will fire. Postback will be blocked client-side by default if the validation fails:&lt;/p&gt; &lt;p align=&quot;justify&quot;&gt;&amp;nbsp;&lt;/p&gt; &lt;h3&gt;Client Side Validation &lt;/h3&gt; &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt; &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;html&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;body&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;     &amp;lt;form runat=“server”&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;          &amp;lt;asp:textbox id=“TextBox1” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;          &amp;lt;asp:requiredfieldvalidator ValidationGroup=“Group1” ErrorText=“Need to Fill &lt;span style=&quot;color: #0000ff&quot;&gt;in&lt;/span&gt; Value!” ControlToValidate=“TextBox1” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &amp;lt;asp:textbox id=“TextBox2” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &amp;lt;asp:requiredfieldvalidator ValidationGroup=“Group2” ErrorText=“Need to Fill &lt;span style=&quot;color: #0000ff&quot;&gt;in&lt;/span&gt; Value!” ControlToValidate=“TextBox2” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &amp;lt;asp:button text=“Group1” ValidationGroup=“Group1” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;            &amp;lt;asp:button text=“Group2” ValidationGroup=“Group2” runat=“server”/&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;     &amp;lt;/form&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;/body&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;The code given above has two validation groups. The first validation groups is identified as “First” and the second validation group is identified as “Second”. Each validation group has two textboxes, a RequiredField validator and a button. If you look at the code you might see that each control has a property called “ValidationGroup” and its value is set to the name of the validation group to which that control belongs. &lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;Clicking the “Submit1” button initiates the validation of the first group and throws an error message if the TextBox1 is left blank. Since this button belongs to the ‘First’ validation group, it initiates the validaton controls that belongs to that group. Similarly clicking the ‘Submit2’ button throws an error message if the TextBox3 is left blank. Thus the validation groups help in grouping the controls in a single web page allowing you to have separate validations for different controls while allowing you to submit values in a particular group. &lt;/p&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;h3 align=&quot;justify&quot;&gt;Server Side Validation&lt;/h3&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;If you want to validate on server side just call page.Validate(“Group Name”) on button click event it will automatically call respective group.You don’t have need to define specific group on html code.&lt;/p&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;body&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;form id=&lt;span style=&quot;color: #006080&quot;&gt;&quot;form1&quot;&lt;/span&gt; runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;div&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:TextBox ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox1&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;First&quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:TextBox ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox2&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;First&quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;br /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:RequiredFieldValidator ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;RequiredFieldValidator1&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;First&quot;&lt;/span&gt;ErrorMessage=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox1 should not be blank&quot;&lt;/span&gt; ControlToValidate=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox1&quot;&lt;/span&gt;&amp;gt; &amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:Button ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Submit1&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt;  Text=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Submit 1&quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt; &amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:TextBox ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox3&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Second&quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:TextBox ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox4&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Second&quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;asp:RequiredFieldValidator ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;RequiredFieldValidator2&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt; ErrorMessage=&lt;span style=&quot;color: #006080&quot;&gt;&quot; TextBox3 should not be blank&quot;&lt;/span&gt;ControlToValidate=&lt;span style=&quot;color: #006080&quot;&gt;&quot;TextBox3&quot;&lt;/span&gt; ValidationGroup=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Second&quot;&lt;/span&gt;&amp;gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt; &amp;lt;asp:Button ID=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Submit2&quot;&lt;/span&gt; Runat=&lt;span style=&quot;color: #006080&quot;&gt;&quot;server&quot;&lt;/span&gt;  Text=&lt;span style=&quot;color: #006080&quot;&gt;&quot;Submit 2&quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt; &amp;lt;/div&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;/form&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;lt;/body&amp;gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Submit1_Click(&lt;span style=&quot;color: #0000ff&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Page.Validate(&lt;span style=&quot;color: #006080&quot;&gt;&quot;First&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt;(Page.IsValid)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #008000&quot;&gt;// Continue&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;protected&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Submit2_Click(&lt;span style=&quot;color: #0000ff&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;{&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Page.Validate(&lt;span style=&quot;color: #006080&quot;&gt;&quot;Second&quot;&lt;/span&gt;);&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt;(Page.IsValid)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    {&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #008000&quot;&gt;// Continue&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;    }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/pre&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/07/validate-different-controls-on.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-6097246714759213267</guid><pubDate>Tue, 24 May 2011 05:37:00 +0000</pubDate><atom:updated>2011-05-24T22:36:02.162-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Define Access Key In asp.net button control</title><description>&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:243c2d0b-4c06-4c43-b64b-49ff736d0852&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Access+Key&quot; rel=&quot;tag&quot;&gt;Access Key&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Asp.net&quot; rel=&quot;tag&quot;&gt;Asp.net&lt;/a&gt;&lt;/div&gt;  &lt;p align=&quot;justify&quot;&gt;If you want to underline and define the access key in asp.net just like you define in windows application , use the html button element. To produce the same behavior as an asp.net Button control. I set the runat attribute to &amp;quot;server&amp;quot; and use the onclick event to call javascript and onServerClick event to call a server side method.&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;   &lt;br /&gt;Here is the code for the page,     &lt;br /&gt;&lt;/p&gt;  &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;   &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;     &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;form1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;button&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;hbutton1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;type&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;submit&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;accesskey&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;A&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;onserverclick&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;hbutton1_Click&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;alert(&#39;test&#39;);&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;A&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;u&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;dd&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;button&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;font size=&quot;3&quot;&gt;Code-behind,&lt;/font&gt;&lt;/strong&gt;&amp;#160; &lt;br /&gt;&amp;#160;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;protected void hbutton1_Click(object sender, EventArgs e)&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;       {&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;           Response.Write(&amp;quot;hbutton clicked&amp;quot;);&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;       }&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;When, the page is run, a button is generated with text &amp;quot;&lt;u&gt;A&lt;/u&gt;dd&amp;quot;. When clicked, at first an alert message is shown and then the page postbacks.&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/05/underline-access-key-of-aspnet-button.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-3755894557287173803</guid><pubDate>Mon, 23 May 2011 05:30:00 +0000</pubDate><atom:updated>2011-05-22T22:35:36.962-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Register Custom User Control in Web.Config File</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&lt;font size=&quot;2&quot;&gt;Normally we register any user control or assemblies in page directive of aspx html source if we want to used in any aspx page like.&lt;/font&gt;&lt;/p&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Register TagPrefix=&quot;MyControl&quot; TagName=&quot;HeaderControl&quot; Src=&quot;Header.ascx&quot; %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Register TagPrefix=&quot;MyControl&quot; TagName=&quot;footerControl&quot; Src=&quot;Footer.ascx&quot; %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Register TagPrefix=&quot;MyAssembly&quot; Assembly=&quot;Myassembly&quot; %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;font face=&quot;Arial&quot;&gt;IF you have header and footer user control and you want to adding on every page or more than one pages then you don’t need to register on every page just register only one time in web.config file and used it multiple time like this way.&lt;/font&gt;&lt;/pre&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;?&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;xml&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;version&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;1.0&quot;&lt;/span&gt;?&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;configuration&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;system.web&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;pages&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;controls&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;tagPrefix&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;MyControl&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;~/Header.ascx&quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;tagName&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;HeaderControl&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;tagPrefix&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;MyControl&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;src&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;~/Footer.ascx&quot;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #ff0000&quot;&gt;tagName&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;footerControl&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;tagPrefix&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;MyAssembly&quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;assembly&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&quot;MyAssembly&quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;controls&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;pages&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;        &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;system.web&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;configuration&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/05/register-custom-user-control-in.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1277406302639203421</guid><pubDate>Mon, 18 Apr 2011 05:47:00 +0000</pubDate><atom:updated>2011-04-17T22:47:49.668-07:00</atom:updated><title>Cookieless Session State Asp.net</title><description>&lt;h3&gt;Cookieless Session State Asp.net&lt;/h3&gt;  &lt;p&gt;ASP.NET Session State by default uses a cookie to store session ID. Session ID is a unique string, used to recognize individual visitor between visits. But, if client&#39;s web browser doesn&#39;t support cookies or visitor has disabled cookies in web browser&#39;s settings, ASP.NET can&#39;t store session id on client&#39;s machine. In this case, new session will be created for every request. This behavior is useless because we can&#39;t remember information for certain visitor between two requests. We can say that, by default, sessions can&#39;t work if browser doesn&#39;t support cookies.&lt;/p&gt;  &lt;h4&gt;ASP.NET sessions without cookies (cookieless session)&lt;/h4&gt;  &lt;p&gt;ASP.NET supports sessions without cookies, known as cookieless sessions. As an alternative, ASP.NET can embed session id inside of page URL. On this way, all page links will contain session id string. When visitor clicks on some of these links, ASP.NET will read session id from page URL, so we don&#39;t need cookies support to have functional sessions.&lt;/p&gt;  &lt;p&gt;To enable cookieless sessions, add &lt;strong&gt;cookieless=&amp;quot;true&amp;quot;&lt;/strong&gt;, or &lt;strong&gt;cookieless=&amp;quot;UseUri&amp;quot; &lt;/strong&gt;(both options have the same meaning) inside &lt;strong&gt;sessionState tag&lt;/strong&gt; in web.config file, like this: &lt;/p&gt;  &lt;p&gt;&amp;lt;sessionState cookieless=&amp;quot;true&amp;quot; /&amp;gt;&lt;/p&gt;  &lt;p&gt;SessionState element in web.config file is located inside &amp;lt;configuration&amp;gt;, &amp;lt;system.web&amp;gt; elements. Default behavior for sessions with cookies could be set with cookieless=&amp;quot;false&amp;quot;. Since it is already specified in machine.config file and inherited to all ASP.NET applications on server, you don&#39;t need any configuration change if you use cookie sessions. &lt;/p&gt;  &lt;p&gt;As a result of cookieless=&amp;quot;true&amp;quot;, session id will be embedded in all page URLs. The drawback is that you&#39;ll end up with ugly URLs, which are not so good for SEO (search engine optimization) and visitor definitely will not remember it. Here is an example URL of website which uses ASP.NET cookieless sessions: &lt;/p&gt;  &lt;p&gt;http://mappoint.msn.com/&lt;strong&gt;(22b5c4zyybphaw2mt3hjni2n)&lt;/strong&gt;/Home.aspx &lt;/p&gt;  &lt;p&gt;Bolded part represents session id, which is used to recognize a visitor. Possible problem is that URL will be different for every visitor and every visit, because they will have different session identities. If user just copy URL and paste it somewhere while recommending your website, he or she will send its session id too. This could be potential security risk if session is not expired yet. Also, search engines will consider any of these links as separate page. This will divide page ranking and decrease position of your page in search engine results. &lt;/p&gt;  &lt;h4&gt;Cookieless session and absolute URLs problem&lt;/h4&gt;  &lt;p&gt;There is a problem with absolute URLs if Cookieless session is used (e.g. URLs which starts with http://, https:// etc.), and with URLs which starts with slash character &amp;quot;/&amp;quot;. So, you can&#39;t use links like /products/Product1.aspx anymore. If you place absolute link on your page, ASP.NET will not embed session id in it. If visitor clicks on link without current session id, he or she will get new session with new session id. Previous session and its data will be lost. With every next click on absolute links, visitor will get new session each time. On this way session becomes useless, because it cant remember user&#39;s data between two requests. So, easiest solution is to simply forget links with absolute URLs on cookieless website. &lt;/p&gt;  &lt;p&gt;Other option is to embed session id into absolute URLs by using &lt;strong&gt;Response.ApplyAppPathModifier method&lt;/strong&gt;. This could be useful, for example if we read and display a list of absolute URLs from database, or perform redirection from http:// to https:// etc. Here is a simple example of modification of absolute URL. Resulting URL will contain embedded current session id: &lt;/p&gt;  &lt;p&gt;&amp;lt;a id=&amp;quot;Hyperlink1&amp;quot; runat=&amp;quot;server&amp;quot; href=&#39;&amp;lt;% =Response.ApplyAppPathModifier(&amp;quot;http://mysite.com/Some-Absolute-Link.aspx&amp;quot;); %&amp;gt;&#39; &amp;gt;Absolute link with cookieless session example&amp;lt;/a&amp;gt;&lt;/p&gt;  &lt;p&gt;In the other hand, absolute links are pretty useful for static files like images, .js, .css, .zip files etc. &lt;/p&gt;  &lt;h4&gt;Cookieless session and links to images, JavaScript files, CSS files etc.&lt;/h4&gt;  &lt;p&gt;When &lt;strong&gt;cookieless=&amp;quot;true&amp;quot;&lt;/strong&gt; is used, every relative link will be rewritten to embed session id. That includes links to files like images, JavaScript files, CSS files, PDF files, ZIP files for download etc.&lt;/p&gt;  &lt;p&gt;In most cases, you don&#39;t need session id embedded inside of these links. Embedded session id inside of links to images and other similar files could cause cache problems.&lt;/p&gt;  &lt;p&gt;For every new visit, visitor will get different session id. Thus, same image will always have different URL. Different URL means different image for web browser. If you check &amp;quot;Temporary Internet Files&amp;quot; in Internet Explorer or some other browser, notice that same image is saved many times. Actually, it is saved again each time you visit cookieless website. This could be a problem, especially on high traffic websites. In this case, cookieless session could increase bandwidth costs and slow down page loading, since same files must be downloaded multiple times and stored separately. &lt;/p&gt;  &lt;p&gt;As a simple solution, you can use absolute links for images, JavaScript, CSS, PDF and similar files and avoid session id issue on this way.&lt;/p&gt;  &lt;h4&gt;ASP.NET cookieless options&lt;/h4&gt;  &lt;p&gt;ASP.NET offers six different options for cookieless attribute.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UseCookies&lt;/strong&gt; - This is default option, set in machine.config file. ASP.NET website will use cookies to store session id, even if client doesn&#39;t support them. In case that client refuse to save cookie, session data will be lost and new session is created for each request. Thus, clients without cookie support can&#39;t use web application.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;false&lt;/strong&gt; - has same meaning as UseCookies.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UseUri&lt;/strong&gt; - Website will embed session id inside of all relative URLs. ASP.NET Session State will never use cookies, even if client browser supports them. Sessions will work on each client, but could be less secure than session with cookie.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;true&lt;/strong&gt; - same as UseUri.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;UseDeviceProfile&lt;/strong&gt; - ASP.NET will check client if it&#39;s capable to support cookies. If client can support cookies, cookie will be used to store session id. Notice that this method just checks browser&#39;s features, but it doesn&#39;t consider an option that user is manually disabled cookies in browser. If web browser application supports cookies but user is disabled them, session will not work.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;AutoDetect&lt;/strong&gt; - ASP.NET will automatically detect if client supports cookies or not. If client supports cookies, website will use a cookie as storage for session id. If client doesn&#39;t support cookies, ASP.NET will embed session id in page URL. This looks as good compromise, although could cause problems with search engines.&lt;/p&gt;  &lt;h4&gt;Cookieless sessions and RegenerateExpiredSessionId parameter&lt;/h4&gt;  &lt;p&gt;To enable cookieless session, it is enough to set appropriate value for cookieless parameter. But, sessionState element contains &lt;strong&gt;RegenerateExpiredSessionId parameter&lt;/strong&gt; which is important for security reasons. RegenerateExpiredSessionId could have two values:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;True&lt;/strong&gt; - Expired session ids can&#39;t be used again. If visitor comes to website using old session id, it will be replaced with new session id &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;False&lt;/strong&gt; - If visitor uses old session id to visit website (e.g. through a bookmark, search engines, social networks etc.), website will create new session collection but session id will stay same.&lt;/p&gt;  &lt;p&gt;For security reasons, especially with cookieless sessions, is better to always use RegenerateExpiredSessionId=&amp;quot;True&amp;quot;. On this way expired session id will not be used for new session, to avoid that different visitors have same session id. &lt;/p&gt;  &lt;h4&gt;SEO (Search Engine Optimization) and cookieless sessions&lt;/h4&gt;  &lt;p&gt;Search engines like Google could provide a lot of visits to website. Everything begins when Googlebot, or some others&#39; search bot application, make requests to website to load its content and save it to their database for further analyze. Saved data are then provided for search on search engine, and possibly listed in search results.&lt;/p&gt;  &lt;p&gt;Important issue when working with cookieless sessions is duplicate content. Let&#39;s suppose that you have one page with unique content. Each time when search bot reads that page, ASP.NET will assign different session id to it. Different session id means different URLs on page. So, instead to see your page as one page with original content, search bot could consider that you have a lot of different pages with same content. That is not good for search engine optimization, because your page will divide its ranking and be shown on the bottom of search results where no one clicks.&lt;/p&gt;  &lt;p&gt;The solution for this could be to use &lt;strong&gt;cookieless=&amp;quot;UseDeviceProfile&amp;quot;&lt;/strong&gt; and then add new browser profile for each search bot inside &amp;lt;browsers&amp;gt; element in web.config. For example, if user agent string contains word &amp;quot;Googlebot&amp;quot;, browser profile will tell ASP.NET that Googlebot supports cookies. On this way, session id will not use cookies when Google bot comes. Of course, we know that Googlebot doesn&#39;t support cookies, so this sounds more like hack than recommended nice looking solution. But, it will work and you can add new browser profile for any problematic search bot. Notice that UseDeviceProfile only looks on browser capabilities, thus on this way you are losing visitors with capable browsers, but who manually disabled cookies.&lt;/p&gt;  &lt;p&gt;One more potential SEO problem with cookieless sessions is HTTP 302 redirect. When, search bot makes requests to some domain which uses cookieless sessions, ASP.NET will redirect visitor to other link with session id embedded. During this process, ASP.NET will use HTTP 302 Found message. Code 302 could have two meanings: 303 or 307. &amp;quot;303 See Other&amp;quot; means that correct content is found on different URL. 307 response represents temporary redirect. So, correct status code should be 307, temporary redirect, because in that case main link without session id is considered as the correct one. Unfortunately, bad architecture of ASP.NET cookieless session redirects using vague 302 message which is more often perceived as 303, than as 307. The consequence is that search bots usually save URL with session id embedded and even worse, see different pages each time when crawl through website.&lt;/p&gt;  &lt;p&gt;Fortunately, main search engines learned how to deal with session variables, so now the problem is not so big as before. Still, clean URLs with keywords only will always rank better in search results, thus I can say that cookieless sessions generally are not good for SEO.&lt;/p&gt;  &lt;h4&gt;Security issues and cookieless session&lt;/h4&gt;  &lt;p&gt;Main security problem when working with sessions is a possibility that malicious user will find out others&#39; session id. If two users share same session id, they share same session variables too and website is considering them as one visitor. This could be a security risk if session is used for any private or sensitive data, or to allow access to restricted areas of web site. When cookies are used, session id can be protected using SSL and by marking a cookie as secure. But, in case of cookieless session, session id is part of URL and is much more vulnerable. &lt;/p&gt;  &lt;p&gt;Attacker could use network monitoring tool to see requested URLs. Because session id is part of URL, if you know requested URL you know session id too. Also, if malicious user get access to recent web server&#39;s logs, it is possible to read recent requested URLs and visit website with still active session.&lt;/p&gt;  &lt;p&gt;On more problem is e-mail, social network or instant messenger communication. Pretty innocent question, as &amp;quot;Can you send me link to that page please?&amp;quot; could be huge security risk. Visitor could copy link from address bar and send it to someone through an email, some instant messenger, like AIM, Windows Live Messenger, Skype etc., or through social networks like Facebook. When other person use received link to open website, he or she will share same session as sender, and possibly see private data or have access to restricted area of web site.&lt;/p&gt;  &lt;p&gt;Search bots generally don&#39;t accept cookies. That means that bots will get cookieless session and see URLs with embedded session id. If these URLs appear in search results, they will still contain that session id. So, imagine that first visitor comes to your website from Google search. Website will read session id from given URL. Then, after few minutes, second visitor comes using the same link. Now these two, and every next visitor that comes from search engine will share same session id, and same session variables and all of them will be considered as single visitor! This could make sessions useless and also be potential security risk. To solve this problem, always set RegenerateExpiredSessionId=&amp;quot;True&amp;quot; when working with cookieless session. When RegenerateExpiredSessionId=&amp;quot;True&amp;quot; and some visitor comes through an URL that contains expired session id, ASP.NET will assign new unique session id.&lt;/p&gt;  &lt;p&gt;Since session id is so exposed when cookieless sessions are used, to increase security you can check some other information from visitor, like information from Request.Browser properties. Checking of IP address is also an option, but notice that some Internet service providers change IP address during the single visit. In cases like this, often you still can check first two numbers of IP address because they usually stay the same.&lt;/p&gt;  &lt;p&gt;Notice that visitors usually disable cookies for security reasons. In case of cookieless sesions, ironically, visitor become much more insecure than if session with cookie is used.&lt;/p&gt;  &lt;h4&gt;Menu and TreeView control when cookieless session is used&lt;/h4&gt;  &lt;p&gt;Menu and TreeView controls are standard controls used for site navigation. Keep in mind that these controls will not automatically add session ids. For example, very common scenario is to bind Menu or TreeView control to SiteMapDataSource control. It looks logical that resulting links on page will have session id embedded. But, Menu or TreeView control will display just simple absolute links without ids.&lt;/p&gt;  &lt;p&gt;To resolve this, we need to use Response.ApplyAppPathModifier method again. In this case, we&#39;ll use &lt;strong&gt;MenuItemDataBound or TreeNodeDataBound&lt;/strong&gt; events respectively:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;[ C# ]&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;// Cookieless sessions with Menu control   &lt;br /&gt;protected void Menu1_MenuItemDataBound(object sender, MenuEventArgs e)    &lt;br /&gt;{    &lt;br /&gt;// Embeds session id    &lt;br /&gt;&amp;#160;&amp;#160; e.Item.NavigateUrl = Response.ApplyAppPathModifier(e.Item.NavigateUrl);    &lt;br /&gt;}    &lt;br /&gt;// Cookieless sessions with TreeView control    &lt;br /&gt;protected void TreeView1_TreeNodeDataBound(object sender, TreeNodeEventArgs e)    &lt;br /&gt;{    &lt;br /&gt;// Embeds session id    &lt;br /&gt;&amp;#160;&amp;#160; e.Node.NavigateUrl = Response.ApplyAppPathModifier(e.Node.NavigateUrl);    &lt;br /&gt;} &lt;/p&gt;  &lt;p&gt;&lt;b&gt;[ VB.NET ]&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;&#39; Cookieless sessions with Menu control   &lt;br /&gt;Protected Sub Menu1_MenuItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.MenuEventArgs) Handles Menu1.MenuItemDataBound    &lt;br /&gt;&#39; Embeds session id    &lt;br /&gt;&amp;#160;&amp;#160; e.Item.NavigateUrl = Response.ApplyAppPathModifier(e.Item.NavigateUrl)    &lt;br /&gt;End Sub    &lt;br /&gt;&#39; Cookieless sessions with TreeView control    &lt;br /&gt;Protected Sub TreeView1_TreeNodeDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodeDataBound    &lt;br /&gt;&#39; Embeds session id    &lt;br /&gt;&amp;#160;&amp;#160; e.Node.NavigateUrl = Response.ApplyAppPathModifier(e.Node.NavigateUrl)    &lt;br /&gt;End Sub&lt;/p&gt;  &lt;p&gt;Now, all links in Menu or TreeView controls will have session ids embedded. &lt;/p&gt;  &lt;h4&gt;Session.IsCookieless property&lt;/h4&gt;  &lt;p&gt;You can check in run time if session is cookieless sessions or not. This is useful if you are creating an application that could be included as module on others&#39; websites (e.g. forum, user support application etc.). In this case, you can&#39;t change settings in main web.config file, but you can check in code if session requires cookies but visitor is disabled them, and if needed redirect and inform visitor so he or she knows why application doesn&#39;t work. Example of using Session.IsCookieless property could look like this:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;[ C# ]&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;if (Session.IsCookieless)   &lt;br /&gt;{    &lt;br /&gt;// Web application uses cookieless session    &lt;br /&gt;}    &lt;br /&gt;else    &lt;br /&gt;{    &lt;br /&gt;// Web application uses cookies to work with sessions    &lt;br /&gt;// If needed, inform visitor that cookies are required     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;&lt;b&gt;[ VB.NET ]&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;If (Session.IsCookieless) Then   &lt;br /&gt;&#39; Web application uses cookieless session    &lt;br /&gt;Else    &lt;br /&gt;&#39; Web application uses cookies to work with sessions    &lt;br /&gt;&#39; If needed, inform visitor that cookies are required    &lt;br /&gt;End If&lt;/p&gt;  &lt;h4&gt;Conclusion&lt;/h4&gt;  &lt;p&gt;HTTP is stateless protocol, which means that it doesn&#39;t provide a way to save information of same visitor between two requests. ASP.NET offers Session State as a method to resolve this problem. To find out more about other possible methods, check &lt;a href=&quot;http://www.beansoftware.com/ASP.NET-Tutorials/Session-State-Alternatives.aspx&quot;&gt;ASP.NET Session State Alternatives&lt;/a&gt; tutorial. In general, to save visitor&#39;s state when using stateless protocol, you can place id inside of page&#39;s HTML or as part of URL. In HTML, there are two options: &amp;lt;head&amp;gt; or &amp;lt;body&amp;gt; tags. Cookies are part of &amp;lt;head&amp;gt; tag, but this is automatically managed by web browser. &lt;/p&gt;  &lt;p&gt;ASP.NET ViewState stores information inside of &amp;lt;body&amp;gt; tag, as hidden field. This works nice, but the problem is that this method can only work with POST, and can&#39;t work if GET method is used.&lt;/p&gt;  &lt;p&gt;Third, and last option is to store information inside of page URL, and that is how cookieless session work. Be aware that some mobile devices can&#39;t read format of cookieless URLs with parentheses, and cookieless sessions could cause problems with some URL rewriting modules.&lt;/p&gt;  &lt;p&gt;If you have pure HTML pages, there is a problem to share POST data between HTML form and ASP.NET web form. When cookieless ASP.NET form is posted, it contains information about session id too. But, if you make POST on HTML form, it will not contain session id and new session will be created. In that case, data of previous session will be lost. The solution could be to embed session id to link in form&#39;s action attribute. You can do that using Response.ApplyAppPathModifier method like in previous examples.&lt;/p&gt;  &lt;h4&gt;&lt;a&gt;&lt;/a&gt;Limitations&lt;/h4&gt;  &lt;p&gt;The principal limitation of this feature is the limited amount of data that can be stored in the URL. This feature is not targeted at common browsers such as IE, since these do support cookies and do not require this feature. The browsers that do not support cookies are the ones found on mobile devices (such as phones), and these browsers typically severely limit the size of the URL they support. So, be careful when you use this feature—try to make sure that the cookieless string generated by your application is small.&lt;/p&gt;  &lt;p&gt;A second limitation on the size comes on the Windows 2003 platform. A (configurable) setting on the Windows Networking&lt;strong&gt; &lt;/strong&gt;layer requires that each segment of the URL be less than 256 chars in length. Since the entire cookieless string goes into 1 segment, it must be less than 256 chars. (A segment of the URL is the portion of the URL between two forward slashes (&#39;/&#39;)).&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/04/cookieless-session-state-aspnet.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-4583311912558930976</guid><pubDate>Wed, 13 Apr 2011 07:31:00 +0000</pubDate><atom:updated>2011-04-27T00:16:38.212-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><title>Caching in Asp.net</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size=&quot;4&quot; face=&quot;Arial&quot;&gt;Caching &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;This article, you will learn about concepts, advantages, types of caching and about implementation of caching in ASP.NET applications. The code also serves as an example of using inline coding, creating user controls, trace mechanism, etc.&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;strong&gt;&lt;font size=&quot;3&quot; face=&quot;Arial&quot;&gt;What is Caching?&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;font size=&quot;3&quot;&gt;   &lt;p&gt;&amp;#160;&lt;/p&gt;    &lt;p align=&quot;justify&quot;&gt;&lt;/p&gt;   &lt;font face=&quot;Arial&quot;&gt;&lt;font size=&quot;2&quot;&gt;Caching is a technique of persisting the data in memory for immediate access to requesting program calls. Many in the developer community consider caching as one of the features available to improve performance of Web applications&lt;strong&gt;.&lt;/strong&gt;&lt;/font&gt;&lt;/font&gt; &lt;/font&gt;  &lt;p&gt;   &lt;br /&gt;&lt;strong&gt;&lt;font size=&quot;3&quot; face=&quot;Arial&quot;&gt;Why Caching?&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Consider a page that has list of Employee name, contact numbers and mail-Ids of existing employees of a company on an intranet accessible by all employees. This is very useful information that is available throughout the company and could also be one of the most accessed pages. The functionality of adding, updating or deleting is usually less intensive compared to more transaction-based systems like Purchase ordering, Voucher creation etc. Now in a normal scenario the process of querying database for each request is not cost-effective in terms of server resources, hence is lot better to cache or persist the data to avoid this costly loss of resources.&lt;/font&gt;     &lt;br /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;The .NET Advantage&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&amp;#160;&lt;/strong&gt;ASP.NET provides the flexibility in terms of caching at different levels. &lt;/p&gt;  &lt;p&gt;   &lt;br /&gt;&lt;strong&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;1. Page Level Output Caching &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt; &lt;strong&gt;   &lt;p&gt;     &lt;br /&gt;&lt;/p&gt;   &lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;This is at the page level and one of the easiest means for caching pages. This requires one to specify Duration of cache and Attribute of caching.&lt;/font&gt;     &lt;br /&gt;&lt;/strong&gt;  &lt;p&gt;   &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;     &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;       &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Syntax: &lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ OutputCache Duration=&amp;quot;60&amp;quot; VaryByParam=&amp;quot;none&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;The above syntax specifies that the page be cached for duration of 60 seconds and the value &amp;quot;none&amp;quot; for VaryByParam* attribute makes sure that there is a single cached page available for this duration specified. &lt;br /&gt;    &lt;br /&gt;* VaryByParam can take various &amp;quot;key&amp;quot; parameter names in query string. Also there are other attributes like VaryByHeader, VaryByCustom etc. Please refer to MSDN for more on this. &lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;br /&gt;  &lt;br /&gt;&lt;strong&gt;2. &lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Fragment Caching &lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;strong&gt;&lt;font size=&quot;2&quot;&gt;&lt;br /&gt;      &lt;br /&gt;&lt;/font&gt;&lt;/strong&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Even though this definition refers to caching portion/s of page, it is actually caching a user control that can be used in a base web form page. In theory, if you have used include files in the traditional ASP model then this caching model is like caching these include files separately. In ASP.NET more often this is done through User Controls. Initially even though one feels a bit misleading, this is a significant technique that can be used especially when implementing &amp;quot;n&amp;quot; instances of the controls in various *.aspx pages. We can use the same syntax that we declared for the page level caching as shown above, but the power of fragment caching comes from the attribute &amp;quot;VaryByControl&amp;quot;. Using this attribute one can cache a user control based on the properties exposed. &lt;br /&gt;    &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;    &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Syntax: &lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ OutputCache Duration=&amp;quot;60&amp;quot; VaryByControl=&amp;quot;DepartmentId&amp;quot; %&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt; &lt;br /&gt;  &lt;br /&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;The above syntax when declared within an *.ascx file ensures that the control is cached for 60 seconds and the number of representations of cached control is dependant on the property &amp;quot;DepartmentId&amp;quot; declared in the control. &lt;br /&gt;    &lt;br /&gt;Add the following into an *.ascx file. Please note the use of tag &amp;quot;Control&amp;quot; and the cache declaration. &lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Control Language=&amp;quot;C#&amp;quot;%&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ outputcache duration=&amp;quot;60&amp;quot; varybycontrol=&amp;quot;DepartMentId&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;private&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; _Departmentid=0; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;int&lt;/span&gt; DepartMentId &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; get{&lt;span style=&quot;color: #0000ff&quot;&gt;return&lt;/span&gt; _Departmentid;} &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt; set{_Departmentid =value;} &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//Load event of control &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Page_Load(Object sender, EventArgs e) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt; lblText.Text = &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Time is &amp;quot;&lt;/span&gt; + DateTime.Now.ToString() + &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot; for Department id = &amp;quot;&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum12&quot;&gt;  12:&lt;/span&gt; + _Departmentid + &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum13&quot;&gt;  13:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;lblText&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;Add the following to an *.aspx file. Please note the way &amp;quot;Register&amp;quot; tag is used; the declaration of control using syntax &amp;lt;[TagPrefix]:[TagName]&amp;gt;; Usage of property &amp;quot; DepartMentId&amp;quot;. Open the page in two browsers and closely watch the Base form timing and the User control timing. Also note that the following page results in two copies or representation of user control in the cache. &lt;br /&gt;  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;  &lt;p&gt;&lt;br /&gt;    &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;      &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; Trace=&amp;quot;true&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Register TagPrefix=&amp;quot;CacheSample&amp;quot; TagName=&amp;quot;Text&amp;quot; Src=&amp;quot;CachingControl.ascx&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;=&lt;span style=&quot;color: #ff0000&quot;&gt;server&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Page_Load(Object sender, EventArgs e) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;.lbltime.Text =&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Base form time is &amp;quot;&lt;/span&gt; + DateTime.Now.ToString() + &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;\n&amp;quot;&lt;/span&gt;; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Form2&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tbody&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;lbltime&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CACHESAMPLE:TEXT&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;instance1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;DepartMentId&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;0&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CACHESAMPLE:TEXT&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CACHESAMPLE:TEXT&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;instance2&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;DepartMentId&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;CACHESAMPLE:TEXT&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tbody&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;        &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;    &lt;/div&gt;&lt;br /&gt;  &lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p&gt;3. &lt;font face=&quot;Arial&quot;&gt;Application Level Caching &lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;  &lt;p align=&quot;justify&quot;&gt;&lt;br /&gt;    &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;  &lt;font face=&quot;Arial&quot;&gt;&lt;font size=&quot;2&quot;&gt;With Page level Output caching one cannot cache objects between pages within an application. Fragment caching is great in that sense but has limitations by using user controls as means to do. We can use the Cache object programmatically to take advantage of caching objects and share the same between pages. Further the availability of different overloaded methods gives a greater flexibility for our Cache policy like Timespan, Absolute expiration etc. But one of the biggest takes is the CacheDependancy. This means that one can create a cache and associate with it a dependency that is either another cache key or a file. &lt;br /&gt;      &lt;br /&gt;In almost all Web applications there could be numerous master tables that act as lookups to application specific tables. For e.g. if you take up adding a Employee, usually one has master tables like &amp;quot;tblQualification&amp;quot; to get list of qualifications, &amp;quot;tblLocations&amp;quot; to get list of locations etc. These tables* are usually set during the initial application configuration phase and could be modified once a month or even less than that. Hence it makes sense for us to use them in our Cache rather than making calls to database on each request. But then what Cache Policy do we adopt? &lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;We cannot hold these objects in Cache for entire application instance, because if anybody changes data in these tables one has to also refresh the cache. It is here that CacheDependancy can be used. &lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;* Even though these tables are less frequently used for updates, they are extensively used in our select statements through out the applications. &lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;Find below the snippet that uses CacheDependancy. Here what I have done is to provide a list view of existing employees. You need to create a Database in Sql Server, setup some data before you can continue. The schema scripts are enclosed in the article. &lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;Add database connection value in Web.Config and change the value as per your setup. &lt;br /&gt;&lt;br /&gt;      &lt;br /&gt;&lt;/font&gt;&lt;/font&gt;&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;appSettings&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;add&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;key&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;conn&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;value&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Data Source=vishnu;trusted_connection=yes;Initial Catalog=Users&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;appSettings&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;First I get the dataset into which I fill the user list. But before this I check for the cache initially if it exists I directly cast it to a dataset, if not create a cache again. &lt;br /&gt;    &lt;br /&gt;daUsers.Fill(dsUsers,&amp;quot;tblUsers&amp;quot;); &lt;br /&gt;&lt;br /&gt;    &lt;br /&gt;I create the cache with &amp;quot;Users&amp;quot; as key using Cache.Insert* and link this with a file &amp;quot;Master.xml&amp;quot;. This &amp;quot;Master.xml&amp;quot; is a XML file that contains Master data of &amp;quot;tblQualifications&amp;quot; and &amp;quot;tbllocations&amp;quot;. I have used &amp;quot;Server.MapPath&amp;quot; to get the physical path of the file on the server. The CacheDependancy instance will make sure that any change in this dependency file means that you need to recreate your cache key definition. This is a great feature to use since I can recreate my cache only when required instead of caching the data at the page level&lt;/font&gt;. &lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;    &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;* For other overloaded parameters refer MSDN.Also note how we could use trace within to add my own statements.&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Cache.Insert(&amp;quot;Users&amp;quot;,dsUsers,new System.Web.Caching.CacheDependency(Server.MapPath(&amp;quot;Master.xml&amp;quot;)) , DateTime.Now.AddSeconds(45),TimeSpan.Zero); &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;HttpContext.Current.Trace.Write(&amp;quot;from Database..&amp;quot;); &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&amp;#160;&lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Page Language=&amp;quot;c#&amp;quot; Trace=&amp;quot;true&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Data&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Data.SqlClient&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Configuration&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Web&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Collections&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.IO&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Page_Load(Object sender, EventArgs e) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; DataSet dsUsers; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;if&lt;/span&gt;(Cache[&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Users&amp;quot;&lt;/span&gt;]==&lt;span style=&quot;color: #0000ff&quot;&gt;null&lt;/span&gt;) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt; SqlConnection cn; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt; dsUsers = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; DataSet(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;new&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt; cn = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; SqlConnection(ConfigurationSettings.AppSettings.Get(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;conn&amp;quot;&lt;/span&gt;)); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum12&quot;&gt;  12:&lt;/span&gt; SqlDataAdapter daUsers; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum13&quot;&gt;  13:&lt;/span&gt; daUsers = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; SqlDataAdapter(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Select * from tblUsers&amp;quot;&lt;/span&gt;,cn); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum14&quot;&gt;  14:&lt;/span&gt; cn.Open(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum15&quot;&gt;  15:&lt;/span&gt; daUsers.Fill(dsUsers,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;tblUsers&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum16&quot;&gt;  16:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//Update the cache object &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum17&quot;&gt;  17:&lt;/span&gt; Cache.Insert(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Users&amp;quot;&lt;/span&gt;,dsUsers, &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; System.Web.Caching.CacheDependency( &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum18&quot;&gt;  18:&lt;/span&gt; Server.MapPath(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Master.xml&amp;quot;&lt;/span&gt;)), DateTime.Now.AddSeconds(45),TimeSpan.Zero); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum19&quot;&gt;  19:&lt;/span&gt; HttpContext.Current.Trace.Write(DateTime.Now.AddSeconds(45).ToString() + &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum20&quot;&gt;  20:&lt;/span&gt; is expiry time..&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum21&quot;&gt;  21:&lt;/span&gt; cn.Close(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum22&quot;&gt;  22:&lt;/span&gt; cn.Dispose(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum23&quot;&gt;  23:&lt;/span&gt; HttpContext.Current.Trace.Write(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;from Database..&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum24&quot;&gt;  24:&lt;/span&gt; lblChange.Text =&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;From the database....&amp;quot;&lt;/span&gt;; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum25&quot;&gt;  25:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum26&quot;&gt;  26:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;else&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum27&quot;&gt;  27:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum28&quot;&gt;  28:&lt;/span&gt; HttpContext.Current.Trace.Write(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;From cache..&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum29&quot;&gt;  29:&lt;/span&gt; lblChange.Text =&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;From the cache....&amp;quot;&lt;/span&gt;; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum30&quot;&gt;  30:&lt;/span&gt; dsUsers= (DataSet) Cache[&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Users&amp;quot;&lt;/span&gt;]; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum31&quot;&gt;  31:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum32&quot;&gt;  32:&lt;/span&gt; dlUsers.DataSource =dsUsers; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum33&quot;&gt;  33:&lt;/span&gt; dlUsers.DataMember = dsUsers.Tables[0].TableName ; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum34&quot;&gt;  34:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//lblChange.Text += Server.MapPath(&amp;quot;Master.xml&amp;quot;); &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum35&quot;&gt;  35:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;.DataBind(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum36&quot;&gt;  36:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum37&quot;&gt;  37:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt;(Exception ex) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum38&quot;&gt;  38:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum39&quot;&gt;  39:&lt;/span&gt; lblChange.Text = ex.Message; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum40&quot;&gt;  40:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum41&quot;&gt;  41:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;!&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;DOCTYPE&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;HTML&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;PUBLIC&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;quot;-//W3C//DTD HTML 4.0 Transitional//EN&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;Cache Dependency Tester&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;title&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Microsoft Visual Studio 7.0&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;GENERATOR&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;C#&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;CODE_LANGUAGE&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;JavaScript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;vs_defaultClientScript&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;meta&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;content&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;http://schemas.microsoft.com/intellisense/ie5&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;name&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;vs_targetSchema&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ms_positioning&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;GridLayout&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Form1&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;method&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;post&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:DataList&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;dlUsers&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Z-INDEX: 101; LEFT: 44px; POSITION: absolute; TOP: 104px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;148px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;343px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;BorderWidth&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;1px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;GridLines&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Horizontal&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;CellPadding&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;4&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;BackColor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;White&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ForeColor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;BorderStyle&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;None&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;BorderColor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;#CCCCCC&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;SelectedItemStyle&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;font-bold&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;forecolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;White&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;backcolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;#CC3333&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;SelectedItemStyle&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;FooterStyle&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;forecolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Black&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;backcolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;#CCCC99&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;FooterStyle&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;HeaderStyle&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;font-bold&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;True&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;forecolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;White&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;backcolor&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;#333333&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;HeaderStyle&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; #DataBinder.Eval(Container.DataItem,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;UserId&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; #DataBinder.Eval(Container.DataItem,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;FirstName&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt; #DataBinder.Eval(Container.DataItem,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;LastName&amp;quot;&lt;/span&gt;)&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;%&amp;gt;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;ItemTemplate&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:DataList&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;lblChange&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Z-INDEX: 102; LEFT: 46px; POSITION: absolute; TOP: 63px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Height&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;28px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Width&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;295px&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Label&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Button&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;btnMaster&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;style&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Z-INDEX: 103; LEFT: 50px; POSITION: absolute; TOP: 293px&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;btnMaster_Click&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Refresh Master&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Button&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;      &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;  &lt;/div&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;We created the page that initiates and uses the Cache. For testing purpose we need another page that will overwrite this &amp;quot;Master.xml&amp;quot; on click of a button for which the code snippet is as follows. This ideally should be our master maintenance page that adds/updates Master records in database and overwrites the XML. But to make it easy I have just written an overwriting sample. &lt;br /&gt;    &lt;br /&gt;&lt;/font&gt;&lt;/p&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style=&quot;border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px&quot; id=&quot;codeSnippetWrapper&quot;&gt;&lt;br /&gt;  &lt;div style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot; id=&quot;codeSnippet&quot;&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; Trace=&amp;quot;true&amp;quot;%&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Data&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;background-color: #ffff00&quot;&gt;&amp;lt;%@ import Namespace=&amp;quot;System.Data.SqlClient&amp;quot; %&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum1&quot;&gt;   1:&lt;/span&gt;  &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum2&quot;&gt;   2:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; btnMaster_Click(Object sender, EventArgs e) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum3&quot;&gt;   3:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum4&quot;&gt;   4:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//Call save function &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum5&quot;&gt;   5:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;this&lt;/span&gt;.Save(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum6&quot;&gt;   6:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum7&quot;&gt;   7:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;void&lt;/span&gt; Save() &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum8&quot;&gt;   8:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum9&quot;&gt;   9:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;try&lt;/span&gt; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum10&quot;&gt;  10:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum11&quot;&gt;  11:&lt;/span&gt; SqlConnection cn; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum12&quot;&gt;  12:&lt;/span&gt; DataSet dsUsers = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; DataSet(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Users&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum13&quot;&gt;  13:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//I have used this to get the Connectionstring from the &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum14&quot;&gt;  14:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//Configuration file. &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum15&quot;&gt;  15:&lt;/span&gt; cn = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; SqlConnection(ConfigurationSettings.AppSettings.Get(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;conn&amp;quot;&lt;/span&gt;)); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum16&quot;&gt;  16:&lt;/span&gt; SqlDataAdapter daQualification; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum17&quot;&gt;  17:&lt;/span&gt; SqlDataAdapter daLocations; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum18&quot;&gt;  18:&lt;/span&gt; daQualification = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; SqlDataAdapter(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Select * from tblqualifications&amp;quot;&lt;/span&gt;,cn); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum19&quot;&gt;  19:&lt;/span&gt; daLocations = &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; SqlDataAdapter(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Select * from tblLocations&amp;quot;&lt;/span&gt;,cn); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum20&quot;&gt;  20:&lt;/span&gt; cn.Open(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum21&quot;&gt;  21:&lt;/span&gt; daQualification.Fill(dsUsers,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;tblqualifications&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum22&quot;&gt;  22:&lt;/span&gt; daLocations.Fill(dsUsers,&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;tblLocations&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum23&quot;&gt;  23:&lt;/span&gt; HttpContext.Current.Trace.Write(&lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Masters data up..&amp;quot;&lt;/span&gt;); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum24&quot;&gt;  24:&lt;/span&gt; &lt;span style=&quot;color: #008000&quot;&gt;//Overwrite the XML file. Also please read MSDN on the overloaded parameters for WriteXml &lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum25&quot;&gt;  25:&lt;/span&gt; dsUsers.WriteXml(HttpContext.Current.Server.MapPath &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum26&quot;&gt;  26:&lt;/span&gt; &lt;span style=&quot;color: #006080&quot;&gt;&amp;quot;Master.xml&amp;quot;&lt;/span&gt;),XmlWriteMode.WriteSchema); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum27&quot;&gt;  27:&lt;/span&gt; cn.Close(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum28&quot;&gt;  28:&lt;/span&gt; cn.Dispose(); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum29&quot;&gt;  29:&lt;/span&gt;&amp;#160; &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum30&quot;&gt;  30:&lt;/span&gt; Technorati Tags: Asp.net,Caching,C#&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum31&quot;&gt;  31:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum32&quot;&gt;  32:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;catch&lt;/span&gt;(Exception ex) &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum33&quot;&gt;  33:&lt;/span&gt; { &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum34&quot;&gt;  34:&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;throw&lt;/span&gt; &lt;span style=&quot;color: #0000ff&quot;&gt;new&lt;/span&gt; Exception(ex.Message); &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum35&quot;&gt;  35:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #606060&quot; id=&quot;lnum36&quot;&gt;  36:&lt;/span&gt; } &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;script&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;head&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;ID&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Form1&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tbody&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;label&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;lblRefresh&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;Rewrite the XML File by clicking the buttonbelow.&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;label&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;align&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;middle&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Button&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;id&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;btnMaster&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;onclick&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;btnMaster_Click&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000&quot;&gt;runat&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;server&amp;quot;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #ff0000&quot;&gt;Text&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;=&amp;quot;Write XML&amp;quot;&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;asp:Button&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;td&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tr&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;tbody&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;table&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;span&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;form&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;body&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;br /&gt;&lt;br /&gt;    &lt;pre style=&quot;border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px&quot;&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span style=&quot;color: #800000&quot;&gt;html&lt;/span&gt;&lt;span style=&quot;color: #0000ff&quot;&gt;&amp;gt;&lt;/span&gt; &lt;/pre&gt;&lt;br /&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p align=&quot;justify&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Now once you have created the above pages i.e. one that implements caching and other that overwrites the dependency file, create two instance of browser and open the cache implementation page and note for trace, label text; open the other instance of browser with the page which overwrites the XML. Note the former, the first time it fetches data from the database and the subsequent request will be from cache till your expiration time of 45 seconds is reached or anyone overwrites or changes the &amp;quot;Master.xml&amp;quot; file. Also give a look on Timespan parameter since you have a concept of Sliding expiration that can also be implemented. Keep refreshing the first page and you will see that trace indicates the cached page retrieval. Click the overwrite XML button on the latter page that would overwrite the XML and again refresh the former page to note that the data is retrieved from database. Though in this example I have not shown any direct relation between the cached data and the dependency file (like get values from dependency file and merge with cached object etc) in terms of integrated usage, this could very easily be designed and implemented. Dependency caching is a powerful technique that .NET supports and should be utilized wherever applicable. &lt;/font&gt;&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/04/what-is-caching-caching-is-one-of-least.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-8836122501825063050</guid><pubDate>Wed, 13 Apr 2011 07:29:00 +0000</pubDate><atom:updated>2011-04-13T00:59:01.186-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Block or Disable Cut, Copy and Paste operation in ASP.Net</title><description>&lt;h5&gt;&amp;#160;&lt;/h5&gt;  &lt;h5&gt;   &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:99073c14-7deb-48bc-837f-bd1cbe4651ef&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tags/Block&quot; rel=&quot;tag&quot;&gt;Block&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Disable+Cut&quot; rel=&quot;tag&quot;&gt;Disable Cut&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Copy&quot; rel=&quot;tag&quot;&gt;Copy&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/Paste+operation+in+ASP.Net&quot; rel=&quot;tag&quot;&gt;Paste operation in ASP.Net&lt;/a&gt;&lt;/div&gt; &lt;/h5&gt;  &lt;h5&gt;Block or Disable Cut, Copy and Paste operation in ASP.Net TextBox Using jQuery&lt;/h5&gt;  &lt;p&gt;It is required to block the cut, copy and paste operations on some of the textbox in an ASP.Net. For example, it will be better if we do not allow users to copy paste the data entered in Email and Confirm Email field in order to make the user to type themselves.&lt;/p&gt;  &lt;p&gt;The below jQuery code will help us to do the same using preventDefault() method.&lt;/p&gt;  &lt;p&gt;&amp;lt;script src=&amp;quot;_scripts/jquery-1.4.1.min.js&amp;quot; type=&amp;quot;text/javascript&amp;quot;&amp;gt;&amp;lt;/script&amp;gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;script type=&amp;quot;text/javascript&amp;quot;&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(function() {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; $(&amp;quot;#&amp;lt;% =txtEmail.ClientID %&amp;gt;,#&amp;lt;% =txtConfirmEmail.ClientID%&amp;gt;&amp;quot;).bind(&amp;quot;cut copy paste&amp;quot;, function(event) {    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; event.preventDefault();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; });    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; });    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/script&amp;gt;    &lt;br /&gt;&amp;lt;/head&amp;gt;    &lt;br /&gt;&amp;lt;body&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;div&amp;gt;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;b&amp;gt;Email &amp;lt;/b&amp;gt;&amp;lt;asp:TextBox ID=&amp;quot;txtEmail&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&amp;lt;br /&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;b&amp;gt;Confirm Email &amp;lt;/b&amp;gt;&amp;lt;asp:TextBox ID=&amp;quot;txtConfirmEmail&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;font size=&quot;4&quot;&gt;Block Right Click in asp.net &lt;/font&gt;&lt;/strong&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;If you want to block right click copy code in master page.&lt;/p&gt;  &lt;p&gt;&amp;lt;SCRIPT language=JavaScript&amp;gt;   &lt;br /&gt;&amp;lt;!--&amp;#160; --&amp;gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; var message = &amp;quot;function disabled&amp;quot;;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; function rtclickcheck(keyp){ if (navigator.appName == &amp;quot;Netscape&amp;quot; &amp;amp;&amp;amp; keyp.which == 3){&amp;#160;&amp;#160;&amp;#160;&amp;#160; alert(message); return false; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; if (navigator.appVersion.indexOf(&amp;quot;MSIE&amp;quot;) != -1 &amp;amp;&amp;amp; event.button == 2) {&amp;#160;&amp;#160;&amp;#160;&amp;#160; alert(message);&amp;#160;&amp;#160;&amp;#160;&amp;#160; return false; } }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; document.onmousedown = rtclickcheck;    &lt;br /&gt;&amp;lt;/SCRIPT&amp;gt;&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/04/how-to-copy-datarows-between-datatables.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-6357933703869486239</guid><pubDate>Thu, 24 Feb 2011 14:31:00 +0000</pubDate><atom:updated>2011-02-24T06:33:35.343-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>Filtering or Searching in Listbox Item Using JavaScript</title><description>&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:863c078b-0304-46d1-9d7c-2b4e0b05ce8c&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Filtering+or+Searching+in+Listbox+Item+Using+JavaScript&quot; rel=&quot;tag&quot;&gt;Filtering or Searching in Listbox Item Using JavaScript&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Filtering&quot; rel=&quot;tag&quot;&gt;Filtering&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Searching&quot; rel=&quot;tag&quot;&gt;Searching&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Listbox+Item&quot; rel=&quot;tag&quot;&gt;Listbox Item&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Using+JavaScript&quot; rel=&quot;tag&quot;&gt;Using JavaScript&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Normally you have a requirement that user want to search or filtering record in a list box according to what he write in textbox.So in my pervious posted &lt;/font&gt;&lt;a href=&quot;http://dotnetfarrukhabbas.blogspot.com/2011/01/search-listbox-items-using-javascript.html&quot; target=&quot;_blank&quot;&gt;&lt;u&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;Search ListBox items using JavaScript&lt;/font&gt;&lt;/u&gt;&lt;/a&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;.I explained how to search in listbox but there is one restriction when user want to search, it will select only one record and user can not see the other records related to searching criteria.So in this post I explain how to implement this thing if you have that kind or requirement. &lt;/font&gt;&lt;/p&gt; &lt;p&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;First you write JavaScript code on html page. &lt;/font&gt;&lt;/p&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;script type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt; language=&lt;span class=&quot;str&quot;&gt;&quot;javascript&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;var ddlText, ddlValue, ddl, lblMesg;&lt;br /&gt;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;function CacheItems() {&lt;br /&gt;&lt;br /&gt;ddlText = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Array();&lt;br /&gt;ddlValue = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; Array();&lt;br /&gt;ddl = document.getElementById(&lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;%=ListBox1.ClientID %&amp;gt;&quot;&lt;/span&gt;);&lt;br /&gt;lblMesg = document.getElementById(&lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;%=lblMessage.ClientID%&amp;gt;&quot;&lt;/span&gt;);&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (var i = 0; i &amp;lt; ddl.options.length; i++) {&lt;br /&gt;ddlText[ddlText.length] = ddl.options[i].text;&lt;br /&gt;ddlValue[ddlValue.length] = ddl.options[i].&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;window.onload = CacheItems;&lt;br /&gt;&lt;br /&gt;function FilterItems(&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) {&lt;br /&gt;        ddl.options.length = 0;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;for&lt;/span&gt; (var i = 0; i &amp;lt; ddlText.length; i++) {&lt;br /&gt;&lt;br /&gt;            &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (ddlText[i].toLowerCase().indexOf(&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) != -1) {&lt;br /&gt;&lt;br /&gt;                AddItem(ddlText[i], ddlValue[i]);&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        lblMesg.innerHTML = ddl.options.length + &lt;span class=&quot;str&quot;&gt;&quot; items found.&quot;&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (ddl.options.length == 0) {&lt;br /&gt;&lt;br /&gt;            AddItem(&lt;span class=&quot;str&quot;&gt;&quot;No items found.&quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&quot;&quot;&lt;/span&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;    function AddItem(text, &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;) {&lt;br /&gt;&lt;br /&gt;        var opt = document.createElement(&lt;span class=&quot;str&quot;&gt;&quot;option&quot;&lt;/span&gt;);&lt;br /&gt;&lt;br /&gt;        opt.text = text;&lt;br /&gt;&lt;br /&gt;        opt.&lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt; = &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;;&lt;br /&gt;&lt;br /&gt;        ddl.options.add(opt);&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;The above three JavaScript methods take care of the Filtering and Searching process. The significance of the these methods is described below&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;1. CacheItems&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;This method is called on the &lt;strong&gt;window onload&lt;/strong&gt; event. The job of this method is to populate text and value arrays that will be used to cache the List box items.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;2. FilterItems&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;This method is called when &lt;strong&gt;keyup&lt;/strong&gt; event fires in the Search TextBox. This method searches for the string segment and filters the Listbox items.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;3. AddItem&lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style=&quot;line-height: normal; margin: 0in 0in 0pt&quot; class=&quot;MsoNormal&quot;&gt;&lt;span style=&quot;font-family: arial, san-serif; font-size: 10pt&quot;&gt;&lt;span&gt;This method as the name suggests adds a new item to the Listbox&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;&lt;br /&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt;font-size: small;&lt;br /&gt;color: black;&lt;br /&gt;font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt;background-color: #ffffff;&lt;br /&gt;/*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt;background-color: #f4f4f4;&lt;br /&gt;width: 100%;&lt;br /&gt;margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;form&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;form1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:TextBox&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;TextBox1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;onkeyup&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;FilterItems(this.value)&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;br&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;/&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListBox&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;ListBox1&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Height&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;150px&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Width&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;250px&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Vincent&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Jennifer&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Shynne&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Christian&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Helen&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Vladi&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Bee&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Jerome&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Vinz&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Churchill&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Rod&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;Mark&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListItem&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:ListBox&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Label&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;ID&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;lblMessage&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;runat&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;server&quot;&lt;/span&gt; &lt;span class=&quot;attr&quot;&gt;Text&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;=&quot;&quot;&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;asp:Label&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;form&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;body&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;lt;/&lt;/span&gt;&lt;span class=&quot;html&quot;&gt;html&lt;/span&gt;&lt;span class=&quot;kwrd&quot;&gt;&amp;gt;&lt;/span&gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;font face=&quot;Arial&quot;&gt;The JavaScript function basically searches the ListBox items and find the items based from the value of the TextBox that was entered. &lt;/font&gt;&lt;font face=&quot;Arial&quot;&gt;If a keyword exist from the list then it will &lt;/font&gt;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;font face=&quot;Arial&quot;&gt;automatically select the ListItems in the ListBox, but if the keyword does not exist then it will clear the ListBox selection.&lt;/font&gt;&lt;span style=&quot;font-size: x-small&quot;&gt;&lt;font size=&quot;2&quot; face=&quot;Arial&quot;&gt;While the label will display the status message to the user&lt;/font&gt;&lt;/span&gt;&lt;/pre&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/02/filtering-or-searching-in-listbox-item.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-2261864069649879308</guid><pubDate>Fri, 04 Feb 2011 12:35:00 +0000</pubDate><atom:updated>2011-02-04T04:35:38.761-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Avoid Multiple Form Submits</title><description>&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:a5b8ea24-2f44-4806-a0d0-8dab0c2a03a0&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Avoid+Multiple+Form+Submits&quot; rel=&quot;tag&quot;&gt;Avoid Multiple Form Submits&lt;/a&gt;&lt;/div&gt; &lt;h5&gt;&amp;nbsp;&lt;/h5&gt; &lt;h5&gt;Multiple form submits is a serious issue in web applications because it’ll result in unexpected behavior like multiple entries in database .I have spent some time for the same in Google and I got some solutions for that.&lt;br&gt;If you are submitting the page only once then you can use,&lt;/h5&gt;&lt;pre&gt;&amp;lt;form onsubmit=&quot;return Submit();&quot;&amp;gt;&lt;/pre&gt;And the method is like,&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;csharpcode&quot;&gt;&lt;pre class=&quot;alt&quot;&gt;&amp;lt;script type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;kwrd&quot;&gt;var&lt;/span&gt; flag = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;function&lt;/span&gt; Submit() {&lt;/pre&gt;&lt;pre&gt;&lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (flag) {&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; {&lt;/pre&gt;&lt;pre&gt;flag = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt;}&lt;/pre&gt;&lt;pre&gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;pre class=&quot;alt&quot;&gt; &lt;/pre&gt;&lt;/div&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;For a single button you can use,&lt;pre class=&quot;csharpcode&quot;&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;btnSubmit.Attributes[&lt;span class=&quot;str&quot;&gt;&quot;onclick&quot;&lt;/span&gt;] = &lt;span class=&quot;str&quot;&gt;&quot;this.disabled=true;&quot;&lt;/span&gt; + GetPostBackEventReference(btnSubmit);&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;For pages with update panels multiple submit is a serious issue as page is posting asynchronously or partially.In that scenario you can use Sys.WebForms.PageRequestManager for fixing the issue,&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;asp:ScriptManager ID=&lt;span class=&quot;str&quot;&gt;&quot;ScriptManager1&quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/asp:ScriptManager&amp;gt;&lt;br /&gt;&amp;lt;script type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequest);&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;function&lt;/span&gt; BeginRequest(sender, e) {&lt;br /&gt;e.get_postBackElement().disabled = &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/02/avoid-multiple-form-submits.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-5402882643334709786</guid><pubDate>Wed, 02 Feb 2011 05:56:00 +0000</pubDate><atom:updated>2011-02-01T21:56:32.526-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Auto-Refreshing ASP.NET Web Pages</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt; &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:bd30b6f8-8157-4869-87c3-94c001ccbc77&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Auto+Refershing&quot; rel=&quot;tag&quot;&gt;Auto Refershing&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Asp.net&quot; rel=&quot;tag&quot;&gt;Asp.net&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/refresh+a+web+page&quot; rel=&quot;tag&quot;&gt;refresh a web page&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Refresh+page+from+server+side&quot; rel=&quot;tag&quot;&gt;Refresh page from server side&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/auto+refersh+using+javascript&quot; rel=&quot;tag&quot;&gt;auto refersh using javascript&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Today I am writing about how you can auto-refresh the page without user click .If you want to refresh the page at specific time of interval like after each 10 seconds you can used any of the following methods.&lt;/p&gt; &lt;h3&gt;&lt;u&gt;HTML header refresh tag&lt;/u&gt;&lt;/h3&gt; &lt;p&gt;&amp;nbsp; &lt;ul&gt; &lt;p&gt;The most common and best known way to tag of the following format is placed in the HTML section of the page:&lt;/p&gt; &lt;p&gt;&amp;lt;meta http-equiv=&quot;refresh&quot; content=&quot; &lt;strong&gt;5&lt;/strong&gt;; url=&lt;a title=&quot;http://dotnetfarrukhabbas.blogspot.com/&quot; href=&quot;http://dotnetfarrukhabbas.blogspot.com/&quot;&gt;http://dotnetfarrukhabbas.blogspot.com/&lt;/a&gt;&quot;&amp;gt;&lt;/p&gt; &lt;ul&gt;&lt;/ul&gt; &lt;li&gt; &lt;p&gt;where &lt;strong&gt;&#39;5&lt;/strong&gt;&#39; refers to the number of seconds that will elapse before the page is refreshed; &lt;/p&gt; &lt;li&gt; &lt;p&gt;&#39;url&#39; is the new url redirect to. It can be excluded which means the current page will be reloaded.&lt;/p&gt;&lt;/li&gt;&lt;/ul&gt; &lt;ul&gt;&lt;/ul&gt; &lt;p&gt;This construct is useful if you have one or two pages which have to auto-refresh, and works for any HTML content type forms. &lt;/p&gt; &lt;p&gt;You can used this meta tag in master page as well as any specific page.&lt;/p&gt; &lt;p&gt;&amp;nbsp; &lt;h3&gt;&lt;u&gt;Using JavaScript &lt;/u&gt;&lt;/h3&gt; &lt;p&gt;You can also used the JavaScript for auto refreshing the page instead of meta tag.&lt;/p&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;script language=&lt;span class=&quot;str&quot;&gt;&quot;javascript&quot;&lt;/span&gt; type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt; &lt;br /&gt;&lt;br /&gt;        setTimeout(&lt;span class=&quot;str&quot;&gt;&quot;StratRefresh()&quot;&lt;/span&gt;, 30000);&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;function&lt;/span&gt; StratRefresh() {&lt;br /&gt;            window.location.reload();&lt;br /&gt;        } &lt;br /&gt;    &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;u&gt;Refresh Page from Server Side&lt;/u&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;ASP.NET provides the AppendHeader method to the Response object. Typically the page refresh can be set as follows in an ASP.NET webform (in C#):&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (!Page.IsPostBack)&lt;br /&gt;        {&lt;br /&gt;            &lt;span class=&quot;rem&quot;&gt;//page will be refereshed at a interval of 10 sec&lt;/span&gt;&lt;br /&gt;            Response.AddHeader(&lt;span class=&quot;str&quot;&gt;&quot;Refresh&quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&quot;10&quot;&lt;/span&gt;);&lt;br /&gt;        }&lt;br /&gt;    }&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;This construct is useful as it can be placed in a base webform OnLoad() or Page_Load() response method. All derived webforms will then have the same page refresh setting when they are loaded.&lt;/p&gt;&lt;br /&gt;&lt;h3&gt;&lt;u&gt;Note&amp;nbsp; &lt;/u&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;when the page gets refresh then it will not persist the view-state of the page.&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/02/auto-refreshing-aspnet-web-pages.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-8520678909117711943</guid><pubDate>Tue, 01 Feb 2011 17:48:00 +0000</pubDate><atom:updated>2017-04-15T22:26:48.243-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Database</category><title>Custom Paging And Sorting Using Oracle Stored Procedure.</title><description>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
  1194. &lt;br /&gt;
  1195. &lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:721946d1-c87c-4b60-9404-cb3a63bff24c&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  1196. Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Custom+Paging&quot; rel=&quot;tag&quot;&gt;Custom Paging&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Orcale+Stored+Procedure&quot; rel=&quot;tag&quot;&gt;Orcale Stored Procedure&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Dynamic+sorting&quot; rel=&quot;tag&quot;&gt;Dynamic sorting&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Dynamic+Paging&quot; rel=&quot;tag&quot;&gt;Dynamic Paging&lt;/a&gt;&lt;/div&gt;
  1197. &lt;br /&gt;
  1198. Here I will explain how to create Oracle stored procedure for custom paging,sorting and base on culture .Normally you should know how many record found in table base on where clause as well as required dynamic sorting and paging.All these things possible using dynamic creation of oracle stored procedure see this give below example. &lt;br /&gt;
  1199. &lt;br /&gt;
  1200. &lt;pre class=&quot;csharpcode&quot;&gt;&lt;/pre&gt;
  1201. &lt;br /&gt;
  1202. &lt;!-- HTML generated using hilite.me --&gt;&lt;br /&gt;
  1203. &lt;div style=&quot;background: #ffffff; border-width: 0.1em 0.1em 0.1em 0.8em; border: solid gray; overflow: auto; padding: 0.2em 0.6em; width: auto;&quot;&gt;
  1204. &lt;pre style=&quot;line-height: 125%; margin: 0;&quot;&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;CREATE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OR&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;REPLACE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;PROCEDURE&lt;/span&gt; GET_COUNTRY
  1205. (
  1206. &lt;span style=&quot;color: #333333;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #888888;&quot;&gt;-------- Table Paramerters--------------------------------&lt;/span&gt;
  1207. V_COUNTRY_NO &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.COUNTRY_NO&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1208. ,V_COUNTRY_NAME_AR &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_AR&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1209. ,V_COUNTRY_NAME_EN &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_EN&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1210. ,V_CREATED_BY &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.CREATED_BY&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1211. ,V_CREATED_ON &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.CREATED_ON&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1212. ,V_MODIFIED_BY &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.MODIFIED_BY&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1213. ,V_MODIFIED_ON &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.MODIFIED_ON&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1214. ,V_ISDELETED &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; TRN_ORG_SYS.COUNTRY.ISDELETED&lt;span style=&quot;color: #333333;&quot;&gt;%&lt;/span&gt;&lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;TYPE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1215.  
  1216. &lt;span style=&quot;color: #333333;&quot;&gt;//&lt;/span&gt;&lt;span style=&quot;color: #888888;&quot;&gt;-------- Parameters of Paging Sorting and culture------------&lt;/span&gt;
  1217. ,P_CULTURE &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; VARCHAR2 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1218. ,P_SORT_ORDER &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; VARCHAR2 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1219. ,P_SORT_FIELD &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; VARCHAR2 &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1220. ,P_PAGE_NO_NEEDED &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1221. ,P_NUM_PER_PAGE &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IN&lt;/span&gt; &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;DEFAULT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;
  1222. ,P_OUT_TOTAL_RECORDS &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OUT&lt;/span&gt; &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt;
  1223. ,ITEMS_CURSOR &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OUT&lt;/span&gt; TRN_ORG_PROC.REF_CURSOR.T_CURSOR
  1224. )
  1225. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt;
  1226. &lt;span style=&quot;color: #888888;&quot;&gt;--Local variables &amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&amp;gt;&lt;/span&gt;
  1227. SQL_SELECT &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;CLOB&lt;/span&gt;;
  1228. SQL_SELONE VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;4000&lt;/span&gt;);
  1229. SQL_SELTWO VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;4000&lt;/span&gt;);
  1230. SQL_COUNTONE VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;50&lt;/span&gt;) :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;SELECT COUNT(*) FROM ( &#39;&lt;/span&gt;;
  1231. SQL_COUNTTWO VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;50&lt;/span&gt;) :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;) &#39;&lt;/span&gt;;
  1232. SQL_ORDER_BY VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;100&lt;/span&gt;);
  1233. FROM_ROWNUM &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt;;
  1234. TO_ROWNUM &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt;;
  1235. V_NUM_PER_PAGE &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt; :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; P_NUM_PER_PAGE;
  1236. V_PAGE_NO_NEEDED &lt;span style=&quot;color: #007020;&quot;&gt;NUMBER&lt;/span&gt; :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; P_PAGE_NO_NEEDED;
  1237. V_SORT_FIELD VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;30&lt;/span&gt;);
  1238. V_SORT_ORDER VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;30&lt;/span&gt;);
  1239. NEWLINE VARCHAR2(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;10&lt;/span&gt;) :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; CHR(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;13&lt;/span&gt;) &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; CHR(&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;10&lt;/span&gt;);
  1240.  
  1241.  
  1242.  
  1243. &lt;span style=&quot;color: #888888;&quot;&gt;--Local variables &amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&amp;lt;&lt;/span&gt;
  1244. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;BEGIN&lt;/span&gt;
  1245. IF (V_NUM_PER_PAGE &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OR&lt;/span&gt; V_NUM_PER_PAGE &lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1246. V_NUM_PER_PAGE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;25&lt;/span&gt;;
  1247. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1248. IF (V_PAGE_NO_NEEDED &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OR&lt;/span&gt; V_PAGE_NO_NEEDED &lt;span style=&quot;color: #333333;&quot;&gt;&amp;lt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1249. V_PAGE_NO_NEEDED :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;;
  1250. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1251. IF (P_SORT_FIELD &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1252. V_SORT_FIELD :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; COUNTRY_NO&#39;&lt;/span&gt;;
  1253. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;ELSE&lt;/span&gt;
  1254. V_SORT_FIELD :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; P_SORT_FIELD;
  1255. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1256. IF (P_SORT_ORDER &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1257. V_SORT_ORDER :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;ASC&#39;&lt;/span&gt;;
  1258. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;ELSE&lt;/span&gt;
  1259. V_SORT_ORDER :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; P_SORT_ORDER;
  1260. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1261. &lt;span style=&quot;color: #888888;&quot;&gt;--&lt;/span&gt;
  1262. FROM_ROWNUM :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; ((V_PAGE_NO_NEEDED &lt;span style=&quot;color: #333333;&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;) &lt;span style=&quot;color: #333333;&quot;&gt;*&lt;/span&gt; V_NUM_PER_PAGE) &lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt;;
  1263. TO_ROWNUM :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; FROM_ROWNUM &lt;span style=&quot;color: #333333;&quot;&gt;-&lt;/span&gt;&lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;1&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;+&lt;/span&gt; V_NUM_PER_PAGE;
  1264. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;SELECT &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1265. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; b.* &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1266. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; FROM ( &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1267. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; SELECT &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1268. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; a.*, &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1269. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; ROWNUM rnum &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1270. SQL_SELONE :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; FROM ( &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1271. &lt;span style=&quot;color: #888888;&quot;&gt;--&lt;/span&gt;
  1272. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;SELECT TRN_ORG_SYS.COUNTRY.COUNTRY_NO, &lt;/span&gt;
  1273. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;DECODE(&#39;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; P_CULTURE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;&#39;&#39;&lt;/span&gt;&lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt;&lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;,&lt;/span&gt;
  1274. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;en-US&#39;&#39;,TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_EN ,&lt;/span&gt;
  1275. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;ar-KW&#39;&#39;,TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_AR,&lt;/span&gt;
  1276. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_EN) COUNTRY_NAME,&lt;/span&gt;
  1277. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_AR, &lt;/span&gt;
  1278. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.COUNTRY_NAME_EN, &lt;/span&gt;
  1279. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.CREATED_BY, &lt;/span&gt;
  1280. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.CREATED_ON, &lt;/span&gt;
  1281. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.MODIFIED_BY, &lt;/span&gt;
  1282. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.MODIFIED_ON, &lt;/span&gt;
  1283. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;TRN_ORG_SYS.COUNTRY.ISDELETED &lt;/span&gt;
  1284. &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;FROM TRN_ORG_SYS.COUNTRY&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1285. &lt;span style=&quot;color: #888888;&quot;&gt;--Construction of Where clause Starts here&lt;/span&gt;
  1286. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; WHERE 1 = 1 &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1287.  
  1288. IF(V_COUNTRY_NO &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;AND&lt;/span&gt; V_COUNTRY_NO &lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt; ) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1289. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.COUNTRY_NO = &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_COUNTRY_NO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1290. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1291. IF(V_COUNTRY_NAME_AR &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1292. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.COUNTRY_NAME_AR Like &#39;&#39;%&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_COUNTRY_NAME_AR &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;%&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1293. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1294. IF(V_COUNTRY_NAME_EN &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1295. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.COUNTRY_NAME_EN Like &#39;&#39;%&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_COUNTRY_NAME_EN &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;%&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1296. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1297. IF(V_CREATED_BY &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1298. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.CREATED_BY Like &#39;&#39;%&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_CREATED_BY &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;%&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1299. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1300. IF(V_CREATED_ON &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1301. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.CREATED_ON = &#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_CREATED_ON &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1302. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1303. IF(V_MODIFIED_BY &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1304. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.MODIFIED_BY Like &#39;&#39;%&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_MODIFIED_BY &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;%&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1305. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1306. IF(V_MODIFIED_ON &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1307. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.MODIFIED_ON = &#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_MODIFIED_ON &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1308. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1309. IF(V_ISDELETED &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IS&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NOT&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;AND&lt;/span&gt; V_ISDELETED &lt;span style=&quot;color: #333333;&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #0000dd; font-weight: bold;&quot;&gt;0&lt;/span&gt; ) &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1310. SQL_SELECT :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELECT &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; AND COUNTRY.ISDELETED = &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_ISDELETED &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1311. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; IF;
  1312. &lt;span style=&quot;color: #888888;&quot;&gt;--Construction of Where clause Ends here&lt;/span&gt;
  1313.  
  1314. SQL_ORDER_BY :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_ORDER_BY &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; ORDER BY lower(&#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_SORT_FIELD &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39;) &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; V_SORT_ORDER &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1315. &lt;span style=&quot;color: #888888;&quot;&gt;--&lt;/span&gt;
  1316. SQL_SELTWO :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; ) a &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1317. SQL_SELTWO :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; WHERE &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1318. SQL_SELTWO :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; ROWNUM &amp;lt;= :2) b &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE; &lt;span style=&quot;color: #888888;&quot;&gt;-- TO_ROWNUM&lt;/span&gt;
  1319. SQL_SELTWO :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; WHERE &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE;
  1320. SQL_SELTWO :&lt;span style=&quot;color: #333333;&quot;&gt;=&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; &lt;span style=&quot;background-color: #fff0f0;&quot;&gt;&#39; rnum &amp;gt;= :3 &#39;&lt;/span&gt; &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; NEWLINE; &lt;span style=&quot;color: #888888;&quot;&gt;-- FROM_ROWNUM&lt;/span&gt;
  1321. &lt;span style=&quot;color: #888888;&quot;&gt;--&lt;/span&gt;
  1322. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;EXECUTE&lt;/span&gt; &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;IMMEDIATE&lt;/span&gt; SQL_COUNTONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; TO_CHAR(SQL_SELECT) &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; SQL_COUNTTWO &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;INTO&lt;/span&gt; P_OUT_TOTAL_RECORDS;
  1323. &lt;span style=&quot;color: #888888;&quot;&gt;--&lt;/span&gt;
  1324. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;OPEN&lt;/span&gt; ITEMS_CURSOR &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;FOR&lt;/span&gt; SQL_SELONE &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; TO_CHAR(SQL_SELECT) &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; SQL_ORDER_BY &lt;span style=&quot;color: #333333;&quot;&gt;||&lt;/span&gt; SQL_SELTWO &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;USING&lt;/span&gt; TO_ROWNUM, FROM_ROWNUM;
  1325.  
  1326. EXCEPTION
  1327. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;WHEN&lt;/span&gt; NO_DATA_FOUND &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1328. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;NULL&lt;/span&gt;;
  1329. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;WHEN&lt;/span&gt; OTHERS &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;THEN&lt;/span&gt;
  1330. &lt;span style=&quot;color: #888888;&quot;&gt;-- Consider logging the error and then re-raise&lt;/span&gt;
  1331. RAISE;
  1332. &lt;span style=&quot;color: #008800; font-weight: bold;&quot;&gt;END&lt;/span&gt; GET_COUNTRY;
  1333. &lt;/pre&gt;
  1334. &lt;/div&gt;
  1335. &lt;br /&gt;
  1336. &lt;br /&gt;
  1337. Base on above example you can easily create oracle stored procedure for custom paging, sorting,total record found and base on culture.&lt;/div&gt;
  1338. </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/01/custom-paging-and-sorting-using-oracle.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1499242546208024015</guid><pubDate>Tue, 01 Feb 2011 08:31:00 +0000</pubDate><atom:updated>2011-02-01T00:31:07.746-08:00</atom:updated><title>call server side method from client side using script manager</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt; &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:34585503-59f8-460b-8f3b-fe41ddf3e7b6&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/call+server+side+method+from+client+side+using+script+manager&quot; rel=&quot;tag&quot;&gt;call server side method from client side using script manager&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/call+server+side+method+from+client+side&quot; rel=&quot;tag&quot;&gt;call server side method from client side&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;Hello friends. &lt;p&gt;I am going to share with you a concept to call server side method from client side using script manager. &lt;p&gt;&lt;b&gt;Step 1&lt;/b&gt; : Put ScriptManager on .ASPX page. &lt;p&gt;&lt;b&gt;Step 2&lt;/b&gt; : Set EnablePageMethods=&quot;True&quot; in ScriptManager. &lt;p&gt;&lt;b&gt;Step 3&lt;/b&gt; : Create one static method in server side that return some value. &lt;p&gt;&lt;b&gt;Step 4&lt;/b&gt; : Set WebMethod attribute to above the method. &lt;p&gt;&lt;b&gt;Step 5&lt;/b&gt; : Create one javascript&amp;nbsp; function and call server side method using PageMethods object and set callback method as argument. &lt;p&gt;&lt;b&gt;Step 6&lt;/b&gt; : Create callback method where you will be able to retrieve return parameter from server side method. &lt;p&gt;&lt;u&gt;&lt;b&gt;See following example code&lt;/b&gt;&lt;/u&gt; &lt;p&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;ScriptManager on the page.&lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;asp:ScriptManager ID=&lt;span class=&quot;str&quot;&gt;&quot;ScriptManager1&quot;&lt;/span&gt;  EnablePageMethods=&lt;span class=&quot;str&quot;&gt;&quot;true&quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;&amp;lt;/asp:ScriptManager&amp;gt; &lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;i&gt;&lt;u&gt;&lt;b&gt;My server side static method &lt;/b&gt;&lt;/u&gt;&lt;/i&gt;&lt;pre class=&quot;csharpcode&quot;&gt;[System.Web.Services.WebMethod]&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;static&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; Sum(&lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; value1, &lt;span class=&quot;kwrd&quot;&gt;int&lt;/span&gt; value2)&lt;br /&gt;{&lt;br /&gt;        &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; value1 + value2;&lt;br /&gt;} &lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;u&gt;&lt;i&gt;&lt;b&gt;My javascript function to call server side method and retrieve result from server side&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;script language=&lt;span class=&quot;str&quot;&gt;&quot;javascript&quot;&lt;/span&gt; type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;        pageMethodConcept={&lt;br /&gt;            callServerSideMethod:function(){&lt;br /&gt;                PageMethods.Sum(3,4,pageMethodConcept.callback);&lt;br /&gt;&lt;br /&gt;                &lt;span class=&quot;rem&quot;&gt;// I am passing 3 and 4 to get sum and set callback method&lt;/span&gt;&lt;br /&gt;            },&lt;br /&gt;            callback:function(result){&lt;br /&gt;                alert(result);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        window.onload=pageMethodConcept.callServerSideMethod;&lt;br /&gt;&amp;lt;/script&amp;gt; &lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/02/call-server-side-method-from-client.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-1473213912221638635</guid><pubDate>Mon, 31 Jan 2011 05:28:00 +0000</pubDate><atom:updated>2011-01-30T21:28:38.791-08:00</atom:updated><title>Edit code when your ASP.NET Development Server is running</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt; &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:9a75349b-e72c-4ca3-9ff6-f9f60a47e2bd&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Flickr Tags: &lt;a href=&quot;http://flickr.com/photos/tags/Edit+Code+in+Asp.net&quot; rel=&quot;tag&quot;&gt;Edit Code in Asp.net&lt;/a&gt;,&lt;a href=&quot;http://flickr.com/photos/tags/Edit+code+on+runtime+in+Asp.net&quot; rel=&quot;tag&quot;&gt;Edit code on runtime in Asp.net&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Lot of people trying to edit the code when ASP.NET Development Server is running but they can&#39;t. In order to edit code you have to stop debugger/ ASP.NET&amp;nbsp; Development server then you can edit it. &lt;p&gt;If you want to continue code edit while your are running ASP.NET Development Server try this:  &lt;p&gt;&lt;strong&gt;http://localhost:3499/Default.aspx&lt;/strong&gt; &lt;p&gt;You do have the option to control which port is used when using the built-in development server.&amp;nbsp; The steps to specify the port to be used are slightly different depending on whether you are using a website project or a web application project. &lt;p&gt;&lt;strong&gt;ASP.NET Development Server - Web Application project&lt;em&gt; &lt;/em&gt;&lt;/strong&gt; &lt;ol&gt; &lt;li&gt; &lt;p&gt;Right click the Project in the Solution Explorer, and then select “Properties” &lt;/p&gt; &lt;li&gt; &lt;p&gt;Click “Web” tab. &lt;/p&gt; &lt;li&gt; &lt;p&gt;Go to Server section (Make sure Visual Studio Development server is selected)&lt;/p&gt; &lt;li&gt;Check Enable Edit and Continue is turned on&lt;/li&gt;&lt;/ol&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/01/edit-code-when-your-aspnet-development.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>1</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-5321886865350627794</guid><pubDate>Wed, 26 Jan 2011 05:54:00 +0000</pubDate><atom:updated>2011-01-25T21:54:21.342-08:00</atom:updated><title>Encrypting and Decrypting web.config Information</title><description>&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:cfa36264-e824-422c-be8a-063ed2b19bd9&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;LiveJournal Tags: &lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Encryption+Decryption+Web.config+file&quot; rel=&quot;tag&quot;&gt;Encryption Decryption Web.config file&lt;/a&gt;,&lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Encryption&quot; rel=&quot;tag&quot;&gt;Encryption&lt;/a&gt;,&lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Decryption&quot; rel=&quot;tag&quot;&gt;Decryption&lt;/a&gt;,&lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Web.config&quot; rel=&quot;tag&quot;&gt;Web.config&lt;/a&gt;&lt;/div&gt; &lt;p&gt;The most sensitive information stored in web.config file can be the connection string. You do not want to disclose the information related to your database to all the users where the application is deployed. Every time it is not possible to have a private machine for your sites, you may need to deploy the site in shared host environment. In this situation to maintain the security to encrypt and decrypt the web.config file.&lt;/p&gt; &lt;p&gt;We can encrypt the configuration sections by using two built-in providers: DPAPI (Windows Data Protection API) Provider or the RSA provider. The RSA provider (default) uses an RSA key which holds public and private keys, where as the DPAPI provider uses built-in machine-specific key. Let us explore the steps required to encrypt the sections using RSA.&lt;/p&gt; &lt;p&gt;There is two method for encryption and decryption of web.config file.One through asp.net command line and second through programmatically. &lt;/p&gt; &lt;h1&gt;Method # 1:&lt;/h1&gt; &lt;h3&gt;&lt;u&gt;&lt;/u&gt;&amp;nbsp;&lt;/h3&gt; &lt;h3&gt;&lt;u&gt;Encryption&lt;/u&gt;&lt;/h3&gt; &lt;p&gt;&amp;nbsp; ASP.NET 2.0 provides in built functionality to encrypt few sections of web.config file. The task can be completed using Aspnet_regiis.exe. Below is the web.config file and &amp;lt;connectionStrings&amp;gt; section.&amp;nbsp;&amp;nbsp; &lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;?xml version=&lt;span class=&quot;str&quot;&gt;&quot;1.0&quot;&lt;/span&gt;?&amp;gt;&lt;br /&gt;&amp;lt;configuration xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://schemas.microsoft.com/.NetConfiguration/v2.0&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;   &amp;lt;connectionStrings&amp;gt;&lt;br /&gt;      &amp;lt;add name=&lt;span class=&quot;str&quot;&gt;&quot;MembershipConnectionString&quot;&lt;/span&gt; connectionString=&lt;span class=&quot;str&quot;&gt;&quot;connectionString&quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;   &amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;   &amp;lt;system.web&amp;gt;&lt;br /&gt;      &amp;lt;compilation debug=&lt;span class=&quot;str&quot;&gt;&quot;true&quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;authentication mode=&lt;span class=&quot;str&quot;&gt;&quot;Forms&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;   &amp;lt;/system.web&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;p&gt;In this method for encrypting and decryption of web.config does not involve any code, instead is based on the command line tool &lt;strong&gt;aspnet_regiis&lt;/strong&gt;.&lt;br /&gt;&lt;p&gt;This command line tool can be found within the %windows%\Microsoft.NET\Framework\versionNumber folder, or can be run directly from the Visual Studio command prompt.&lt;pre class=&quot;csharpcode&quot;&gt;aspnet_regiis.exe -pef “connectionStrings” C:\Projects\DemoApplication&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;-pef&lt;/strong&gt; indicates that the application is built as File System website.&amp;nbsp; The second argument is the name of configuration section needs to be encrypted. Third argument is the physical path where the web.config file is located. &lt;br /&gt;&lt;p&gt;If you are using IIS base web site the command will be,&lt;pre class=&quot;csharpcode&quot;&gt; aspnet_regiis.exe -pe “connectionStrings” -app “/DemoApplication”&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt; -pe&lt;/strong&gt; indicates that the application is built as IIS based site. The second argument is the name of configuration section needs to be encrypted. Third argument “-app” indicates virtual directory and last argument is the name of virtual directory where application is deployed.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;p&gt;&amp;nbsp;&amp;nbsp; If everything goes well you will receive a message “&lt;strong&gt;Encrypting configuration section…&lt;/strong&gt;&lt;strong&gt;Succeeded!”&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;Open your web.config file and you can see that connection string is encrypted and its look like this.&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;?xml version=&lt;span class=&quot;str&quot;&gt;&quot;1.0&quot;&lt;/span&gt;?&amp;gt;&lt;br /&gt;&amp;lt;configuration xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://schemas.microsoft.com/.NetConfiguration/v2.0&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;   &amp;lt;connectionStrings configProtectionProvider=&lt;span class=&quot;str&quot;&gt;&quot;DataProtectionConfigurationProvider&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;EncryptedData&amp;gt;&lt;br /&gt;         &amp;lt;CipherData&amp;gt;&lt;br /&gt;            &amp;lt;CipherValue&amp;gt;AQAAANCMnd8BFdERjHoAwE/Cl+sBAAAAed...GicAlQ==&amp;lt;/CipherValue&amp;gt;&lt;br /&gt;         &amp;lt;/CipherData&amp;gt;&lt;br /&gt;      &amp;lt;/EncryptedData&amp;gt;&lt;br /&gt;   &amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;&lt;br /&gt;   &amp;lt;system.web&amp;gt;&lt;br /&gt;      &amp;lt;compilation debug=&lt;span class=&quot;str&quot;&gt;&quot;true&quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;authentication mode=&lt;span class=&quot;str&quot;&gt;&quot;Forms&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;   &amp;lt;/system.web&amp;gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;h3&gt;&lt;u&gt;Decryption:&lt;/u&gt;&lt;/h3&gt;&lt;br /&gt;&lt;p&gt;Now to decrypt the configuration section in web.config file use following command,&lt;br /&gt;&lt;p&gt;For File System Application,&lt;pre class=&quot;csharpcode&quot;&gt;aspnet_regiis.exe -pdf “connectionStrings” C:\Projects\DemoApplication&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;For IIS based Application&lt;pre class=&quot;csharpcode&quot;&gt;aspnet_regiis.exe -pd “connectionStrings” -app “/DemoApplication”&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;&lt;/strong&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; If you want to encrypt any nested section in web.config file like &amp;lt;pages&amp;gt; element within &amp;lt;system.web&amp;gt; you need to write full section name as shown below,&lt;pre class=&quot;csharpcode&quot;&gt;aspnet_regiis.exe -pef “system.web/Pages” C:\Projects\DemoApplication&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;h1&gt;Method # 2:&lt;/h1&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;Step 1:&lt;/b&gt; Open Visual Studio &amp;gt; File &amp;gt; WebSite &amp;gt; Select the language (C# or Visual Basic) and location to create a new ASP.NET website. &lt;br /&gt;&lt;p&gt;&lt;b&gt;Step 2:&lt;/b&gt; Now add a web.config file to the project. Right click the project &amp;gt; Add New Item &amp;gt; Web Configuration File&lt;br /&gt;&lt;p&gt;Open the web.config and add the following sample entries in the file between the &amp;lt;configuration&amp;gt; tag as shown below:&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;configuration&amp;gt;&lt;br /&gt;      &amp;lt;appSettings&amp;gt;&lt;br /&gt;            &amp;lt;add key=&lt;span class=&quot;str&quot;&gt;&quot;var1&quot;&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;value&lt;/span&gt;=&lt;span class=&quot;str&quot;&gt;&quot;SomeValue&quot;&lt;/span&gt;/&amp;gt;&lt;br /&gt;      &amp;lt;/appSettings&amp;gt;&lt;br /&gt;      &amp;lt;connectionStrings&amp;gt;&lt;br /&gt; &amp;lt;add name=&lt;span class=&quot;str&quot;&gt;&quot;MyConnString&quot;&lt;/span&gt; connectionString=&lt;span class=&quot;str&quot;&gt;&quot;Data Source=(local);Initial Catalog=Northwind;Integrated Security=True;&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt; &amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;&lt;br /&gt;      &amp;lt;system.web&amp;gt;...&lt;br /&gt;&lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;Step 3:&lt;/b&gt; Now add two buttons to the page, called btnEncrypt and btnDecrypt. We will use these buttons to encrypt and decrypt the sections of the web.config file. Add the following code in the button click event of the two buttons: &lt;br /&gt;&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;&lt;br /&gt;&lt;h2&gt;C#&lt;/h2&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; provider = &lt;span class=&quot;str&quot;&gt;&quot;RSAProtectedConfigurationProvider&quot;&lt;/span&gt;;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;string&lt;/span&gt; section = &lt;span class=&quot;str&quot;&gt;&quot;connectionStrings&quot;&lt;/span&gt;;&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnEncrypt_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    Configuration confg = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);&lt;br /&gt;    ConfigurationSection confStrSect = confg.GetSection(section);&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (confStrSect != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;)&lt;br /&gt;    {&lt;br /&gt;        confStrSect.SectionInformation.ProtectSection(provider);&lt;br /&gt;        confg.Save();&lt;br /&gt;    }&lt;br /&gt;    &lt;span class=&quot;rem&quot;&gt;// the encrypted section is automatically decrypted!!&lt;/span&gt;&lt;br /&gt;    Response.Write(&lt;span class=&quot;str&quot;&gt;&quot;Configuration Section &quot;&lt;/span&gt; + &lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;b&amp;gt;&quot;&lt;/span&gt; +&lt;br /&gt;        WebConfigurationManager.ConnectionStrings[&lt;span class=&quot;str&quot;&gt;&quot;MyConnString&quot;&lt;/span&gt;].ConnectionString + &lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;/b&amp;gt;&quot;&lt;/span&gt; + &lt;span class=&quot;str&quot;&gt;&quot; is automatically decrypted&quot;&lt;/span&gt;);&lt;br /&gt;}&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;{&lt;br /&gt;    &lt;br /&gt;}        &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; btnDecrypt_Click(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;try&lt;/span&gt;&lt;br /&gt;{&lt;br /&gt;    Configuration confg = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath);&lt;br /&gt;    ConfigurationSection confStrSect = confg.GetSection(section);&lt;br /&gt;    &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (confStrSect != &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt; &amp;amp;&amp;amp; confStrSect.SectionInformation.IsProtected)&lt;br /&gt;    {&lt;br /&gt;        confStrSect.SectionInformation.UnprotectSection();&lt;br /&gt;        confg.Save();&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;catch&lt;/span&gt; (Exception ex)&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;h2&gt;&lt;strong&gt;VB.NET&lt;/strong&gt;&lt;/h2&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;strong&gt;&lt;/strong&gt;&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; provider &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt; = &lt;span class=&quot;str&quot;&gt;&quot;RSAProtectedConfigurationProvider&quot;&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Private&lt;/span&gt; section &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;String&lt;/span&gt; = &lt;span class=&quot;str&quot;&gt;&quot;connectionStrings&quot;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; btnEncrypt_Click(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; EventArgs)&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; confg &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; confStrSect &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ConfigurationSection = confg.GetSection(section)&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Not&lt;/span&gt; confStrSect &lt;span class=&quot;kwrd&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;&lt;br /&gt;            confStrSect.SectionInformation.ProtectSection(provider)&lt;br /&gt;            confg.Save()&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;rem&quot;&gt;&#39; the encrypted section is automatically decrypted!!&lt;/span&gt;&lt;br /&gt;      Response.Write(&lt;span class=&quot;str&quot;&gt;&quot;Configuration Section &quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;b&amp;gt;&quot;&lt;/span&gt; &amp;amp; WebConfigurationManager.ConnectionStrings(&lt;span class=&quot;str&quot;&gt;&quot;MyConnString&quot;&lt;/span&gt;).ConnectionString &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot;&amp;lt;/b&amp;gt;&quot;&lt;/span&gt; &amp;amp; &lt;span class=&quot;str&quot;&gt;&quot; is automatically decrypted&quot;&lt;/span&gt;)&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Sub&lt;/span&gt; btnDecrypt_Click(&lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Object&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; EventArgs)&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; confg &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Configuration = WebConfigurationManager.OpenWebConfiguration(Request.ApplicationPath)&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;Dim&lt;/span&gt; confStrSect &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; ConfigurationSection = confg.GetSection(section)&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Not&lt;/span&gt; confStrSect &lt;span class=&quot;kwrd&quot;&gt;Is&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Nothing&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;AndAlso&lt;/span&gt; confStrSect.SectionInformation.IsProtected &lt;span class=&quot;kwrd&quot;&gt;Then&lt;/span&gt;&lt;br /&gt;            confStrSect.SectionInformation.UnprotectSection()&lt;br /&gt;            confg.Save()&lt;br /&gt;      &lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;If&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;Catch&lt;/span&gt; ex &lt;span class=&quot;kwrd&quot;&gt;As&lt;/span&gt; Exception&lt;br /&gt; &lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;Try&lt;/span&gt;&lt;br /&gt;&lt;span class=&quot;kwrd&quot;&gt;End&lt;/span&gt; Sub&lt;/pre&gt;&lt;br /&gt;&lt;p&gt;In the code above, we open the web.config file as a System.Configuration.Configuration object using the specified virtual path. We then call the GetSection() to retrieve the specified ConfigurationSection object, in our case connectionStrings. The ConfigurationSection.SectionInformation property gets us the SectionInformation object, and then we finally call the ProtectSection() method on the SectionInformation object to mark the section for protection.&lt;br /&gt;&lt;p&gt;Similarly while decrypting the section, we call the UnprotectSection() method of the SectionInformation object.&lt;br /&gt;&lt;p&gt;&lt;b&gt;Step 4:&lt;/b&gt; Now run the application and click on the Encrypt button. Now close the application &amp;gt; Open the web.config file. You will observe that the &amp;lt;connectionString&amp;gt; has been encrypted in the following manner:&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;connectionStrings configProtectionProvider=&lt;span class=&quot;str&quot;&gt;&quot;RsaProtectedConfigurationProvider&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt; &amp;lt;EncryptedData Type=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2001/04/xmlenc#Element&quot;&lt;/span&gt;&lt;br /&gt;   xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2001/04/xmlenc#&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;   &amp;lt;EncryptionMethod Algorithm=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2001/04/xmlenc#tripledes-cbc&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;   &amp;lt;KeyInfo xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2000/09/xmldsig#&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;    &amp;lt;EncryptedKey xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2001/04/xmlenc#&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;     &amp;lt;EncryptionMethod Algorithm=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2001/04/xmlenc#rsa-1_5&quot;&lt;/span&gt; /&amp;gt;&lt;br /&gt;     &amp;lt;KeyInfo xmlns=&lt;span class=&quot;str&quot;&gt;&quot;http://www.w3.org/2000/09/xmldsig#&quot;&lt;/span&gt;&amp;gt;&lt;br /&gt;      &amp;lt;KeyName&amp;gt;Rsa Key&amp;lt;/KeyName&amp;gt;&lt;br /&gt;     &amp;lt;/KeyInfo&amp;gt;&lt;br /&gt;     &amp;lt;CipherData&amp;gt;&lt;br /&gt;      &amp;lt;CipherValue&amp;gt;ZehN7B+VXBdJTe1X3NFz9Uz3NqxvjSMmbytLeHGNlZa4&lt;br /&gt;JkkpRkXzphm5sedHeMTk5KZCHxoYrJ4ssJ0OcZnzLxNUrAB9Ie3y8xJVWJ2s0RQ&lt;br /&gt;dmaGk5bSJADE1xKJBuOtDIOi/Ron7qJDWXwllC3v&lt;br /&gt;vmNwgabmJ9RU+RN35TOQpznc=&amp;lt;/CipherValue&amp;gt;&lt;br /&gt;     &amp;lt;/CipherData&amp;gt;&lt;br /&gt;    &amp;lt;/EncryptedKey&amp;gt;&lt;br /&gt;   &amp;lt;/KeyInfo&amp;gt;&lt;br /&gt;   &amp;lt;CipherData&amp;gt;&lt;br /&gt;    &amp;lt;CipherValue&amp;gt;q2amqNwjeyEbMxF5pZ3XqfboNUJKSml773mPkISGi6uWCWCDPs&lt;br /&gt;0ICClmH1eQYcsI9FlxFvEfyRyRRugqOU2xe+gd3aRZEZ5irpGFB45Fn6M+te7kg&lt;br /&gt;OeTK1gjGEsbeaNjBNwgpcXMh9RiA9xVOvWlLAyJ3u8DsDQ+4JmM/zTUtxer/8Dl&lt;br /&gt;UI7+u8D+9V4b5tWxShp4BToMFdTcefhMb19pGdn+jocGet&lt;br /&gt;WBJirO5CJsLXI=&amp;lt;/CipherValue&amp;gt;&lt;br /&gt;   &amp;lt;/CipherData&amp;gt;&lt;br /&gt; &amp;lt;/EncryptedData&amp;gt;&lt;br /&gt; &amp;lt;/connectionStrings&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If you are running this application from the file system, when you close the application, Visual Studio will display a dialog with the message of &quot;The file has been modified outside the editor. Do you want to reload it?&quot; Click yes and then view the web.config.&lt;br /&gt;&lt;p&gt;&lt;b&gt;Step 5:&lt;/b&gt; Run the application again and now click on the Decrypt button. You will observe that the &amp;lt;connectionStrings&amp;gt; section is no longer encrypted and can be read as plain text.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Take a note that &#39;section groups&#39; like &amp;lt;system.net&amp;gt;, &amp;lt;mailSettings&amp;gt; etc. cannot be encrypted through programmatically . &lt;br /&gt;&lt;p&gt;You can encrypt all the sections of web.config file except following using the method I displayed in this article,&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;processModel&amp;gt;&lt;br /&gt;&amp;lt;runtime&amp;gt;&lt;br /&gt;&amp;lt;mscorlib&amp;gt;&lt;br /&gt;&amp;lt;startup&amp;gt;&lt;br /&gt;&amp;lt;system.runtime.remoting&amp;gt;&lt;br /&gt;&amp;lt;configProtectedData&amp;gt;&lt;br /&gt;&amp;lt;satelliteassemblies&amp;gt;&lt;br /&gt;&amp;lt;cryptographySettings&amp;gt;&lt;br /&gt;&amp;lt;cryptoNameMapping&amp;gt;&lt;br /&gt;&amp;lt;cryptoClasses&amp;gt;&lt;/pre&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&amp;nbsp; To encrypt these section you needed to use Aspnet_setreg.exe tool.&lt;br /&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/01/encrypting-and-decrypting-webconfig.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>5</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-7203848901791516074</guid><pubDate>Tue, 25 Jan 2011 06:18:00 +0000</pubDate><atom:updated>2011-02-05T01:18:07.946-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><title>Clear Session On Browser Close</title><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:423a4523-bcde-4308-b648-063ea37ca2e4&quot; class=&quot;wlWriterSmartContent&quot;&gt;LiveJournal Tags: &lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Clear+Session+on+Browser+Closer&quot; rel=&quot;tag&quot;&gt;Clear Session on Browser Closer&lt;/a&gt;,&lt;a href=&quot;http://www.livejournal.com/interests.bml?int=Clear+Session+on+Page+Redirect&quot; rel=&quot;tag&quot;&gt;Clear Session on Page Redirect&lt;/a&gt;&lt;/div&gt; &lt;p&gt;How to capture logoff time when user closes browser?  &lt;p&gt;Or  &lt;p&gt;How to end user session when browser closed?  &lt;p&gt;Or  &lt;p&gt;How to end user session when user redirect to another sites.  &lt;p&gt;These are some of the frequently asked questions normally this is the requirement of any application.There is &lt;strong&gt;no&lt;/strong&gt; full-proof technique to catch the browser close event for 100% of time. The trouble lies in the stateless nature of HTTP.I am explain one of them which is very effective and tested.  &lt;p&gt;&amp;nbsp; &lt;h3&gt;1. First create a page LogOut.aspx and in Page_Load event write this code:-&lt;/h3&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;span class=&quot;kwrd&quot;&gt;protected&lt;/span&gt; &lt;span class=&quot;kwrd&quot;&gt;void&lt;/span&gt; Page_Load(&lt;span class=&quot;kwrd&quot;&gt;object&lt;/span&gt; sender, EventArgs e)&lt;br&gt;{&lt;br&gt;    Session.Abandon();&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;h3&gt;2. Then add following JavaScript code in your page or Master Page:-&lt;/h3&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;script type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt; &lt;/pre&gt;&lt;pre class=&quot;csharpcode&quot;&gt;    var clicked = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br&gt;   function CheckBrowser()&lt;br&gt;     {&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (clicked == &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)&lt;br&gt;        {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//Browser closed&lt;/span&gt;&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br&gt;        {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//redirected &lt;/span&gt;&lt;br&gt;            clicked = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt; &lt;br&gt;    function bodyUnload()&lt;br&gt;    {&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (clicked == &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)&lt;span class=&quot;rem&quot;&gt;//browser is closed&lt;/span&gt;&lt;br&gt;        {&lt;br&gt;        var request = GetRequest();&lt;br&gt;           &lt;br&gt;        request.open  (&lt;span class=&quot;str&quot;&gt;&quot;GET&quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&quot;AutoLogOut.aspx&quot;&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;);&lt;br&gt;        request.send();&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt; &lt;br&gt;    function GetRequest()&lt;br&gt;    {&lt;br&gt;        var request = &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (window.XMLHttpRequest)&lt;br&gt;        {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//incase of IE7,FF, Opera and Safari browser&lt;/span&gt;&lt;br&gt;            request = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; XMLHttpRequest();&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt;&lt;br&gt;        {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//for old browser like IE 6.x and IE 5.x&lt;/span&gt;&lt;br&gt;            request = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ActiveXObject(&lt;span class=&quot;str&quot;&gt;&#39;MSXML2.XMLHTTP.3.0&#39;&lt;/span&gt;);&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; request;&lt;br&gt;    } &lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;h3&gt;3.&amp;nbsp; Add the following code in the body tag of master page. &lt;/h3&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&amp;lt;body onunload=&lt;span class=&quot;str&quot;&gt;&quot;bodyUnload();&quot;&lt;/span&gt; Onclick=&lt;span class=&quot;str&quot;&gt;&quot;clicked=true;&quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&lt;br&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;/p&gt;&lt;br&gt;&lt;br /&gt;&lt;h3&gt;&lt;strong&gt;Finally the code in Master page like this:-&lt;/strong&gt;&lt;/h3&gt;&lt;pre class=&quot;csharpcode&quot;&gt;&lt;br&gt;&amp;lt;script language=&lt;span class=&quot;str&quot;&gt;&quot;javascript&quot;&lt;/span&gt; type=&lt;span class=&quot;str&quot;&gt;&quot;text/javascript&quot;&lt;/span&gt;&amp;gt;&lt;br&gt;    &lt;span class=&quot;rem&quot;&gt;//&amp;lt;![CDATA[&lt;/span&gt;&lt;br&gt;&lt;br&gt;    var clicked = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br&gt;    function CheckBrowser() {&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (clicked == &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;) {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//Browser closed&lt;/span&gt;&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//redirected &lt;/span&gt;&lt;br&gt;            clicked = &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;;&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;&lt;br&gt;    function bodyUnload() {&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (clicked == &lt;span class=&quot;kwrd&quot;&gt;false&lt;/span&gt;)&lt;span class=&quot;rem&quot;&gt;//browser is closed&lt;/span&gt;&lt;br&gt;        {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//var request = GetRequest();&lt;/span&gt;&lt;br&gt;           &lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//location.href = &#39;LogOut.aspx&#39;;&lt;/span&gt;&lt;br&gt;            var request = GetRequest();&lt;br&gt;&lt;br&gt;            request.open(&lt;span class=&quot;str&quot;&gt;&quot;GET&quot;&lt;/span&gt;, &lt;span class=&quot;str&quot;&gt;&quot;LogOut.aspx&quot;&lt;/span&gt;, &lt;span class=&quot;kwrd&quot;&gt;true&lt;/span&gt;);&lt;br&gt;            request.send();&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;    function GetRequest() {&lt;br&gt;        var request = &lt;span class=&quot;kwrd&quot;&gt;null&lt;/span&gt;;&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;if&lt;/span&gt; (window.XMLHttpRequest) {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//incase of IE7,FF, Opera and Safari browser&lt;/span&gt;&lt;br&gt;            request = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; XMLHttpRequest();&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;else&lt;/span&gt; {&lt;br&gt;            &lt;span class=&quot;rem&quot;&gt;//for old browser like IE 6.x and IE 5.x&lt;/span&gt;&lt;br&gt;            request = &lt;span class=&quot;kwrd&quot;&gt;new&lt;/span&gt; ActiveXObject(&lt;span class=&quot;str&quot;&gt;&#39;MSXML2.XMLHTTP.3.0&#39;&lt;/span&gt;);&lt;br&gt;        }&lt;br&gt;        &lt;span class=&quot;kwrd&quot;&gt;return&lt;/span&gt; request;&lt;br&gt;    } &lt;br&gt; &lt;br&gt;&lt;br&gt;    &lt;br&gt;    &lt;span class=&quot;rem&quot;&gt;//]]&amp;gt;&lt;/span&gt;&lt;br&gt;&amp;lt;/script&amp;gt;&lt;br&gt;&lt;br&gt;&amp;lt;body onunload=&lt;span class=&quot;str&quot;&gt;&quot;bodyUnload();&quot;&lt;/span&gt; onclick=&lt;span class=&quot;str&quot;&gt;&quot;clicked=true;&quot;&lt;/span&gt;&amp;gt;&lt;br&gt;    &amp;lt;form id=&lt;span class=&quot;str&quot;&gt;&quot;form1&quot;&lt;/span&gt; runat=&lt;span class=&quot;str&quot;&gt;&quot;server&quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;br /&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;&lt;style type=&quot;text/css&quot;&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, &quot;Courier New&quot;, courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/01/clear-session-on-browser-close.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>3</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-4609017652848608601</guid><pubDate>Mon, 03 Jan 2011 07:00:00 +0000</pubDate><atom:updated>2011-09-05T15:03:51.202-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">JavaScript</category><title>Search ListBox items using JavaScript</title><description>&lt;div class=&quot;wlWriterEditableSmartContent&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:dae4e67f-192d-4216-804c-1c9e6765c639&quot; style=&quot;display: inline; float: none; margin: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;&quot;&gt;
  1339. Technorati Tags: &lt;a href=&quot;http://technorati.com/tags/Search&quot; rel=&quot;tag&quot;&gt;Search&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/ListBox&quot; rel=&quot;tag&quot;&gt;ListBox&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/item&quot; rel=&quot;tag&quot;&gt;item&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/using&quot; rel=&quot;tag&quot;&gt;using&lt;/a&gt;,&lt;a href=&quot;http://technorati.com/tags/javascript&quot; rel=&quot;tag&quot;&gt;javascript&lt;/a&gt;&lt;/div&gt;
  1340. This example shows how to select ListItems in the ListBox based from the TextBox values using JavaScript.  &lt;br /&gt;
  1341. Its only select the first letter in list box control .If you want to filtering check this&amp;nbsp;&lt;a href=&quot;http://dotnetfarrukhabbas.blogspot.com/2011/02/filtering-or-searching-in-listbox-item.html&quot;&gt;Filtering Listbox control using Javascript&lt;/a&gt;.&lt;br /&gt;
  1342. &lt;br /&gt;
  1343. Here’s the code block below.  &lt;br /&gt;
  1344. &amp;lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot; &amp;gt;  &lt;br /&gt;
  1345. &amp;lt;head id=&quot;Head1&quot; runat=&quot;server&quot;&amp;gt;  &lt;br /&gt;
  1346. &amp;lt;title&amp;gt;Demo&amp;lt;/title&amp;gt;  &lt;br /&gt;
  1347. &amp;lt;/head&amp;gt;  &lt;br /&gt;
  1348. &amp;lt;script type=&quot;text/javascript&quot; language=&quot;javascript&quot;&amp;gt;  &lt;br /&gt;
  1349. function SearchList()  &lt;br /&gt;
  1350. {  &lt;br /&gt;
  1351. var l = document.getElementById(&#39;&amp;lt;%= ListBox1.ClientID %&amp;gt;&#39;);  &lt;br /&gt;
  1352. var tb = document.getElementById(&#39;&amp;lt;%= TextBox1.ClientID %&amp;gt;&#39;);  &lt;br /&gt;
  1353. if(tb.value == &quot;&quot;)  &lt;br /&gt;
  1354. {  &lt;br /&gt;
  1355. ClearSelection(l);  &lt;br /&gt;
  1356. }  &lt;br /&gt;
  1357. else{  &lt;br /&gt;
  1358. for (var i=0; i &amp;lt; l.options.length; i++)  &lt;br /&gt;
  1359. {  &lt;br /&gt;
  1360. if (l.options[i].text.toLowerCase().match(tb.value.toLowerCase()))  &lt;br /&gt;
  1361. {  &lt;br /&gt;
  1362. l.options[i].selected = true;  &lt;br /&gt;
  1363. return false;  &lt;br /&gt;
  1364. }  &lt;br /&gt;
  1365. else  &lt;br /&gt;
  1366. {  &lt;br /&gt;
  1367. ClearSelection(l);  &lt;br /&gt;
  1368. }  &lt;br /&gt;
  1369. }  &lt;br /&gt;
  1370. }  &lt;br /&gt;
  1371. }  &lt;br /&gt;
  1372. function ClearSelection(lb)  &lt;br /&gt;
  1373. {  &lt;br /&gt;
  1374. lb.selectedIndex = -1;  &lt;br /&gt;
  1375. }  &lt;br /&gt;
  1376. &amp;lt;/script&amp;gt;  &lt;br /&gt;
  1377. &amp;lt;body&amp;gt;  &lt;br /&gt;
  1378. &amp;lt;form id=&quot;form1&quot; runat=&quot;server&quot;&amp;gt;  &lt;br /&gt;
  1379. &amp;lt;asp:TextBox ID=&quot;TextBox1&quot; runat=&quot;server&quot; onkeyup=&quot;return SearchList();&quot;/&amp;gt;&amp;lt;br /&amp;gt;  &lt;br /&gt;
  1380. &amp;lt;asp:ListBox ID=&quot;ListBox1&quot; runat=&quot;server&quot; Height=&quot;150px&quot; Width=&quot;250px&quot;&amp;gt;  &lt;br /&gt;
  1381. &amp;lt;asp:ListItem&amp;gt;Vincent&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1382. &amp;lt;asp:ListItem&amp;gt;Jennifer&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1383. &amp;lt;asp:ListItem&amp;gt;Shynne&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1384. &amp;lt;asp:ListItem&amp;gt;Christian&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1385. &amp;lt;asp:ListItem&amp;gt;Helen&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1386. &amp;lt;asp:ListItem&amp;gt;Vladi&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1387. &amp;lt;asp:ListItem&amp;gt;Bee&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1388. &amp;lt;asp:ListItem&amp;gt;Jerome&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1389. &amp;lt;asp:ListItem&amp;gt;Vinz&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1390. &amp;lt;asp:ListItem&amp;gt;Churchill&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1391. &amp;lt;asp:ListItem&amp;gt;Rod&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1392. &amp;lt;asp:ListItem&amp;gt;Mark&amp;lt;/asp:ListItem&amp;gt;  &lt;br /&gt;
  1393. &amp;lt;/asp:ListBox&amp;gt;  &lt;br /&gt;
  1394. &amp;lt;/form&amp;gt;  &lt;br /&gt;
  1395. &amp;lt;/body&amp;gt;  &lt;br /&gt;
  1396. &amp;lt;/html&amp;gt;  &lt;br /&gt;
  1397. The JavaScript function basically searches the ListBox items and find the items based from the value of the TextBox that was entered. If a keyword exist from the list then it will automatically select the ListItems in the ListBox, but if the keyword does not exist then it will clear the ListBox selection.  &lt;br /&gt;
  1398. See the output below when you run it on the page  &lt;br /&gt;
  1399. &lt;img alt=&quot;&quot; height=&quot;451&quot; src=&quot;http://geekswithblogs.net/images/geekswithblogs_net/dotNETvinz/ListSearch.JPG&quot; width=&quot;616&quot; /&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2011/01/search-listbox-items-using-javascript.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-4060814136034704787</guid><pubDate>Tue, 28 Dec 2010 11:47:00 +0000</pubDate><atom:updated>2011-04-26T23:09:48.202-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Asp.Net</category><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>Request.Url parameters &amp;amp; details (Asp.net)</title><description>&lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Here I will explain you Request.Url Parameters and its details.&lt;/p&gt;  &lt;p&gt;Full URL : http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue   &lt;br /&gt;    &lt;br /&gt;Request.ApplicationPath : /virtual_dir     &lt;br /&gt;Request.CurrentExecutionFilePath : /virtual_dir/myrep/page.aspx     &lt;br /&gt;Request.FilePath : /virtual_dir/myrep/page.aspx     &lt;br /&gt;Request.Path : /virtual_dir/myrep/page.aspx     &lt;br /&gt;Request.PhysicalApplicationPath : d:\Inetpub\wwwroot\Websitename\virtual_dir\     &lt;br /&gt;Request.QueryString : /virtual_dir/myrep/page.aspx?q=qvalue     &lt;br /&gt;Request.Url.AbsolutePath : /virtual_dir/myrep/page.aspx     &lt;br /&gt;Request.Url.AbsoluteUri : http://localhost:2000/virtual_dir/myrep/page.aspx?q=qvalue     &lt;br /&gt;Request.Url.Host : localhost     &lt;br /&gt;Request.Url.Authority : localhost:2000     &lt;br /&gt;Request.Url.LocalPath : /virtual_dir/myrep/page.aspx     &lt;br /&gt;Request.Url.PathAndQuery : /virtual_dir/myrep/page.aspx?q=qvalue     &lt;br /&gt;Request.Url.Port : 2000     &lt;br /&gt;Request.Url.Query : ?q=qvalue     &lt;br /&gt;Request.Url.Scheme : http     &lt;br /&gt;Request.Url.Segments : /     &lt;br /&gt;virtual_dir/     &lt;br /&gt;myrep/     &lt;br /&gt;page.aspx&lt;/p&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2010/12/requesturl-parameters-details-aspnet.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-8748571519676007198</guid><pubDate>Mon, 27 Dec 2010 07:33:00 +0000</pubDate><atom:updated>2011-02-01T09:44:10.709-08:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tips</category><title>C# String Tips</title><description>&lt;div style=&quot;padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px&quot; id=&quot;scid:0767317B-992E-4b12-91E0-4F059A8CECA8:776f006d-8b95-4de7-aa2f-acbca762627f&quot; class=&quot;wlWriterEditableSmartContent&quot;&gt;Technorati Tags: &lt;a href=&quot;http://technorati.com/tags/C%23+String+Tips&quot; rel=&quot;tag&quot;&gt;C# String Tips&lt;/a&gt;&lt;/div&gt; &lt;p&gt;The .NET &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.string(VS.71).aspx&quot;&gt;string&lt;/a&gt; class is quite comprehensive, yet some common string functions are missing or not entirely obvious. This article provides quick tips on using .NET strings.  &lt;h4&gt;Fill a String with Repeating Characters&lt;/h4&gt; &lt;p&gt;To fill a string with repeating characters, use the string class &lt;a href=&quot;http://msdn2.microsoft.com/EN-US/library/aa331867.aspx&quot;&gt;constructor&lt;/a&gt;. For example, to fill a string with twenty asterisks:  &lt;blockquote&gt;&lt;pre&gt;string s = new string( &#39;*&#39;, 20 );&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;h4&gt;Check for Blank String&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;A blank string can be represented by a null reference or empty string (&lt;a href=&quot;http://msdn2.microsoft.com/en-US/library/system.string.empty.aspx&quot;&gt;String.Empty&lt;/a&gt; or &quot;&quot;). If you attempt to call a method on a null string, an exception will occur. Hence, to check for a blank string, you should use the new .NET v2.0 static function &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.string.isnullorempty.aspx&quot;&gt;String.IsNullOrEmpty&lt;/a&gt;:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;String.IsNullOrEmpty( s )&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;h4&gt;String.Empty vs. &quot;&quot;? It Doesn&#39;t Matter&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;There has been endless debate on the Web whether it&#39;s better to represent an empty string with &lt;a href=&quot;http://msdn2.microsoft.com/en-US/library/system.string.empty.aspx&quot;&gt;String.Empty&lt;/a&gt; or blank quotes &quot;&quot;. However, &lt;a href=&quot;http://forums.asp.net/p/977917/1250790.aspx&quot;&gt;tests show&lt;/a&gt; there is minimal performance difference between String.Empty and &quot;&quot; even when creating a billion empty strings.&lt;br&gt;&lt;br /&gt;&lt;h4&gt;Reverse a String&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;There has been &lt;a href=&quot;http://weblogs.asp.net/justin_rogers/archive/2004/06/10/153175.aspx&quot;&gt;extensive analysis&lt;/a&gt; on algorithms to reverse a string. The following is a good balance between speed and clarity and works well with Unicode and alternate character sets:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;static public string Reverse( string s )&lt;br&gt;{&lt;br&gt;    char[] charArray = s.ToCharArray();&lt;br&gt;    Array.Reverse( charArray );&lt;br&gt;    return new string( charArray );&lt;br&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;h4&gt;Compare Strings&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;Because a string reference can be null, you should avoid using the equality symbol == or the Compare member function when comparing strings. Instead, use the static &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.string.compare.aspx&quot;&gt;String.Compare&lt;/a&gt; method. This method has the advantage that it can handle null string references, compare strings ignoring case, and compare strings using a specific culture:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;if (String.Compare( s1, s2, true ) == 0)&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;h4&gt;Convert String to Numeric Value&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;Each numeric data type such as int, Int32, double, etc. has a static &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.int32.tryparse.aspx&quot;&gt;TryParse&lt;/a&gt; method that converts a string to that data type without throwing an exception. The method returns a bool whether the string contained a value with the specified data type. For example:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;string s = &quot;42&quot;;&lt;br&gt;int i;&lt;br&gt;int.TryParse( s, out i );&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;h4&gt;Use Literal Strings for File Paths&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;A literal string enables you to use special characters such as a backslash or double-quotes without having to use special codes or escape characters. This makes literal strings ideal for file paths that naturally contain many backslashes. To create a literal string, add the at-sign @ before the string&#39;s opening quote. For example:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;string path = @&quot;C:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin\gacutil.exe&quot;;&lt;/pre&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;h4&gt;String Right&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;Noticeably absent from the string class is the Right method. But you can replicate it easily using the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/hxthx5h6.aspx&quot;&gt;Substring&lt;/a&gt; method. Here is a simple method that wraps this up nicely:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;static string Right( string s, int count )&lt;br&gt;{&lt;br&gt;    string newString = String.Empty;&lt;br&gt;    if (s != null &amp;amp;&amp;amp; count &amp;gt; 0)&lt;br&gt;    {&lt;br&gt;        int startIndex = s.Length - count;&lt;br&gt;        if (startIndex &amp;gt; 0)&lt;br&gt;            newString = s.Substring( startIndex, count );&lt;br&gt;        else&lt;br&gt;            newString = s;&lt;br&gt;    }&lt;br&gt;    return newString;&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/blockquote&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp; &lt;h4&gt;IndexOf Ignoring Case&lt;/h4&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;The string&#39;s IndexOf methods are all case-sensitive. Fortunately, the Globalization namespace contains the &lt;a href=&quot;http://msdn2.microsoft.com/en-us/library/system.globalization.compareinfo.aspx&quot;&gt;CompareInfo&lt;/a&gt; class that includes a case-insensitive IndexOf method. For example:&lt;br&gt;&lt;br /&gt;&lt;blockquote&gt;&lt;pre&gt;using System.Globalization;&lt;/pre&gt;&lt;br&gt;&lt;br /&gt;&lt;p&gt;&lt;pre&gt;string s1 = &quot;C# is a GREAT programming language.&quot;;&lt;br&gt;string s2 = &quot;great&quot;;&lt;br&gt;&lt;br&gt;CompareInfo Compare = CultureInfo.InvariantCulture.CompareInfo;&lt;br&gt;int i = Compare.IndexOf( s1, s2,CompareOptions.IgnoreCase);&lt;/pre&gt;&lt;/blockquote&gt;  </description><link>http://dotnetfarrukhabbas.blogspot.com/2010/12/c-string-tips.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>2</thr:total></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-2888154610211197125.post-926648338260586950</guid><pubDate>Sun, 05 Dec 2010 05:56:00 +0000</pubDate><atom:updated>2010-12-04T21:57:11.286-08:00</atom:updated><title>Working with Delegates in C#</title><description>&lt;p class=&quot;MsoNormal&quot;&gt;&lt;strong&gt;What are delegates and why are they required?&lt;/strong&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;&lt;br /&gt;Delegates are function pointers in C# that are managed and type safe and can refer to one or more methods that have identical signatures. Delegates in C# are reference types. They are type safe, managed function pointers in C# that can be used to invoke a method that the delegate refers to. The signature of the delegate should be the same as the signature of the method to which it refers. According to MSDN, &quot;A delegate in C# is similar to a function pointer in C or C++. Using a delegate allows the programmer to encapsulate a reference to a method inside a delegate object. The delegate object can then be passed to code which can call the referenced method, without having to know at compile time which method will be invoked. Unlike function pointers in C or C++, delegates are object-oriented, type-safe, and secure.&quot;&lt;br /&gt;&lt;br /&gt;C# provides support for Delegates through the class called Delegate in the System namespace. Delegates are of two types.&lt;br /&gt;&lt;br /&gt;· Single-cast delegates&lt;br /&gt;&lt;br /&gt;· Multi-cast delegates&lt;br /&gt;&lt;br /&gt;A Single-cast delegate is one that can refer to a single method whereas a Multi-cast delegate can refer to and eventually fire off multiple methods that have the same signature.&lt;br /&gt;&lt;br /&gt;The signature of a delegate type comprises are the following.&lt;br /&gt;&lt;br /&gt;· The name of the delegate&lt;br /&gt;&lt;br /&gt;· The arguments that the delegate would accept as parameters&lt;br /&gt;&lt;br /&gt;· The return type of the delegate&lt;br /&gt;&lt;br /&gt;A delegate is either public or internal if no specifier is included in its signature. Further, you should instantiate a delegate prior to using the same.&lt;br /&gt;&lt;br /&gt;The following is an example of how a delegate is declared.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Declaring a delegate&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public delegate void TestDelegate(string message);&lt;/p&gt;&lt;br /&gt;&lt;p class=&quot;MsoNormal&quot;&gt;The return type of the delegate shown in the above example is &quot;void&quot; and it accepts a string argument. Note that the keyword &quot;delegate&quot; identifies the above declaration as a delegate to a method. This delegate can refer to and eventually invoke a method that can accept a string argument and has a return type of void, i.e., it does not return any value. You can use a delegate to make it refer to and invoke a method that has identical signature as the delegate only. Even if you are using multi-cast delegates, remember that you can use your delegate to refer to and then fire off multiple methods that have identical signatures only.&lt;br /&gt;&lt;br /&gt;A delegate should always be instantiated before it is used. The following statement shows how you can instantiate a delegate.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Instantiating a delegate&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;TestDelegate t = new TestDelegate(Display);&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Implementing Delegates in C# &lt;/strong&gt;&lt;br /&gt;This section illustrates how we can implement and use delegates in C#. The following is an example of a delegate that is used to refer to a method of identical signature as the delegate and eventually invoke the method using the delegate.&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Configuration;&lt;br /&gt;using System.Collections;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.Security;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Web.UI.WebControls.WebParts;&lt;br /&gt;using System.Web.UI.HtmlControls;&lt;br /&gt;&lt;br /&gt;public partial class Header : System.Web.UI.UserControl&lt;br /&gt;{&lt;br /&gt;public event ColorChangedEventHandler ColorChanged;&lt;br /&gt;public event LinkClickEventHandler Clicked;&lt;br /&gt;string _texts;&lt;br /&gt;string _text;&lt;br /&gt;public void Page_Init(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;//Wire-up the EventHandler&lt;br /&gt;this.colorList.SelectedIndexChanged += new System.EventHandler(Index_Changed);&lt;br /&gt;if (_texts.IndexOf(&#39;$&#39;) &amp;gt; 0)&lt;br /&gt;{&lt;br /&gt;string[] Texts = _texts.Split(&#39;$&#39;);&lt;br /&gt;LinkButton lnk;&lt;br /&gt;Label lbl;&lt;br /&gt;for(int cnt = 0; cnt &amp;lt; Texts.Length; cnt++)&lt;br /&gt;{&lt;br /&gt;lnk = new LinkButton();&lt;br /&gt;lnk.Text = Texts[cnt];&lt;br /&gt;lnk.Click += new EventHandler(lnk_Click);&lt;br /&gt;plc.Controls.Add(lnk);&lt;br /&gt;lbl = new Label();&lt;br /&gt;lbl.Text = &quot;&quot;;&lt;br /&gt;plc.Controls.Add(lbl);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;public string Text&lt;br /&gt;{&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_text = value;&lt;br /&gt;}&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _text;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void lnk_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;LinkButton lb = (LinkButton)sender;&lt;br /&gt;_text = lb.Text;&lt;br /&gt;if (Clicked != null)&lt;br /&gt;{&lt;br /&gt;//Call the Delegate and pass the ColorEventArgs&lt;br /&gt;Clicked(this, e);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;//Method called when the DropDownList value changes&lt;br /&gt;public void Index_Changed(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;//Create a new Arguments Object&lt;br /&gt;ColorEventArgs myArgs = new ColorEventArgs();&lt;br /&gt;//Get the color selected&lt;br /&gt;myArgs.Color =colorList.SelectedItem.Text;&lt;br /&gt;colorList.BackColor = System.Drawing.Color.Blue;&lt;br /&gt;//Check if any method has subscribed for notification&lt;br /&gt;//If you don&#39;t do this then an exception gets thrown&lt;br /&gt;//When there are no methods subscribing to the Event&lt;br /&gt;if(ColorChanged!=null)&lt;br /&gt;{&lt;br /&gt;//Call the Delegate and pass the ColorEventArgs&lt;br /&gt;ColorChanged(this, myArgs);&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;public string Texts&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return _texts;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;_texts = value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public delegate void AddClickEventHandler(object sender,EventArgs e);&lt;br /&gt;//Define a Delegate&lt;br /&gt;public delegate void LinkClickEventHandler(object sender,EventArgs e);&lt;br /&gt;//Define a Delegate&lt;br /&gt;public delegate void ColorChangedEventHandler(object sender, ColorEventArgs e);&lt;br /&gt;//Define a Class that Extends the EventArgs&lt;br /&gt;&lt;br /&gt;public class ColorEventArgs : System.EventArgs&lt;br /&gt;{&lt;br /&gt;private string color;&lt;br /&gt;//Color Property&lt;br /&gt;public string Color&lt;br /&gt;{&lt;br /&gt;get&lt;br /&gt;{&lt;br /&gt;return this.color;&lt;br /&gt;}&lt;br /&gt;set&lt;br /&gt;{&lt;br /&gt;this.color = value;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;———————————————————————————————————————————————————&lt;br /&gt;Using this in another page. Include the header.ascx file&lt;br /&gt;&lt;br /&gt;protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;//attach functionality to the events in the header&lt;br /&gt;Header1.ColorChanged += new ColorChangedEventHandler(Header1_ColorChanged);&lt;br /&gt;Header1.Clicked += new LinkClickEventHandler(Header1_Clicked);&lt;br /&gt;Database db = DatabaseFactory.CreateDatabase();&lt;br /&gt;DataSet ds = db.ExecuteDataSet(CommandType.StoredProcedure, &quot;usp_Employees&quot;);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Header1_Clicked(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;Response.Write(Header1.Text);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;void Header1_ColorChanged(object sender, ColorEventArgs e)&lt;br /&gt;{&lt;br /&gt;Response.Write(&quot;header color changed&quot; + e.Color);&lt;br /&gt;//throw new Exception(&quot;The method or operation is not implemented.&quot;);&lt;br /&gt;}&lt;/p&gt;</description><link>http://dotnetfarrukhabbas.blogspot.com/2010/12/working-with-delegates-in-c.html</link><author>noreply@blogger.com (M. Farrukh Abbas)</author><thr:total>0</thr:total></item></channel></rss>

If you would like to create a banner that links to this page (i.e. this validation result), do the following:

  1. Download the "valid RSS" banner.

  2. Upload the image to your own server. (This step is important. Please do not link directly to the image on this server.)

  3. Add this HTML to your page (change the image src attribute if necessary):

If you would like to create a text link instead, here is the URL you can use:

http://www.feedvalidator.org/check.cgi?url=http%3A//dotnetfarrukhabbas.blogspot.com/feeds/posts/default%3Falt%3Drss

Copyright © 2002-9 Sam Ruby, Mark Pilgrim, Joseph Walton, and Phil Ringnalda