Skip to main content

Posts

Showing posts from January, 2013

Export DataTable to PDF

Export DataTable to PDF Step 1 : Import the namespaces using iTextSharp.text; using iTextSharp.text.pdf; using iTextSharp.text.html; using iTextSharp.text.html.simpleparser; Step 2 : Add the Export Method public void ExportToPdf( DataTable dt) { Document document = new Document (); //string Filename = GetUniqueName(4); PdfWriter writer = PdfWriter .GetInstance(document, new FileStream (Server.MapPath( "PDF/testpdf.pdf" ), FileMode .Create)); document.Open(); //iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance("c://ggi logo.bmp"); //document.Add(img); iTextSharp.text. Font font5 = iTextSharp.text. FontFactory .GetFont( FontFactory .HELVETICA, 5); //float[] columnDefinitionSize = { 22F, 22F, 12F, 7.75F, 7.77F, 7.77F, 7.77F, 7.77F, 10.88F, 10.88F, 10.88F, 4.75F, 7.77F, 7.77F, 7.77F, 7.77F, 7.77F, 7.77F, 9F }; PdfPTable

CSS Tool TIP

Step 1 : Add Style sheet below the header Tag < style type ="text/css"> .tooltip { border-bottom : 1px dotted #000000 ; color : #000000 ; outline : none ; cursor : help ; text-decoration : blink ; position : relative ; } .tooltip span { margin-left : -999em ; position : absolute ; } .tooltip:hover span { border-radius : 5px 5px ; -moz-border-radius : 5px ; -webkit-border-radius : 5px ; box-shadow : 5px 5px 5px rgba(0, 0, 0, 0.1) ; -webkit-box-shadow : 5px 5px rgba(0, 0, 0, 0.1) ; -moz-box-shadow : 5px 5px rgba(0, 0, 0, 0.1) ; font-family : Calibri, Tahoma, Geneva, sans-serif ; position : absolute ; left : 1em ; top : 2em ; z-index : 99 ; margin-left : 0 ; width : 250px ; } .tooltip:hover img { border : 0 ; margin : -10px 0 0 -55px ; float : left ; position : absolute ; } .tooltip:hover em { font-family : Candara, Tahoma, Geneva

Pop-up div on hover

Pop-up div on hover use the below code to popup the text and Develop the Code... <!DOCTYPE html> <html lang="en">   <head>     <meta charset="utf-8" />     <title>jQuery Tutorial - Pop-up div on hover</title>     <style type="text/css">             h1, h3 {         margin: 0;         padding: 0;         font-weight: normal;       }             a {         color: #EB067B;       }             div#container {         width: 580px;         margin: 100px auto 0 auto;         padding: 20px;         border: 1px solid #1a1a1a;       }             /* HOVER STYLES */       div#pop-up {         display: none;         position: absolute;         width: 280px;         padding: 10px;         background: #eeeeee;         color: #000000;         border: 1px solid #1a1a1a;         font-size: 90%;       }     </style>     <script type="text/javascript" src="https

CSS mouseover for text

CSS mouseover for text on Mouse over text to be displayed by CSS. Mouseover with a text paragraph <span class="dropt" title="Title for the pop-up">Hot Zone Text <span style="width:500px;">Pop-up text</span> </span> CSS code for class dropt: span.dropt {border-bottom: thin dotted; background: #ffeedd;} span.dropt:hover {text-decoration: none; background: #ffffff; z-index: 6; } span.dropt span {position: absolute; left: -9999px; margin: 20px 0 0 0px; padding: 3px 3px 3px 3px; border-style:solid; border-color:black; border-width:1px; z-index: 6;} span.dropt:hover span {left: 2%; background: #ffffff;} span.dropt span {position: absolute; left: -9999px; margin: 4px 0 0 0px; padding: 3px 3px 3px 3px; border-style:solid; border-color:black; border-width:1px;} span.dropt:hover span {margin: 20px 0 0 170px; background: #ffffff; z-index:6;}

PNR Status by web Scraping Method (ASP.NET) C#

To Get the PNR Status by web Scraping Method Steps to Execute the Function Step 1 : Add the below method in your Form and Pass the PNR Number arguement public string GetPNRStatus( string sPNR) { string URI = "http://www.indianrail.gov.in/cgi_bin/inet_pnrstat_cgi.cgi" ; string Parameters = Uri .EscapeUriString( "lccp_pnrno1=" +sPNR+ "&amp;submitpnr=Get Status" ); System.Net. HttpWebRequest req = ( HttpWebRequest )System.Net. WebRequest .Create(URI); //HTTP POST Headers req.ContentType = "application/x-www-form-urlencoded" ; req.Host = "www.indianrail.gov.in" ; //You can use your own user-agent. req.UserAgent = "Mozilla/5.0 (compatible; MSIE 7.0; Windows Phone OS 7.5; Trident/5.0; IEMobile/9.0) DELL;Venue Pro" ; req.Headers.Add( HttpRequestHeader .AcceptLanguage, "en-us,en;q=0.5" ); req.Headers.Add( HttpRequestHeader .AcceptCharset, "ISO-8859-1,utf-8;q=

Random String Generator

Random String Generator Function Public string RandomString() { StringBuilder objSB = new StringBuilder (); Random objRandom = new Random (); char ch; for ( int i = 0; i < 4; i++) { ch = Convert .ToChar( Convert .ToInt32( Math .Floor(26 * objRandom.NextDouble() + 65))); int x = objRandom.Next(1, 4); if (x == i) ch = Convert .ToChar(ch.ToString().ToUpper()); else ch = Convert .ToChar(ch.ToString().ToLower()); objSB.Append(ch); } return objSB.ToString(); }