<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns: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'><id>tag:blogger.com,1999:blog-3745570594501467297</id><updated>2026-03-17T17:09:13.843+05:30</updated><category term="How to send email in ASP.NET C#"/><category term="sweetalert Mvc 5"/><title type='text'>Programing Solution Asp.net &amp;amp; Sql</title><subtitle type='html'>sql server ,asp.net,ajax c# .net, MVC, html2pdf, mail</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>16</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-4261979835395140888</id><published>2024-10-09T10:47:00.026+05:30</published><updated>2024-10-14T16:54:45.506+05:30</updated><title type='text'>Save a PDF  generated from html2pdf  in C#, MVC , html2pdf , Ajax code </title><content type='html'>&lt;p&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;&amp;nbsp;To save on server or disk a PDF generated from HTML in C# code example, you can use the &lt;span&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;html2pdf js script&lt;/span&gt;&lt;span&gt;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span style=&quot;color: #444444; font-family: verdana; font-size: medium;&quot;&gt;&lt;b&gt;html2pdf&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;code&gt;&lt;span style=&quot;font-family: verdana; font-size: medium;&quot;&gt;converts any webpage or element into a printable PDF entirely client-side using html2canvas and jsPDF&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;Source Sans Pro&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #333333; font-size: 18px; letter-spacing: 0.1px;&quot;&gt;To use html2pdf is to download&amp;nbsp;&lt;/span&gt;&lt;code style=&quot;border-radius: var(--code-box-radius); box-sizing: border-box; color: #333333; font-family: var(--code); font-size: 0.9em; font-variant-ligatures: none; letter-spacing: var(--code-ls); line-height: var(--code-lh); padding: 0px 5px;&quot;&gt;&lt;a href=&quot;https://github.com/eKoopmans/html2pdf.js&quot; target=&quot;_blank&quot;&gt;dist/html2pdf.bundle.min.js&lt;/a&gt;&lt;/code&gt;&lt;span face=&quot;&amp;quot;Source Sans Pro&amp;quot;, &amp;quot;Lucida Grande&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #333333; font-size: 18px; letter-spacing: 0.1px;&quot;&gt;&amp;nbsp;to your project folder and include it in your code with&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;entity name tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; color: teal; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;script&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;entity other attribute-name html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; color: #445588; font-family: monospace, monospace; font-size: 16px; font-weight: bold; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;src&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;string quoted double html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; color: #dd1144; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span class=&quot;punctuation definition string begin html&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;html2pdf.bundle.min.js&lt;/span&gt;&lt;span class=&quot;punctuation definition string end html&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&quot;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;span class=&quot;meta scope html&quot; style=&quot;box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;/&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;entity name tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; color: teal; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;script&lt;/span&gt;&lt;/span&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box;&quot;&gt;&lt;span style=&quot;box-sizing: border-box; font-family: verdana; white-space: pre;&quot;&gt;&lt;b&gt;C#, MVC&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: #f7f7f7; font-family: monospace, monospace; white-space: pre;&quot;&gt;Create new project in visual studio &lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;background-color: #f7f7f7; font-family: monospace, monospace; white-space: pre;&quot;&gt;&lt;b style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; white-space: normal;&quot;&gt;Step 1: Create a Model Class&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;!overflow-visible&quot;&gt;&lt;div style=&quot;background-color: rgba(33, 33, 33, 0.9); border: 1px solid orange; color: white; padding: 10px;&quot;&gt;
&lt;div class=&quot;flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9&quot;&gt;csharp&lt;/div&gt;
&lt;div style=&quot;overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;
    public class pdfdata
    {
        public string PDFBase64 { get; set; }
        public string FileName { get; set; }
        
    }

&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span style=&quot;background-color: #f7f7f7; font-family: monospace, monospace; white-space: pre;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Step 2: Create a Controller&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;Create a new controller called &lt;code&gt;PdfController.cs&lt;/code&gt;&lt;/b&gt;
&lt;/p&gt;&lt;pre class=&quot;!overflow-visible&quot;&gt;&lt;div style=&quot;background-color: rgba(33, 33, 33, 0.9); border: 1px solid orange; padding: 10px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;
&lt;/span&gt;&lt;div class=&quot;flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9&quot; style=&quot;color: white;&quot;&gt;csharp&lt;/div&gt;&lt;div class=&quot;flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9&quot; style=&quot;color: white;&quot;&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style=&quot;color: white;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt; public ActionResult &lt;/span&gt;&lt;span style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; white-space: normal;&quot;&gt;&lt;code&gt;&lt;span style=&quot;color: white;&quot;&gt;Pdf&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;span style=&quot;color: white;&quot;&gt;()
        {
           

            
            return View();
        }
&lt;/span&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;// Ajax Call from srcipt&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;
    public JsonResult savepdf(pdfdata pdf)
        {

	 byte[] bytes = Encoding.GetEncoding(28591).GetBytes(pdf.PDFBase64);

 	 System.IO.File.WriteAllBytes(@&quot;yourlocation_path/&lt;span class=&quot;hljs-keyword&quot; style=&quot;font-size: 13.2px;&quot;&gt;pdf.Filename&quot;+&quot;&lt;/span&gt;.pdf&quot;, bytes);

  	 var response = new { success = true, responseText = &quot;Your file Saved successfuly !&quot; };
           
  	 return Json(response, JsonRequestBehavior.AllowGet);
	}

&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;
  
  &lt;code&gt;&lt;br /&gt;&lt;/code&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&lt;b style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;Step 3: Create a View&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;!overflow-visible&quot;&gt;&lt;div style=&quot;background-color: rgba(33, 33, 33, 0.9); border: 1px solid orange; padding: 10px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;
&lt;/span&gt;&lt;div class=&quot;flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9&quot; style=&quot;color: white;&quot;&gt;HTML&lt;/div&gt;&lt;span style=&quot;color: white;&quot;&gt;
&lt;/span&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;
&lt;code class=&quot;language-markup&quot;&gt;&lt;span class=&quot;token comment&quot;&gt;  &amp;lt;button id=&quot;btnsavepdf&quot; class=&quot;btn btn-primary btn-xs&quot; &amp;gt;
                    Click here to Save
                &amp;lt;/button&amp;gt;&lt;/span&gt;&lt;/code&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;&lt;code class=&quot;language-markup&quot;&gt;
&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token tag&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;/span&gt; &lt;span class=&quot;token attr-name&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;token attr-value&quot;&gt;&lt;span class=&quot;token punctuation attr-equals&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;mycontents&lt;span class=&quot;token punctuation&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;token punctuation&quot;&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;

... my pdf content
&lt;/span&gt;&lt;/code&gt;
&lt;span class=&quot;token punctuation&quot;&gt;&amp;lt;&lt;/span&gt;div&lt;span class=&quot;token punctuation&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;color: white; overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;&lt;span class=&quot;token punctuation&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style=&quot;overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;&lt;span class=&quot;token punctuation&quot; style=&quot;color: white;&quot;&gt;&amp;lt;script src=&quot;jquery-3.3.1.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&quot;savepdf.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;script src=&quot;html2pdf.bundle.min.js&quot; type=&quot;text/javascript&quot;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;
&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&lt;b style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;Create a javascript code or in seperate js file like i created&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;pre class=&quot;!overflow-visible&quot;&gt;&lt;div style=&quot;background-color: rgba(33, 33, 33, 0.9); border: 1px solid orange; padding: 10px;&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;
&lt;/span&gt;&lt;div class=&quot;flex items-center text-token-text-secondary bg-token-main-surface-secondary px-4 py-2 text-xs font-sans justify-between rounded-t-md h-9&quot; style=&quot;color: white;&quot;&gt;Script&lt;/div&gt;&lt;span style=&quot;color: white;&quot;&gt;
&lt;/span&gt;&lt;div style=&quot;overflow: auto; width: 450px;&quot;&gt;&lt;span class=&quot;hljs-function&quot;&gt;&lt;span class=&quot;hljs-keyword&quot;&gt;&lt;span style=&quot;color: white;&quot;&gt;
window.addEventListener(&#39;load&#39;, function () {
   
    var btnsavepdf = document.getElementById(&#39;btnsavepdf&#39;);
   
    function savePdf() {
       
        var element = &#39;&#39;;    element = document.getElementsByName(&#39;mycontents&#39;)[0];
        var opt = {
            margin: [2, 2, 2, 2],
            filename: &#39;myfile&#39;,
            image: { type: &#39;jpeg&#39;, quality: 0.7 },
            html2canvas: { scale: 2, useCORS: true },
            jsPDF: { format: &#39;a4&#39;, unit: &#39;mm&#39; },
           
        };

        
        html2pdf().from(element).set(opt).toPdf().get(&#39;pdf&#39;).then(function (pdf) {

            pdf.setFontSize(10);
        }).get(&#39;pdf&#39;).then(function (pdf) {

            
            var pdfBase64 = pdf.output();
            console.log(pdfBase64);
            var pdfcontent = {};

            pdfcontent.PDFBase64 = pdfBase64;
            pdfcontent.FileName = fileName;


            $.ajax({
                type: &quot;POST&quot;,
                url: &quot;/pdf/savepdf&quot;,
                data: &quot;{pdfcontent:&quot; + JSON.stringify(pdfcontent) + &quot;}&quot;,
                contentType: &quot;application/json;charset=utf-8&quot;,
                datatype: &quot;json&quot;,
                complete: OnComplete
            });
        })
    }


    btnsavepdf.addEventListener(&#39;click&#39;, function () {
       
       
        savePdf();
    });
})
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/pre&gt;

&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&lt;b style=&quot;font-family: &amp;quot;Times New Roman&amp;quot;; font-size: medium; white-space: normal;&quot;&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span class=&quot;punctuation definition tag html&quot; style=&quot;background-color: #f7f7f7; box-sizing: border-box; font-family: monospace, monospace; font-size: 16px; white-space: pre;&quot;&gt;&lt;span style=&quot;box-sizing: border-box;&quot;&gt;&lt;b&gt;&lt;u&gt;Additional Notes&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul style=&quot;text-align: left;&quot;&gt;&lt;li&gt;Ensure you have the necessary permissions to write to the directory.&lt;/li&gt;&lt;li&gt;Customize the &lt;code&gt;HtmlContent&lt;/code&gt; with your desired HTML and CSS.&lt;/li&gt;&lt;li&gt;You can also load HTML from a body or&amp;nbsp;desired element like div&amp;nbsp; &lt;b&gt;&amp;lt;div name =&#39;pdfcontent&#39;&amp;gt;content...&amp;lt;/div&amp;gt;.&lt;/b&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/4261979835395140888/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2024/10/save-pdf-generated-from-html-in-c-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/4261979835395140888'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/4261979835395140888'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2024/10/save-pdf-generated-from-html-in-c-mvc.html' title='Save a PDF  generated from html2pdf  in C#, MVC , html2pdf , Ajax code '/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-2986744201428353738</id><published>2024-09-28T14:57:00.010+05:30</published><updated>2024-10-07T17:28:44.666+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="How to send email in ASP.NET C#"/><title type='text'>Problem To Send Mail C# Asp.net (Hosting Provider)</title><content type='html'>&lt;p&gt;&lt;span style=&quot;color: #cc0000; font-size: medium;&quot;&gt;&lt;b&gt;&amp;nbsp;How To send mail from asp.net C#&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #cc0000; font-size: medium;&quot;&gt;&lt;/span&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;background-color: whitesmoke; color: #111111; font-size: 16px;&quot;&gt;especially when dealing with different hosting providers.&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;-apple-system, Roboto, SegoeUI, &amp;quot;Segoe UI&amp;quot;, &amp;quot;Helvetica Neue&amp;quot;, Helvetica, &amp;quot;Microsoft YaHei&amp;quot;, &amp;quot;Meiryo UI&amp;quot;, Meiryo, &amp;quot;Arial Unicode MS&amp;quot;, sans-serif&quot; style=&quot;background-color: whitesmoke; color: #111111; font-size: 16px;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span style=&quot;color: #cc0000; font-size: medium;&quot;&gt;&lt;b&gt;&amp;nbsp;Here is working Code&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;First Create one email id&amp;nbsp; of&amp;nbsp; your domain From your hosting provider&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;using System.Net.Mail;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;public void sendLocalmail(String from, String to, String Cc, String subject , String Mailbody)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MailMessage MM = new MailMessage();&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.Attachments.Add(new Attachment());&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.Body = Mailbody;&lt;/b&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.From = new MailAddress(from);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.To.Add(to);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.CC.Add(Cc);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.Subject = subject&amp;nbsp;;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.IsBodyHtml = true;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.BodyEncoding = System.Text.Encoding.UTF8;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; MM.Priority = MailPriority.Normal;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; SmtpClient client = new SmtpClient();&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.Credentials = new System.Net.NetworkCredential(youremail@domain_name.com, &quot;password&quot;);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #800180;&quot;&gt;//use your domain email id as username and its password&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.Port = Convert.ToInt32(&quot;25&quot;);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #800180;&quot;&gt;//if port 25 not work&amp;nbsp;&#39;use465 or 587 ports&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.Host = &quot;mail.domain_name.com.&quot;;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;span face=&quot;&amp;quot;open sans&amp;quot;, sans-serif&quot; style=&quot;background-color: white; color: #800180; font-size: 16px;&quot;&gt;&lt;b&gt;//SMTP Host address of your domain name not required any gmail,hotmail email id check ur dns setting&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.EnableSsl = true;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&lt;span style=&quot;color: #800180;&quot;&gt;//on some server ssl my not suport then try to&amp;nbsp; client.EnableSsl = false;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; client.Send(MM);&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/p&gt;&lt;p&gt;//its working code like php contact form always work&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/2986744201428353738/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2024/09/problem-to-send-mail-c-aspnet-hosting.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/2986744201428353738'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/2986744201428353738'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2024/09/problem-to-send-mail-c-aspnet-hosting.html' title='Problem To Send Mail C# Asp.net (Hosting Provider)'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-928221597584780982</id><published>2023-09-24T11:45:00.003+05:30</published><updated>2023-09-24T11:47:51.947+05:30</updated><category scheme="http://www.blogger.com/atom/ns#" term="sweetalert Mvc 5"/><title type='text'>sweetalerts with @ViewBag.Message  mvc  5</title><content type='html'>&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;How To Show success alert with&amp;nbsp;sweetalert&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Show Success Message On Create, Edit&amp;nbsp; Mvc 5&lt;/p&gt;&lt;p&gt;&lt;b&gt;Controller:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;Add&amp;nbsp; ViewBag.Message in&amp;nbsp; Controller --&amp;gt; ActionResult&lt;span style=&quot;color: #45818e;&quot;&gt;&lt;b&gt; Edit, Create&lt;/b&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;[HttpPost]&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; public ActionResult Edit(model)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span style=&quot;color: #ffa400;&quot;&gt; &amp;nbsp; --your Code here&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ViewBag.Message = &quot;Details Edited successfully&quot;;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return View();&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;View:&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;From your&amp;nbsp;&lt;/b&gt;&lt;b&gt;Scripts&amp;nbsp;&lt;/b&gt;&lt;b&gt;lib folder&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;lt;script src=&quot;~/Scripts/jquery-1.11.3.min.js&quot;&amp;gt;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;b&gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;CDN&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;lt;link href=&quot;&lt;a href=&quot;https://cdn.jsdelivr.net/npm/sweetalert2@11.7.28/dist/sweetalert2.min.css&quot;&gt;https://cdn.jsdelivr.net/npm/sweetalert2@11.7.28/dist/sweetalert2.min.css&lt;/a&gt; /&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp;&amp;lt;script src=&quot;&lt;a href=&quot;https://cdn.jsdelivr.net/npm/sweetalert2@11.7.28/dist/sweetalert2.all.min.js&quot;&gt;https://cdn.jsdelivr.net/npm/sweetalert2@11.7.28/dist/sweetalert2.all.min.js&lt;/a&gt;&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;lt;/script&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp;&lt;b&gt; @if (ViewBag.Message != null)&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; {&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;$(window).load(function () {&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; new swal({&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; text: &quot;@ViewBag.Message&quot;,&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; type: &quot;success&quot;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }).then(okay =&amp;gt; {&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (okay) {&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; window.location.href = &quot;@Url.Action(&quot;Index&quot;, &quot;any&quot;)&quot;;&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;&amp;nbsp; });&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&lt;b&gt;sweetalert&amp;nbsp; alert&lt;/b&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg-xGqBysN9Fd70mzNCUx3uWdhEjooO_PEcS4LAeqRWFu04CpT5xXySH-cWkwk5jbyM4RIoSOprr7YJUkJ7i8Ximnc4cscZEo3_OpNDHR2WCKoybJZnHpkP46ktCOzzQCN6aB6umzabkQG08LfWlbUSm6govG9BVcxvBc5LK362AuBCeDmyRUThQYTDLEU-&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img alt=&quot;&quot; data-original-height=&quot;160&quot; data-original-width=&quot;535&quot; height=&quot;96&quot; src=&quot;https://blogger.googleusercontent.com/img/a/AVvXsEg-xGqBysN9Fd70mzNCUx3uWdhEjooO_PEcS4LAeqRWFu04CpT5xXySH-cWkwk5jbyM4RIoSOprr7YJUkJ7i8Ximnc4cscZEo3_OpNDHR2WCKoybJZnHpkP46ktCOzzQCN6aB6umzabkQG08LfWlbUSm6govG9BVcxvBc5LK362AuBCeDmyRUThQYTDLEU-&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;/p&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/928221597584780982/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2023/09/sweetalerts-with-viewbagmessage-mvc-5.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/928221597584780982'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/928221597584780982'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2023/09/sweetalerts-with-viewbagmessage-mvc-5.html' title='sweetalerts with @ViewBag.Message  mvc  5'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/a/AVvXsEg-xGqBysN9Fd70mzNCUx3uWdhEjooO_PEcS4LAeqRWFu04CpT5xXySH-cWkwk5jbyM4RIoSOprr7YJUkJ7i8Ximnc4cscZEo3_OpNDHR2WCKoybJZnHpkP46ktCOzzQCN6aB6umzabkQG08LfWlbUSm6govG9BVcxvBc5LK362AuBCeDmyRUThQYTDLEU-=s72-c" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-3270931097854264628</id><published>2013-04-16T12:49:00.001+05:30</published><updated>2013-04-16T12:56:48.841+05:30</updated><title type='text'>Adding multiple series in asp.net chart dynamically (from sql table for each rows) Asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Add Chart Control on design&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvg7rVlCSWTtv-Og5X7XsCUp1SZIs2h38IyCJiBMbDhGt-ZAnIO-rkOsXLtCErvSnwpE_Vzqak6dO_N2skKbAe3oNg9C47vBODnkgkMhtcX_V6nqezw4YGyxpQJZk2PXOGKz5EnDumfKl/s1600/chart.jpg&quot; imageanchor=&quot;1&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;280&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvg7rVlCSWTtv-Og5X7XsCUp1SZIs2h38IyCJiBMbDhGt-ZAnIO-rkOsXLtCErvSnwpE_Vzqak6dO_N2skKbAe3oNg9C47vBODnkgkMhtcX_V6nqezw4YGyxpQJZk2PXOGKz5EnDumfKl/s640/chart.jpg&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: yellow;&quot;&gt;In Code behind getdata from dataset for each row from table create series&amp;nbsp;dynamically&amp;nbsp;and add to chart series look in code it will be easy&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp;public void Bindchart()&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataSet myDataSet2 = getdatafromsql();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string series=&quot;series&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; foreach (DataRow row in myDataSet2.Tables[0].Rows)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;series=series+row.ToString();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; chart1.Series.Add(series);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; for (int colIndex = 1; colIndex &amp;lt; myDataSet2.Tables[0].Columns.Count; colIndex++)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // for each column (column 1 and onward), add the value as a point&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string columnName1 = myDataSet2.Tables[0].Columns[colIndex].ColumnName.ToString();&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; int YVal1 = Convert.ToInt32(row[columnName1]);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; string &amp;nbsp;emp = Convert.ToString(row[0]);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; chart1.Series[series].Points.AddXY(columnName1, YVal1);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp;chart1.Series[series].LegendText &amp;nbsp;= emp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;chart1.Series[ser].ToolTip = emp + &quot;= #VALY&quot;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;background-color: white;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;background-color: #9fc5e8;&quot;&gt;&lt;br /&gt;
&lt;/span&gt; &lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/3270931097854264628/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2013/04/adding-multiple-series-in-aspnet-chart.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3270931097854264628'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3270931097854264628'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2013/04/adding-multiple-series-in-aspnet-chart.html' title='Adding multiple series in asp.net chart dynamically (from sql table for each rows) Asp.net'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhdvg7rVlCSWTtv-Og5X7XsCUp1SZIs2h38IyCJiBMbDhGt-ZAnIO-rkOsXLtCErvSnwpE_Vzqak6dO_N2skKbAe3oNg9C47vBODnkgkMhtcX_V6nqezw4YGyxpQJZk2PXOGKz5EnDumfKl/s72-c/chart.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-1237117666632557358</id><published>2013-03-05T15:58:00.000+05:30</published><updated>2013-04-12T07:50:24.926+05:30</updated><title type='text'>Find duplicate record from table -sql server database</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;Use fallowing query For &amp;nbsp;searching duplicate Record from table&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
SELECT record_feild,&lt;br /&gt;
&amp;nbsp;COUNT(record_feild) AS Occurrences_count&lt;br /&gt;
FROM Record_table&lt;br /&gt;
GROUP BY record_feild&lt;br /&gt;
HAVING ( COUNT(record_feild) &amp;gt; 1 )&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;i&gt;&lt;u&gt;Use fallowing query&amp;nbsp;&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;b&gt;&lt;i&gt;&lt;u&gt;deleting &amp;nbsp;duplicate Record from table&lt;/u&gt;&lt;/i&gt;&lt;/b&gt;&lt;br /&gt;
delete&lt;br /&gt;
FROM Record_table&lt;br /&gt;
WHERE record_id NOT IN&lt;br /&gt;
(&lt;br /&gt;
SELECT MAX(record_id)&lt;br /&gt;
FROM Record_table&lt;br /&gt;
GROUP BY record_feild)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/1237117666632557358/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2013/03/find-duplicate-record-from-table-sql.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/1237117666632557358'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/1237117666632557358'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2013/03/find-duplicate-record-from-table-sql.html' title='Find duplicate record from table -sql server database'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-4808259372996182589</id><published>2012-07-10T11:39:00.003+05:30</published><updated>2012-07-10T11:39:39.582+05:30</updated><title type='text'>aggregate functions in where/having clause</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;b&gt;sum, avg, count, min, max, and count(*)&lt;/b&gt;.these are sql functions to calculate and &lt;br /&gt;summarize data&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
but it can be possible to use these function in query condition clause&lt;br /&gt;Example : product_stock contains purchase sale &lt;br /&gt;&lt;br /&gt;detail of product we have to find product&lt;br /&gt;whose stock is greater than 100&lt;br /&gt;here is,&lt;br /&gt;&lt;br /&gt;select product_id, product_name from&lt;br /&gt;product_master inner join on product_stock on &lt;br /&gt;product_master.product_id=product_stock.product_id&lt;br /&gt;group by product_id, product_name&lt;br /&gt;having Sum(product_stock.stock_value)&amp;gt;100&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/4808259372996182589/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/07/aggregate-functions-in-wherehaving.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/4808259372996182589'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/4808259372996182589'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/07/aggregate-functions-in-wherehaving.html' title='aggregate functions in where/having clause'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-3193878031525850336</id><published>2012-07-09T13:12:00.004+05:30</published><updated>2012-07-09T13:19:19.935+05:30</updated><title type='text'>Alter Query sql Sever</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;span style=&quot;font-size: large;&quot;&gt;&lt;b&gt;Alter Commands in sql Server&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;b&gt;&lt;i&gt;Change Datatype of sql server database table column&lt;/i&gt;&lt;/b&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
ALTER TABLE MyTable ALTER COLUMN NullCOl NVARCHAR(20) NOT NULL;&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;drop Column&amp;nbsp; from sql server database table column&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
ALTER TABLE table_name&lt;br /&gt;
DROP COLUMN column_name &lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;Change Coloumn Name of sql server database table column&lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
&lt;br /&gt;
Alter table table_name change old_column_name &amp;nbsp; new_column_name type size&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;&lt;i&gt;&lt;b&gt;Change primery key CONSTRAINT of sql server database table &lt;/b&gt;&lt;/i&gt;&lt;/u&gt;&lt;br /&gt;
ALTER TABLE table_name&lt;br /&gt;
DROP CONSTRAINT PK_table_name_Col1 new_column_name old_column_name column_name datatype&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/3193878031525850336/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/07/alter-query-sql-sever.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3193878031525850336'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3193878031525850336'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/07/alter-query-sql-sever.html' title='Alter Query sql Sever'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-1698773998746326316</id><published>2012-07-05T15:40:00.000+05:30</published><updated>2012-07-09T13:50:17.383+05:30</updated><title type='text'>Web service in asp.net</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
A Web Service is programmable application logic accessible via standard Web protocols. One of these Web protocols is the Simple Object Access Protocol (SOAP)&lt;br /&gt;
&lt;br /&gt;
Consumers of a Web Service do not need to know anything about the platform, object model, or programming language used to &lt;br /&gt;
&lt;br /&gt;
implement the service; they only need to understand how to send and receive SOAP messages (HTTP and XML). &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;i&gt;&lt;b&gt;A Web Service Example&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
In the following example we will use ASP.NET to create a simple Web Service that adds two numbers&lt;br /&gt;
&lt;br /&gt;
VB.&lt;br /&gt;
&amp;lt;%@ WebService Language=&quot;VB&quot; Class=&quot;MyMath&quot; %&amp;gt;&lt;br /&gt;
Public Class MyMath&lt;br /&gt;
&amp;nbsp; Public Function &lt;webmethod()&gt;Add(a As Integer, b As Integer) As Integer&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return a + b&lt;br /&gt;&amp;nbsp; End Function&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C#.&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ WebService Language=&quot;VB&quot; Class=&quot;MyMath&quot; %&amp;gt;&lt;br /&gt;Public Class MyMath&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;[WebMethod]&lt;br /&gt;&amp;nbsp; Public int&amp;nbsp; Add( Int a, Int b ) &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return a + b;&lt;br /&gt;}&lt;br /&gt;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;i&gt;&lt;b&gt;Consuming (Calling) Web Service&lt;/b&gt;&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Web Services can be consumed in 2 ways :&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Select Project / Web site &amp;gt; right-click &amp;gt; Add Web Reference&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Follow the wizard. If you select option “Web service in this solution”, it will do following things&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Creates App_WebReferences folder&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Create localhost having 2 files – &lt;webservicename&gt;.disco &amp;amp; &lt;webservicename&gt;.wsdl&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Then write following code in .aspx &amp;gt; Button click event :&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Here, WebService is the name of the web service.]&lt;/webservicename&gt;&lt;/webservicename&gt;&lt;/webmethod()&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/1698773998746326316/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/07/web-service.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/1698773998746326316'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/1698773998746326316'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/07/web-service.html' title='Web service in asp.net'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-7245205879836931445</id><published>2012-06-26T13:03:00.004+05:30</published><updated>2012-06-26T13:19:25.752+05:30</updated><title type='text'>Get the Table Column data in a single row with comma separator in SQL</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;&lt;br /&gt;
&lt;div style=&quot;text-align: justify;&quot;&gt;&lt;span style=&quot;font-size: 14px; line-height: 19px;&quot;&gt;&lt;span style=&quot;font-family: verdana;&quot;&gt;explaining&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;font-family: verdana; font-size: 14px; line-height: 19px; text-align: justify;&quot;&gt;&amp;nbsp;how to get one column data in a single row with comma separator.&lt;/span&gt;&lt;/div&gt;&lt;span style=&quot;font-family: verdana; font-size: 14px; line-height: 19px; text-align: justify;&quot;&gt;by sql function in sql- 2005/sql- 2008&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: verdana; font-size: 14px; line-height: 19px; text-align: justify;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
Create Table &lt;span style=&quot;color: #cccccc;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;span style=&quot;color: #cccccc;&quot;&gt;tbl_Mail_ids&lt;/span&gt; Contains email_ids&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;CREATE TABLE [dbo].[ tbl_Mail_ids](&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;[ID] [int] IDENTITY(1,1) NOT NULL,&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: #999999;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;&lt;span &gt;[Email_ID] [nvarchar](150) NULL,&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Create Function&amp;nbsp;&lt;span  color: lime;&quot;&gt;Get_Emails&lt;/span&gt;&lt;span &gt;&amp;nbsp;That return email ids in single row seperated by comma&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;ALTER &amp;nbsp;FUNCTION [dbo].[Get_Emails]&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;(&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;@id&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;  &lt;/span&gt;int&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;RETURNS nvarchar(4000)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;AS&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;BEGIN&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt;&lt;span style=&quot;color: Red;&quot;&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span &gt;&lt;span style=&quot;color: Red;&quot;&gt;declare @email_list Nvarchar(Max);&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span &gt;&lt;span style=&quot;color: Red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span &gt;&lt;span style=&quot;color: Red;&quot;&gt;With MyCte AS(&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: lime;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;SELECT &amp;nbsp; &amp;nbsp;&#39; &#39;+ Email_ID&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;FROM &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; tbl_Mail_id&lt;/span&gt;&lt;br /&gt;
&lt;span &gt;&lt;span style=&quot;color: Red;&quot;&gt;)&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;select @ email_list&amp;nbsp;=&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;stuff((&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;select&amp;nbsp; email_list&amp;nbsp;&amp;nbsp;+&#39;# &#39; &amp;nbsp;&lt;span &gt;from mycte&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;color: Red;&quot;&gt;for xml path(&#39;&#39;) ),1,1,&#39;&#39;)&amp;nbsp;&lt;span style=&quot;background-color: white;&quot;&gt;;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot; color: Red;&quot;&gt;&amp;nbsp; Set @email_list&amp;nbsp;&amp;nbsp;= &amp;nbsp;REPLACE(@email_list , &#39;#&#39;, &#39;,&#39;)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot; color: Red;&quot;&gt;&lt;span class=&quot;Apple-tab-span&quot; style=&quot;white-space: pre;&quot;&gt; &lt;/span&gt;RETURN &amp;nbsp; @email_list&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot; color: Red;&quot;&gt;&lt;br /&gt;
&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot; color: Red;&quot;&gt;END&lt;/span&gt;&lt;br /&gt;
Execute function &amp;nbsp;&amp;gt;&amp;gt;&amp;nbsp;&lt;b&gt;&lt;span style=&quot;color: magenta;&quot;&gt;select dbo.&lt;span &gt;Get_Emails()&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/7245205879836931445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/06/get-table-column-data-in-single-row.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/7245205879836931445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/7245205879836931445'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/06/get-table-column-data-in-single-row.html' title='Get the Table Column data in a single row with comma separator in SQL'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-5521192659778670378</id><published>2012-05-31T16:49:00.000+05:30</published><updated>2012-07-09T13:48:24.548+05:30</updated><title type='text'>enable database Service broker in sql server 2005 -2008</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
Enabling Sevice broker in sql server&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1.&lt;/b&gt;&amp;nbsp; Go to Sql server management studio &amp;amp; open Database properties &amp;gt;&amp;gt; options&amp;gt;&amp;gt;&amp;nbsp; Broker enabled set to true&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihtpCibJ8ty1JJEJ9vN75_YIUS_GR8aWDanveUAvZ0fhN_6tGJvBSYm4qI_EtvHR9bs2lmpoVh7_IxLRxfbqI04-UXlpElrWd0kkgtsoRnKNaedavWnlXDkAwGMTe5rWmXA2gcn1d9ub0S/s1600/dffdf.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;352&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihtpCibJ8ty1JJEJ9vN75_YIUS_GR8aWDanveUAvZ0fhN_6tGJvBSYm4qI_EtvHR9bs2lmpoVh7_IxLRxfbqI04-UXlpElrWd0kkgtsoRnKNaedavWnlXDkAwGMTe5rWmXA2gcn1d9ub0S/s400/dffdf.png&quot; width=&quot;400&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
OR&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;STEP 2 :&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Exeute query &amp;gt;&amp;gt; alter database [your database name] set enable_broker&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Alter Database column change size&lt;br /&gt;
&lt;br /&gt;
Query &amp;gt;&amp;gt;&lt;span style=&quot;color: blue;&quot;&gt;ALTER TABLE MyTable ALTER COLUMN NullCOl NVARCHAR(20) NOT NULL; &lt;/span&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/5521192659778670378/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/05/how-to-enable-database-sevice-broker-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/5521192659778670378'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/5521192659778670378'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/05/how-to-enable-database-sevice-broker-in.html' title='enable database Service broker in sql server 2005 -2008'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEihtpCibJ8ty1JJEJ9vN75_YIUS_GR8aWDanveUAvZ0fhN_6tGJvBSYm4qI_EtvHR9bs2lmpoVh7_IxLRxfbqI04-UXlpElrWd0kkgtsoRnKNaedavWnlXDkAwGMTe5rWmXA2gcn1d9ub0S/s72-c/dffdf.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-978108296079904075</id><published>2012-05-28T16:35:00.001+05:30</published><updated>2012-07-09T13:48:01.760+05:30</updated><title type='text'>Calculate number of days in month in sql server</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;br /&gt;
Create simple Scalar - Valued&amp;nbsp; function (UDF)  with input parameter month &amp;amp; Year&lt;br /&gt;
&lt;br /&gt;
Create FUNCTION [dbo].[Days_in_Month]&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; (&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @month int,&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; @year int&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;br /&gt;
RETURNS int&lt;br /&gt;
AS&lt;br /&gt;
BEGIN&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DECLARE @Days int&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;select @Days= datepart(dd,dateadd(dd,-1,dateadd(mm,1,cast(cast(@year as varchar)+&#39;-&#39;+cast(@month as varchar)+&#39;-01&#39; as datetime))))&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; RETURN @Days&lt;br /&gt;
END&lt;br /&gt;
&lt;br /&gt;
Run following script in Query Editor:&lt;br /&gt;
&lt;code style=&quot;font-size: 12px;&quot;&gt;&lt;span style=&quot;color: blue;&quot;&gt;SELECT &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;dbo.&lt;/span&gt;&lt;/code&gt;Days_in_Month&lt;code style=&quot;font-size: 12px;&quot;&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: magenta;&quot;&gt;1,2012&lt;/span&gt;&lt;span style=&quot;color: grey;&quot;&gt;) as &lt;/span&gt;&lt;span style=&quot;color: black;&quot;&gt;NumDaysInMonth&lt;/span&gt;&lt;/code&gt; &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/978108296079904075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/05/calculation-number-of-days-in-month-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/978108296079904075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/978108296079904075'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/05/calculation-number-of-days-in-month-in.html' title='Calculate number of days in month in sql server'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-8275772971911506552</id><published>2012-05-22T12:01:00.002+05:30</published><updated>2012-07-09T13:48:55.377+05:30</updated><title type='text'>Asp.net Questions</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
&lt;b&gt;1. What is ASP?&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
Active
 Server Pages (ASP), also known as Classic ASP, is a Microsoft&#39;s 
server-side technology, which helps in creating dynamic and 
user-friendly Web pages. It uses different scripting languages to create
 dynamic Web pages, which can be run on any type of browser. The Web 
pages are built by using either VBScript or JavaScript and these Web 
pages have access to the same services as Windows application, including
 ADO (ActiveX Data Objects) for database access, SMTP (Simple Mail 
Transfer Protocol) for e-mail, and the entire COM (Component Object 
Model) structure used in the Windows environment. ASP is implemented 
through a dynamic-link library (asp.dll) that is called by the IIS 
server when a Web page is requested from the server.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
&lt;b&gt;2. What is ASP.NET?&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
ASP.NET
 is a specification developed by Microsoft to create dynamic Web 
applications, Web sites, and Web services. It is a part of .NET 
Framework. You can create ASP.NET applications in most of the .NET 
compatible languages, such as Visual Basic, C#, and J#. The ASP.NET 
compiles the Web pages and provides much better performance than 
scripting languages, such as VBScript. The Web Forms support to create 
powerful forms-based Web pages. You can use ASP.NET Web server controls 
to create interactive Web applications. With the help of Web server 
controls, you can easily create a Web application.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
3. What is the basic difference between ASP and ASP.NET?&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
The
 basic difference between ASP and ASP.NET is that ASP is interpreted; 
whereas, ASP.NET is compiled. This implies that since ASP uses VBScript;
 therefore, when an ASP page is executed, it is interpreted. On the 
other hand, ASP.NET uses .NET languages, such as C# and VB.NET, which 
are compiled to Microsoft Intermediate Language (MSIL).&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
&lt;b&gt;4. In which event are the controls fully loaded?&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
Page load event guarantees that all controls are fully loaded. Controls are also accessed in &lt;i class=&quot;dotnet-code&quot;&gt;Page_Init&lt;/i&gt; events but you will see that view state is not fully loaded during this event&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
&lt;b&gt;5. How can we identify that the Page is Post Back?&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
Page object has an &quot;&lt;i class=&quot;dotnet-code&quot;&gt;IsPostBack&lt;/i&gt;&quot; property, which can be checked to know that is the page posted back.&lt;/div&gt;
&lt;/div&gt;
&lt;div class=&quot;tech-div&quot;&gt;
&lt;div class=&quot;tech-question ib-green&quot;&gt;
&lt;b&gt;6. What is the lifespan for items stored in ViewState?&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;tech-answer&quot;&gt;
The items stored in &lt;i class=&quot;dotnet-code&quot;&gt;ViewState&lt;/i&gt; live until the lifetime of the current page expires including the postbacks to the same page.&lt;br /&gt;
&lt;b&gt;7.What are the advantages of the code-behind feature?&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;ul class=&quot;tech-ul-disc&quot;&gt;
&lt;li&gt;Makes code easy to understand and debug by separating application logic from HTML tags
&lt;/li&gt;
&lt;li&gt;Provides the isolation of effort between graphic designers and software engineers
&lt;/li&gt;
&lt;li&gt;Removes the problems of browser incompatibility by providing 
code files to exist on the Web server and supporting Web pages to be 
compiled on demand.
&lt;/li&gt;
&lt;/ul&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/8275772971911506552/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/05/questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/8275772971911506552'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/8275772971911506552'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/05/questions.html' title='Asp.net Questions'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-3438003692562435615</id><published>2012-05-16T13:17:00.000+05:30</published><updated>2012-05-17T15:39:13.123+05:30</updated><title type='text'>Listbox to Listbox Data transfer in Asp.net C#</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSybKoa1cYMknJfwRN-MG4AqLJmJITTV6y2OEz6KohqD2wHZxZoIXtvXmg8wgf_AgXk3GKzHYpBhw-3rJdvLbvF_omFvAhvZUmBvZnNhF6gcwHtTpYWz0DCEPZOW8Jr_iiBZhLDfZMp36A/s1600/listtolist.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;117&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSybKoa1cYMknJfwRN-MG4AqLJmJITTV6y2OEz6KohqD2wHZxZoIXtvXmg8wgf_AgXk3GKzHYpBhw-3rJdvLbvF_omFvAhvZUmBvZnNhF6gcwHtTpYWz0DCEPZOW8Jr_iiBZhLDfZMp36A/s320/listtolist.png&quot; width=&quot;320&quot; /&gt;&amp;nbsp;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
List Box control is a standard control in Asp.net. It is similar to a dropdownlist. &lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
An article to demonstrate How to Move List Box Items to another List Box in ASP.NET and C#.&amp;nbsp;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
CODE&lt;/div&gt;
&lt;h2 class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;

&lt;b style=&quot;color: purple;&quot;&gt;Listbox1 items adding&amp;nbsp; to listbox2 &lt;/b&gt;&lt;/h2&gt;
&lt;b style=&quot;color: #8e7cc3; font-family: inherit;&quot;&gt;protected void btnadditemlist_Click(object sender, EventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ListItem item in listbox1.Items)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.Selected)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (listbox2.Items.Contains(item))&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Display message&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _value = item.Value; //Gets the value of items in list.&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string _text = item.Text;&amp;nbsp; // Gets the Text of items in the list.&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;
&lt;b style=&quot;color: #8e7cc3; font-family: inherit;&quot;&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&amp;nbsp; ListItem items = new ListItem(); //create a list item&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; items.Text = _text;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Assign the values to list item&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; items.Value = _value;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; listbox2.Items.Add(items);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;h3 style=&quot;color: #0b5394; text-align: left;&quot;&gt;

&lt;b&gt;Removing Data from Listbox 2&lt;/b&gt;&lt;/h3&gt;
&lt;div style=&quot;color: #0b5394; text-align: left;&quot;&gt;
&lt;b&gt;protected void Remove_Click(object sender, EventArgs e)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (ListItem item in ListBox2.Items)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (item.Selected)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //ListBox2.Items.Remove(item);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; selectedItems.Add(item);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; for (var i = 0; i &amp;lt; selectedItems.Count; i++)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ListBox2.Items.Remove((ListItem)selectedItems[i]);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/b&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/3438003692562435615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/05/listbox-to-listbox-data-transfer-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3438003692562435615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/3438003692562435615'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/05/listbox-to-listbox-data-transfer-in.html' title='Listbox to Listbox Data transfer in Asp.net C#'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjSybKoa1cYMknJfwRN-MG4AqLJmJITTV6y2OEz6KohqD2wHZxZoIXtvXmg8wgf_AgXk3GKzHYpBhw-3rJdvLbvF_omFvAhvZUmBvZnNhF6gcwHtTpYWz0DCEPZOW8Jr_iiBZhLDfZMp36A/s72-c/listtolist.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-7256521868090478685</id><published>2012-05-11T19:20:00.003+05:30</published><updated>2012-05-11T19:20:35.447+05:30</updated><title type='text'>Clear Drop Down List of Recent Connection From SQL Server Management Studio</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;br /&gt;
&lt;b&gt;&lt;span style=&quot;font-size: large;&quot;&gt;Delete &lt;/span&gt;mru.dat file in xp-os in &lt;strong&gt;Windows7 &lt;/strong&gt;&lt;/b&gt;&lt;b&gt;&lt;strong&gt;Delete&amp;nbsp; &lt;/strong&gt;SqlStudio.bin&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-size: large;&quot;&gt;&amp;nbsp;Sql 2005&lt;/span&gt;&lt;br /&gt;
C:\Documents and Settings\&lt;user&gt;\Application Data\Microsoft\Microsoft SQL Server\90\Tools\Shell\mru.dat
&lt;/user&gt;&lt;br /&gt;
If you can not find mru.dat at above location look for mru.dat in following folder.&lt;br /&gt;
C:\Documents and Settings\[user]\Application Data\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM\mru.dat&lt;br /&gt;

&lt;strong&gt;For SQL Server 2008:&lt;/strong&gt;&lt;br /&gt;
C:\Documents and Settings\&lt;user&gt;\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell\mru.dat&lt;/user&gt;&lt;br /&gt;

If you can not find mru.dat at above location look for mru.dat in following folder.&lt;br /&gt;
C:\Documents and Settings\[user]\Application Data\Microsoft\Microsoft SQL Server\100\Tools\ShellSEM\mru.dat&lt;br /&gt;
&amp;nbsp;&lt;strong&gt;For SQL Server 2008 R2:&lt;/strong&gt;&lt;br /&gt;
&lt;b&gt;&lt;strong&gt;in &lt;/strong&gt;&lt;/b&gt;&lt;strong&gt;Windows7 &lt;/strong&gt;&lt;b&gt;&lt;strong&gt;Delete&amp;nbsp; &lt;/strong&gt;SqlStudio.bin&amp;nbsp; &lt;/b&gt;file from location&lt;br /&gt;

&lt;strong&gt;&lt;/strong&gt;&amp;nbsp; C:\Users\[user]\AppData\Roaming\Microsoft\Microsoft SQL Server\100\Tools\Shell\&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/7256521868090478685/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/05/clear-drop-down-list-of-recent.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/7256521868090478685'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/7256521868090478685'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/05/clear-drop-down-list-of-recent.html' title='Clear Drop Down List of Recent Connection From SQL Server Management Studio'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-94611555801010272</id><published>2012-03-15T13:46:00.002+05:30</published><updated>2012-03-15T13:47:26.042+05:30</updated><title type='text'>Calling WebMethod From Javascript</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;asp&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;:&lt;/span&gt;ScriptManager ID&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;ScriptManager1&quot;&lt;/span&gt; runat&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;server&quot;&lt;/span&gt; 
  EnablePageMethods&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&amp;nbsp;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;script language&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;javascript&quot;&lt;/span&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
 &lt;span style=&quot;color: blue; font-weight: bold;&quot;&gt;function&lt;/span&gt; UpdateTime&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;{&lt;/span&gt;
   PageMethods.&lt;span style=&quot;color: #9900cc;&quot;&gt;GetCurrentDates&lt;/span&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;OnSucceeded, OnFailed&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;;&lt;/span&gt; 
 &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: blue; font-weight: bold;&quot;&gt;function&lt;/span&gt; OnSucceeded&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;result, userContext, methodName&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;{&lt;/span&gt;
   $get&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;lbldate&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39;).innerHTML = result; &lt;/span&gt;
 &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;}&lt;/span&gt;
&amp;nbsp;
 &lt;span style=&quot;color: blue; font-weight: bold;&quot;&gt;function&lt;/span&gt; OnFailed&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #990099; font-weight: bold;&quot;&gt;error&lt;/span&gt;, userContext, methodName&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;{&lt;/span&gt;
   $get&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39;&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;lbldate&lt;/span&gt;&lt;span style=&quot;color: green;&quot;&gt;&#39;).innerHTML = &quot;An error occured.&quot;;&lt;/span&gt;
 &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;}&lt;/span&gt;
&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;script&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;asp&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;:&lt;/span&gt;Label runat&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;server&quot;&lt;/span&gt; ID&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;lbldate&quot;&lt;/span&gt; Text&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Update Me!&quot;&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;/&amp;gt;&amp;lt;&lt;/span&gt;br &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;
&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;lt;&lt;/span&gt;input type&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;button&quot;&lt;/span&gt; id&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Button2&quot;&lt;/span&gt; value&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;Web Method Update&quot;&lt;/span&gt; 
  onclick&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;=&lt;/span&gt;&lt;span style=&quot;color: #cc0000;&quot;&gt;&quot;UpdateTime();&quot;&lt;/span&gt; &lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;div class=&quot;wp_syntax&quot;&gt;
&lt;div class=&quot;code&quot;&gt;
&lt;pre class=&quot;csharp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: black;&quot;&gt;[&lt;/span&gt;WebMethod&lt;span style=&quot;color: black;&quot;&gt;]&lt;/span&gt;
&lt;span style=&quot;color: #0600ff;&quot;&gt;public&lt;/span&gt; &lt;span style=&quot;color: #0600ff;&quot;&gt;static&lt;/span&gt; &lt;span style=&quot;color: red;&quot;&gt;string&lt;/span&gt; GetCurrentDate&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: #0600ff;&quot;&gt;return&lt;/span&gt; DateTime.&lt;span style=&quot;color: blue;&quot;&gt;Now&lt;/span&gt;.&lt;span style=&quot;color: blue;&quot;&gt;ToLongDateString&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: green;&quot;&gt;;&lt;/span&gt;
&lt;span style=&quot;color: black;&quot;&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;pre class=&quot;asp&quot; style=&quot;font-family: monospace;&quot;&gt;&lt;span style=&quot;color: #006600; font-weight: bold;&quot;&gt;&amp;nbsp;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/94611555801010272/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/03/calling-webmethod-from-javacript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/94611555801010272'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/94611555801010272'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/03/calling-webmethod-from-javacript.html' title='Calling WebMethod From Javascript'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-3745570594501467297.post-6021265673759171078</id><published>2012-03-10T13:52:00.003+05:30</published><updated>2012-03-15T13:47:08.297+05:30</updated><title type='text'>Paging in Repeater</title><content type='html'>&lt;div dir=&quot;ltr&quot; style=&quot;text-align: left;&quot; trbidi=&quot;on&quot;&gt;
&lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;Repeater&lt;/span&gt;&lt;/code&gt; and &lt;code&gt;DataList&lt;/code&gt; &lt;span class=&quot;search-highlight&quot;&gt;control&lt;/span&gt;s offer a quick and flexible means of displaying data on a ASPX page. But they offer no &lt;span class=&quot;search-highlight&quot;&gt;paging&lt;/span&gt; functionality built in. The &lt;code&gt;DataGrid&lt;/code&gt; &lt;span class=&quot;search-highlight&quot;&gt;control&lt;/span&gt; has in-built &lt;span class=&quot;search-highlight&quot;&gt;paging&lt;/span&gt; but its structure is more rigid. There are several articles on various &lt;span class=&quot;search-highlight&quot;&gt;ASP.NET&lt;/span&gt; Resource Sites that offer solutions, but I&#39;m going to show you how to use the &lt;code&gt;PagedDataSource&lt;/code&gt; class.&lt;br /&gt;
The &lt;code&gt;PagedDataSource&lt;/code&gt; class encapsulates the properties of the &lt;code&gt;DataGrid&lt;/code&gt; &lt;span class=&quot;search-highlight&quot;&gt;control&lt;/span&gt; that allow it to perform &lt;span class=&quot;search-highlight&quot;&gt;paging&lt;/span&gt;. But we can use the class with &lt;code&gt;&lt;span class=&quot;search-highlight&quot;&gt;Repeater&lt;/span&gt;&lt;/code&gt; and &lt;code&gt;DataList&lt;/code&gt; &lt;span class=&quot;search-highlight&quot;&gt;control&lt;/span&gt;s to perform &lt;span class=&quot;search-highlight&quot;&gt;paging&lt;/span&gt; in much the same way as a &lt;code&gt;DataGrid&lt;/code&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;pre id=&quot;pre0&quot; lang=&quot;vbnet&quot; style=&quot;margin-top: 0pt;&quot;&gt;&lt;span class=&quot;code-keyword&quot;&gt;Private&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt; Page_Load(&lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; sender &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; System.&lt;span class=&quot;code-keyword&quot;&gt;Object&lt;/span&gt;, _
        &lt;span class=&quot;code-keyword&quot;&gt;ByVal&lt;/span&gt; e &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; System.EventArgs) &lt;span class=&quot;code-keyword&quot;&gt;Handles&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;MyBase&lt;/span&gt;.Load
    &lt;span class=&quot;code-comment&quot;&gt;&#39;&lt;/span&gt;&lt;span class=&quot;code-comment&quot;&gt;Put user code to initialize the page here
&lt;/span&gt;    &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; myConnection &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; _
      SqlConnection(ConfigurationSettings.AppSettings(&lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;connectionString&quot;&lt;/span&gt;))
    &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; myDA &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;New&lt;/span&gt; SqlClient.SqlDataAdapter(&lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;Select * from dtsDefect&quot;&lt;/span&gt;, _
                                                             myConnection)
    myDA.Fill(ds, &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;t1&quot;&lt;/span&gt;)
    pageds.DataSource = ds.Tables(&lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;t1&quot;&lt;/span&gt;).DefaultView
    pageds.Allow&lt;span class=&quot;search-highlight&quot;&gt;Paging&lt;/span&gt; = &lt;span class=&quot;code-keyword&quot;&gt;True&lt;/span&gt;
    pageds.PageSize = &lt;span class=&quot;code-digit&quot;&gt;4&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;Dim&lt;/span&gt; curpage &lt;span class=&quot;code-keyword&quot;&gt;As&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Integer&lt;/span&gt;

    &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Not&lt;/span&gt; IsNothing(Request.QueryString(&lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;Page&quot;&lt;/span&gt;)) &lt;span class=&quot;code-keyword&quot;&gt;Then&lt;/span&gt;
        curpage = Convert.ToInt32(Request.QueryString(&lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;Page&quot;&lt;/span&gt;))
    &lt;span class=&quot;code-keyword&quot;&gt;Else&lt;/span&gt;
        curpage = &lt;span class=&quot;code-digit&quot;&gt;1&lt;/span&gt;
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt;

    pageds.CurrentPageIndex = curpage - &lt;span class=&quot;code-digit&quot;&gt;1&lt;/span&gt;
    lblCurrpage.Text = &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;Page: &quot;&lt;/span&gt; + curpage.ToString()

    &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Not&lt;/span&gt; pageds.IsFirstPage &lt;span class=&quot;code-keyword&quot;&gt;Then&lt;/span&gt;
        lnkPrev.NavigateUrl = Request.CurrentExecutionFilePath + _
                                       &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;?Page=&quot;&lt;/span&gt; + &lt;span class=&quot;code-keyword&quot;&gt;CStr&lt;/span&gt;(curpage - &lt;span class=&quot;code-digit&quot;&gt;1&lt;/span&gt;)
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt;

    &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Not&lt;/span&gt; pageds.IsLastPage &lt;span class=&quot;code-keyword&quot;&gt;Then&lt;/span&gt;
        lnkNext.NavigateUrl = Request.CurrentExecutionFilePath + _
                                       &lt;span class=&quot;code-string&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;code-string&quot;&gt;?Page=&quot;&lt;/span&gt; + &lt;span class=&quot;code-keyword&quot;&gt;CStr&lt;/span&gt;(curpage + &lt;span class=&quot;code-digit&quot;&gt;1&lt;/span&gt;)
    &lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;If&lt;/span&gt;

    &lt;span class=&quot;search-highlight&quot;&gt;Repeater&lt;/span&gt;1.DataSource = pageds
    &lt;span class=&quot;search-highlight&quot;&gt;Repeater&lt;/span&gt;1.DataBind()
&lt;span class=&quot;code-keyword&quot;&gt;End&lt;/span&gt; &lt;span class=&quot;code-keyword&quot;&gt;Sub&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://programingsolution.blogspot.com/feeds/6021265673759171078/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://programingsolution.blogspot.com/2012/03/repeater-and-datalist-control-s-offer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/6021265673759171078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3745570594501467297/posts/default/6021265673759171078'/><link rel='alternate' type='text/html' href='http://programingsolution.blogspot.com/2012/03/repeater-and-datalist-control-s-offer.html' title='Paging in Repeater'/><author><name>jaividarbhanews</name><uri>http://www.blogger.com/profile/01973565364440059000</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>