<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-8996795397710165839</id><updated>2012-02-09T03:24:26.034-08:00</updated><category term='How to do?'/><category term='Sting Manupulation'/><category term='Sql Server Interview Questions'/><category term='CSS StyleSheet'/><category term='Errors and Solutions'/><category term='GridView'/><category term='Page Life Cycle of an ASP.NET'/><category term='Deployment'/><category term='Free software Download link'/><category term='AJAX'/><category term='ASP.NET Validation Controls'/><category term='SqlServer'/><category term='DropDownList'/><category term='JavaScript'/><category term='Interview'/><category term='ASP.NET'/><title type='text'>ASP.NET , CSHARP Code, Examples samples and tutorials</title><subtitle type='html'>Sharing ASP.NET knowledge and experience.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>87</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1543790955199125447</id><published>2011-12-06T00:57:00.000-08:00</published><updated>2011-12-06T01:01:17.163-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Export DataSet to XML File</title><content type='html'>&lt;span style="font-style:italic;"&gt;create xml file from a dataset&lt;/span&gt;&lt;br /&gt;This code snippet show how to export DataSet to xml file.Here we have taken data from database and fill dataset.We have taken a aspx page and a button there,after clicking the button a xml file will be created at specified location.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; public void CreateXml()  &lt;br /&gt;   {  &lt;br /&gt;     DataSet ds = new DataSet();  &lt;br /&gt;     SqlDataAdapter da = new SqlDataAdapter("usp_GetAddressDetails",con);  &lt;br /&gt;     da.Fill(ds);  &lt;br /&gt;     if (ds.Tables[0].Rows.Count &amp;gt; 0)  &lt;br /&gt;     {  &lt;br /&gt;       GridView1.DataSource = ds;  &lt;br /&gt;       GridView1.DataBind();  &lt;br /&gt;     }  &lt;br /&gt;     StreamWriter objStreamWriter = new StreamWriter("E:\\Santosh\\Practices\\ASP\\XMLFiles\\EmpAddress.xml", false);  &lt;br /&gt;     ds.WriteXml(objStreamWriter);  &lt;br /&gt;     objStreamWriter.Close();  &lt;br /&gt;   }  &lt;br /&gt;   protected void Button1_Click(object sender, EventArgs e)  &lt;br /&gt;   {  &lt;br /&gt;     CreateXml();  &lt;br /&gt;   }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1543790955199125447?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1543790955199125447/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/12/export-dataset-to-xml-file.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1543790955199125447'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1543790955199125447'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/12/export-dataset-to-xml-file.html' title='Export DataSet to XML File'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4687755952287533745</id><published>2011-12-05T04:15:00.000-08:00</published><updated>2011-12-06T01:01:17.164-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Insert XML data into SQL Server 2008</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Insert XML data into SQL Server database&lt;/span&gt;&lt;br /&gt;This article provides basic idea about how to insert xml data into sql server database.&lt;br /&gt;I have given example here how to insert employee address information (EmpAddress.xml) which is an xml file to insert into database.&lt;br /&gt;System.Xml namespace required for manupulation of xml.&lt;br /&gt;&lt;br /&gt;XML File&lt;br /&gt;&lt;!-- code formatted by http://manoli.net/csharpformat/ --&gt;&lt;br /&gt;&lt;pre class="csharpcode"&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EmpAddress&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;E001&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Mumbai&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Maharashtra&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;India&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;E002&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Mumbai&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Maharashtra&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;India&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;E003&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Delhi&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Delhi&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;India&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;E012&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;EmpCode&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Surat&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;City&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Gujrat&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;State&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;India&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Country&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;Address&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;EmpAddress&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void Button1_Click(object sender, EventArgs e)  &lt;br /&gt; {  &lt;br /&gt; string EmpCode = null;  &lt;br /&gt; string City = null;  &lt;br /&gt; string State = null;  &lt;br /&gt; string Country = null;  &lt;br /&gt; string str = null;  &lt;br /&gt; SqlConnection con = new SqlConnection("Data Source=localhost;Initial Catalog=Test;Integrated Security=True");  &lt;br /&gt; XmlDocument document = new XmlDocument();  &lt;br /&gt; document.Load("E:\\Santosh\\EmpAddress.xml");  &lt;br /&gt; XmlNodeList xmlNodeList = document.SelectNodes("EmpAddress/Address");  &lt;br /&gt; foreach (XmlNode node in xmlNodeList)  &lt;br /&gt; {  &lt;br /&gt; EmpCode = node["EmpCode"].InnerText;  &lt;br /&gt; City = node["City"].InnerText;  &lt;br /&gt; State = node["State"].InnerText;  &lt;br /&gt; Country = node["Country"].InnerText;  &lt;br /&gt; str = "INSERT INTO AddressDetail (EmpCode,City,State,Country) values ('" + EmpCode + "', '" + City + "','" + State + "','" + Country + "')";  &lt;br /&gt; SqlCommand cmd = new SqlCommand();  &lt;br /&gt; cmd = new SqlCommand(str, con);  &lt;br /&gt; cmd.CommandType = CommandType.Text;  &lt;br /&gt; con.Open();  &lt;br /&gt; cmd.ExecuteNonQuery();  &lt;br /&gt; con.Close();  &lt;br /&gt; }  &lt;br /&gt; }   &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4687755952287533745?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4687755952287533745/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/12/insert-xml-data-into-sql-server-2008.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4687755952287533745'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4687755952287533745'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/12/insert-xml-data-into-sql-server-2008.html' title='Insert XML data into SQL Server 2008'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1605017108535546484</id><published>2011-03-27T03:18:00.000-07:00</published><updated>2011-12-06T01:13:17.136-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Create PDF from DataTable in Asp.net</title><content type='html'>In this article ,i am explaining you how to create pdf file from datatable.i am passing a datatable in this function and code to convert this in pdf file.&lt;br /&gt;&lt;br /&gt;I am using iTextSharp you can download it from internet. it is free.&lt;br /&gt;you need to create a simple asp.net page and get data from database.Then pass it to ExportToPDF method.We can set PDF page margins, change page orientation (portrait, landscape), customize headers and footers add page numbers and more.Do some R &amp; D with iTextSharp.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; public void ExportToPdf(DataTable myDataTable)  &lt;br /&gt;   {      &lt;br /&gt;     Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10);  &lt;br /&gt;     try  &lt;br /&gt;     {  &lt;br /&gt;       PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);  &lt;br /&gt;       pdfDoc.Open();  &lt;br /&gt;       Chunk c = new Chunk("" + System.Web.HttpContext.Current.Session["CompanyName"] + "", FontFactory.GetFont("Verdana", 11));  &lt;br /&gt;       Paragraph p = new Paragraph();  &lt;br /&gt;       p.Alignment = Element.ALIGN_CENTER;  &lt;br /&gt;       p.Add(c);  &lt;br /&gt;       pdfDoc.Add(p);  &lt;br /&gt;       string clientLogo = System.Web.HttpContext.Current.Session["CompanyName"].ToString();  &lt;br /&gt;       clientLogo = clientLogo.Replace(" ", "");  &lt;br /&gt;       string clogo = clientLogo + ".jpg";  &lt;br /&gt;       string imageFilePath = System.Web.HttpContext.Current.Server.MapPath("../ClientLogo/" + clogo + "");  &lt;br /&gt;       iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath);  &lt;br /&gt;       //Resize image depend upon your need   &lt;br /&gt;       jpg.ScaleToFit(80f, 60f);  &lt;br /&gt;       //Give space before image   &lt;br /&gt;       jpg.SpacingBefore = 0f;  &lt;br /&gt;       //Give some space after the image   &lt;br /&gt;       jpg.SpacingAfter = 1f;  &lt;br /&gt;       jpg.Alignment = Element.HEADER;  &lt;br /&gt;       pdfDoc.Add(jpg);  &lt;br /&gt;       Font font8 = FontFactory.GetFont("ARIAL", 7);  &lt;br /&gt;       DataTable dt = myDataTable;  &lt;br /&gt;       if (dt != null)  &lt;br /&gt;       {  &lt;br /&gt;         //Craete instance of the pdf table and set the number of column in that table  &lt;br /&gt;         PdfPTable PdfTable = new PdfPTable(dt.Columns.Count);  &lt;br /&gt;         PdfPCell PdfPCell = null;  &lt;br /&gt;         for (int rows = 0; rows &amp;lt; dt.Rows.Count; rows++)  &lt;br /&gt;         {  &lt;br /&gt;           for (int column = 0; column &amp;lt; dt.Columns.Count; column++)  &lt;br /&gt;           {  &lt;br /&gt;             PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Rows[rows][column].ToString(), font8)));  &lt;br /&gt;             PdfTable.AddCell(PdfPCell);  &lt;br /&gt;           }  &lt;br /&gt;         }  &lt;br /&gt;         //PdfTable.SpacingBefore = 15f; // Give some space after the text or it may overlap the table            &lt;br /&gt;         pdfDoc.Add(PdfTable); // add pdf table to the document   &lt;br /&gt;       }  &lt;br /&gt;       pdfDoc.Close();  &lt;br /&gt;       Response.ContentType = "application/pdf";  &lt;br /&gt;       Response.AddHeader("content-disposition", "attachment; filename= SampleExport.pdf");  &lt;br /&gt;       System.Web.HttpContext.Current.Response.Write(pdfDoc);  &lt;br /&gt;       Response.Flush();  &lt;br /&gt;       Response.End();  &lt;br /&gt;       //HttpContext.Current.ApplicationInstance.CompleteRequest();  &lt;br /&gt;     }  &lt;br /&gt;     catch (DocumentException de)  &lt;br /&gt;     {  &lt;br /&gt;       System.Web.HttpContext.Current.Response.Write(de.Message);  &lt;br /&gt;     }  &lt;br /&gt;     catch (IOException ioEx)  &lt;br /&gt;     {  &lt;br /&gt;       System.Web.HttpContext.Current.Response.Write(ioEx.Message);  &lt;br /&gt;     }  &lt;br /&gt;     catch (Exception ex)  &lt;br /&gt;     {  &lt;br /&gt;       System.Web.HttpContext.Current.Response.Write(ex.Message);  &lt;br /&gt;     }  &lt;br /&gt;   }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1605017108535546484?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1605017108535546484/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/03/create-pdf-from-datatable-in-aspnet.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1605017108535546484'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1605017108535546484'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2011/03/create-pdf-from-datatable-in-aspnet.html' title='Create PDF from DataTable in Asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2612691728953642613</id><published>2010-12-29T07:44:00.000-08:00</published><updated>2011-12-06T01:18:23.103-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Multiple file upload in asp.net</title><content type='html'>This code show how to upload multiple file and save to database using asp.net and c#.      &lt;br /&gt; &lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; HttpFileCollection hFileCollection = HttpContext.Current.Request.Files;  &lt;br /&gt;     for (int i = 0; i &amp;lt;= hFileCollection.Count; i++)  &lt;br /&gt;     {  &lt;br /&gt;          HttpPostedFile hPostedFile = hFileCollection[i];  &lt;br /&gt;          if (hPostedFile.ContentLength &amp;gt; 0)  &lt;br /&gt;           {  &lt;br /&gt;             Stream fs = hFileCollection[i].InputStream;  &lt;br /&gt;             int ImgLength = hFileCollection[i].ContentLength;  &lt;br /&gt;             string contenttype = hFileCollection[i].ContentType;  &lt;br /&gt;             string filePath = Path.GetFullPath(hFileCollection[i].FileName);  &lt;br /&gt;             string filename = Path.GetFileName(filePath);  &lt;br /&gt;             string extension = Path.GetExtension(hFileCollection[i].FileName).ToLower();  &lt;br /&gt;             byte[] BinaryData = new byte[ImgLength];  &lt;br /&gt;             int n = fs.Read(BinaryData, 0, ImgLength);  &lt;br /&gt;             int DrawingID = objbztDrawingMasterBLL.CreateDrawingMaster(objbztDrawingMasterCls);  &lt;br /&gt;             objbztDrawingMasterCls.DfileName = filename;  &lt;br /&gt;             objbztDrawingMasterCls.FileConetentType = contenttype;  &lt;br /&gt;             objbztDrawingMasterCls.FileData = BinaryData;  &lt;br /&gt;             if (extension == ".doc" || extension == ".docx" || extension == ".xls" || extension == ".xlsx" || extension == ".jpg" || extension == ".png" || extension == ".gif" || extension == ".pdf")  &lt;br /&gt;             {  &lt;br /&gt;               string cmdstr = "INSERT INTO tblDtFiles(DID,DFileName,FileConetentType,FileData) VALUES(" + DID + "," + Convert.ToString(filename) + "," + Convert.ToString(contenttype) + "," + BinaryData + ")";  &lt;br /&gt;               SqlHelper.ExecuteNonQuery(connectionString, CommandType.Text, cmdstr);  &lt;br /&gt;             }  &lt;br /&gt;             else  &lt;br /&gt;             {  &lt;br /&gt;               msg.Text = "Uploaded file should be doc/xls/jpg/png/gif/pdf...!";  &lt;br /&gt;             }  &lt;br /&gt;         }  &lt;br /&gt;     }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2612691728953642613?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2612691728953642613/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/12/multiple-file-upload-in-aspnet.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2612691728953642613'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2612691728953642613'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/12/multiple-file-upload-in-aspnet.html' title='Multiple file upload in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4799327362053048046</id><published>2010-10-21T06:20:00.001-07:00</published><updated>2011-12-22T02:31:27.125-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Rounded off total income</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Rounded off total income&lt;/span&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt;       Int32 roundedAmt;  &lt;br /&gt;       Int32 torounded = Convert.ToInt32(lblTotalIncome.Text);  &lt;br /&gt;       int lastdigit = torounded % 10;  &lt;br /&gt;       if (lastdigit &amp;gt;= 5)  &lt;br /&gt;       {  &lt;br /&gt;         roundedAmt = torounded - lastdigit + 10;  &lt;br /&gt;       }  &lt;br /&gt;       else  &lt;br /&gt;       {  &lt;br /&gt;         roundedAmt = torounded - lastdigit;  &lt;br /&gt;       }  &lt;br /&gt;       lblRoundedOf.Text = Convert.ToString(roundedAmt);  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4799327362053048046?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4799327362053048046/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/rounded-off-total-income.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4799327362053048046'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4799327362053048046'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/rounded-off-total-income.html' title='Rounded off total income'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3640500223580202346</id><published>2010-10-11T01:03:00.000-07:00</published><updated>2010-10-11T01:08:12.133-07:00</updated><title type='text'>Enable and disable textbox when checked the checkbox</title><content type='html'>Here code show how enable and disble textbox when user checked the textbox.&lt;br /&gt;code disble the row which contain the textbox.you can also take only checkbox&lt;br /&gt;to enable and disble not neccessary to disble row.&lt;br /&gt;&lt;br /&gt;function showHide()&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;    var chkSignature =  document.getElementById('ctl00_ContentPlaceHolder1_tabContainer_pnl_chkSign');&lt;br /&gt;    var trsign = document.getElementById('ctl00_ContentPlaceHolder1_tabContainer_pnl_trsign');&lt;br /&gt;    if(chkSignature.checked)&lt;br /&gt;    {&lt;br /&gt;  if(trsign != null)&lt;br /&gt;  {&lt;br /&gt;    trsign.style.display = '';&lt;br /&gt;  }&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {   &lt;br /&gt;  if(trsign != null)&lt;br /&gt;  {&lt;br /&gt;    trsign.style.display = 'none';&lt;br /&gt;  }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&amp;lt;tr&amp;gt;&lt;br /&gt;    &amp;lt;td style="height: 22px; width: 180px;"&amp;gt;&lt;br /&gt;    &amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;td align="left" colspan="3" style="height: 22px; text-align: left"&amp;gt;&lt;br /&gt; &amp;lt;asp:CheckBox ID="chkSignature" runat="server" Text="Show Signature" onclick="showHide()"/&amp;gt;&lt;br /&gt;    &amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&amp;lt;tr id="trsign" runat="server" style="display:none"&amp;gt;&lt;br /&gt;    &amp;lt;td style="height: 22px; width: 180px;"&amp;gt;&lt;br /&gt;    &amp;lt;/td&amp;gt;&lt;br /&gt;    &amp;lt;td align="left" colspan="3" style="height: 22px; text-align: left"&amp;gt;&lt;br /&gt; &amp;lt;asp:TextBox ID="txtSignature" runat="server" Width="350px" TextMode="MultiLine" &amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;    &amp;lt;/td&amp;gt;&lt;br /&gt;&amp;lt;/tr&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3640500223580202346?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3640500223580202346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/enable-and-disable-textbox-when-checked.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3640500223580202346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3640500223580202346'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/enable-and-disable-textbox-when-checked.html' title='Enable and disable textbox when checked the checkbox'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5786945914232478761</id><published>2010-10-10T03:23:00.001-07:00</published><updated>2011-12-20T04:12:25.218-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DropDownList'/><title type='text'>Bind DropDownList using SqlDataReader</title><content type='html'>This code  pulling out data from a database into a data reader is as follows.&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void Page_Load(object sender, EventArgs e)  &lt;br /&gt; {  &lt;br /&gt;      if (!Page.IsPostBack)  &lt;br /&gt;      {  &lt;br /&gt;        bindDDL();  &lt;br /&gt;      }  &lt;br /&gt; }  &lt;br /&gt; Public void bindDDL()  &lt;br /&gt; {  &lt;br /&gt;      SqlConnection con =new SqlConnection(ConfigurationManager.  &lt;br /&gt;      ConnectionStrings["ConnectionString"].ConnectionString.ToString();)  &lt;br /&gt;      SqlCommand cmd=new SqlCommand();  &lt;br /&gt;      cmd.connection=con;  &lt;br /&gt;      con.open();  &lt;br /&gt;      cmd.commandText="SELECT Citiid,CitiName FROM tableCity";  &lt;br /&gt;      SqlDataReader dr;   &lt;br /&gt;      dr=cmd.ExecuteReader();  &lt;br /&gt;      ddlname.DataSource =dr;  &lt;br /&gt;      ddlname.DataTextField = "CitiName";  &lt;br /&gt;      ddlname.DataValueField = "Citiid";  &lt;br /&gt;      ddlname.DataBind();  &lt;br /&gt;      dr.close();   &lt;br /&gt;      con.close();  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5786945914232478761?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5786945914232478761/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/dropdownlist.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5786945914232478761'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5786945914232478761'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/dropdownlist.html' title='Bind DropDownList using SqlDataReader'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-302891030660170466</id><published>2010-10-09T06:38:00.000-07:00</published><updated>2011-01-09T06:40:33.721-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Get duplicated record from sql server table</title><content type='html'>Here query describes how to find duplicate record from a table in sql server&lt;br /&gt;&lt;br /&gt;SELECT User_ID FROM tbl_Member&lt;br /&gt;GROUP BY User_ID&lt;br /&gt;HAVING count( * ) &gt; 1&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-302891030660170466?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/302891030660170466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/get-duplicated-record-from-sql-server.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/302891030660170466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/302891030660170466'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/get-duplicated-record-from-sql-server.html' title='Get duplicated record from sql server table'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2816560709964522871</id><published>2010-10-01T00:12:00.000-07:00</published><updated>2010-10-03T00:13:08.957-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Refresh the aspx page automatically</title><content type='html'>This small code refresh the aspx page automatically.&lt;br /&gt;Set the time according to your requirment in content="time in sec".&lt;br /&gt;&lt;br /&gt;&amp;lt;head runat="server"&amp;gt;&lt;br /&gt;    &amp;lt;title&amp;gt;Untitled Page&amp;lt;/title&amp;gt;&lt;br /&gt;    &amp;lt;meta http-equiv="refresh" content="20" /&amp;gt;   &lt;br /&gt;&amp;lt;/head&amp;gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2816560709964522871?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2816560709964522871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/refresh-aspx-page-automatically.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2816560709964522871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2816560709964522871'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/refresh-aspx-page-automatically.html' title='Refresh the aspx page automatically'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5547978239026956097</id><published>2010-09-30T06:16:00.000-07:00</published><updated>2010-11-24T08:05:32.687-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>select data from one database and insert into another table</title><content type='html'>insert into tblMonthMst&lt;br /&gt;select * from EMPMain.[dbo].[tblMonthMst]&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5547978239026956097?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5547978239026956097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/select-data-from-one-database-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5547978239026956097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5547978239026956097'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/select-data-from-one-database-and.html' title='select data from one database and insert into another table'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6649380655245556641</id><published>2010-09-29T04:19:00.001-07:00</published><updated>2010-09-29T04:19:47.426-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Sql Server query Optimization</title><content type='html'>Optimization in Practice &lt;br /&gt;&lt;br /&gt;Example 1:&lt;br /&gt;I want to retrieve the name and salary of the employees of the R&amp;D department.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Original:&lt;br /&gt;Query : Select * From Employees&lt;br /&gt;In Program : Add a filter on Dept or use command : if Dept =  R&amp;D-- &lt;br /&gt;&lt;br /&gt;Corrected :&lt;br /&gt;Select Name, Salary From Employees Where Dept =  R&amp;D-- &lt;br /&gt;&lt;br /&gt;In the corrected version, the DB filters data because it filters faster than the program.&lt;br /&gt;Also, you only need the Name and Salary, so only ask for that.&lt;br /&gt;The data that travels on the network will be much smaller, and therefore your performances will improve. &lt;br /&gt;&lt;br /&gt;Example 2 (Sorting): &lt;br /&gt;&lt;br /&gt;Original:&lt;br /&gt;Select Name, Salary&lt;br /&gt;From Employees&lt;br /&gt;Where Dept = 'R&amp;D'&lt;br /&gt;Order By Salary &lt;br /&gt;&lt;br /&gt;Do you need that Order By Clause? Often, people use Order By in development to make sure returned data are ok; remove it if you don't need it.&lt;br /&gt;If you need to sort the data, do it in the query, not in the program.&lt;br /&gt;&lt;br /&gt;Example 3:&lt;br /&gt;Original:&lt;br /&gt;For i = 1 to 2000&lt;br /&gt;Call Query : Select salary From Employees Where EmpID = Parameter(i) &lt;br /&gt;&lt;br /&gt;Corrected:&lt;br /&gt;Select salary From Employees Where EmpID &gt;= 1 and EmpID &lt;= 2000 &lt;br /&gt;&lt;br /&gt;The original Query involves a lot of network bandwidth and will make your whole system slow.&lt;br /&gt;You should do as much as possible in the Query or Stored Procedure. Going back and forth is plain stupid.&lt;br /&gt;Although this example seems simple, there are more complex examples on that theme.&lt;br /&gt;Sometimes, the processing is so great that you think it's better to do it in the code but it's probably not.&lt;br /&gt;Sometimes, your Stored Procedure will be better off creating a temporary table, inserting data in it and returning it than going back and forth 10,000 times. &lt;br /&gt;You might have a slower query that saves time on a greater number of records or that saves bandwidth.&lt;br /&gt;&lt;br /&gt;Example 4 (Weak Joins):&lt;br /&gt;You have two tables Orders and Customers. Customers can have many orders. &lt;br /&gt;&lt;br /&gt;Original:&lt;br /&gt;Select O.ItemPrice, C.Name&lt;br /&gt;From Orders O, Customers C &lt;br /&gt;&lt;br /&gt;Corrected:&lt;br /&gt;Select O.ItemPrice, C.Name&lt;br /&gt;From Orders O, Customers C&lt;br /&gt;Where O.CustomerID = C.CustomerID &lt;br /&gt;&lt;br /&gt;In that case, the join was not there at all or was not there on all keys. That would return so many records that your query might take hours. &lt;br /&gt;It's a common mistake for beginners. &lt;br /&gt;&lt;br /&gt;Corrected 2:&lt;br /&gt;Depending on the DB you use, you will need to specify the Join type you want in different ways.&lt;br /&gt;In SQL Server, the query would need to be corrected to:&lt;br /&gt;&lt;br /&gt;Select O.ItemPrice, C.Name&lt;br /&gt;From Orders O INNER JOIN Customers C ON O.CustomerID = C.CustomerID &lt;br /&gt;&lt;br /&gt;Choose the good join type (INNER, OUTER, LEFT, ...).&lt;br /&gt;Note that in SQL Server, Microsoft suggests you use the joins like in the Corrected 2 instead of the joins in the Where Clause because it will be more optimized. &lt;br /&gt;&lt;br /&gt;Example 5 (Weak Filters):&lt;br /&gt;This is a more complicated example, but it illustrates filtering at its best.&lt;br /&gt;We have two tables -- Products (ProductID, DescID, Price) and Description(DescID, LanguageID, Text). There are 100,000 Products and unfortunately we need them all.&lt;br /&gt;There are 100 languages (LangID = 1 = English). We only want the English descriptions for the products.&lt;br /&gt;&lt;br /&gt;We are expecting 100 000 Products (ProductName, Price). &lt;br /&gt;&lt;br /&gt;First try:&lt;br /&gt;Select D.Text As ProductName, P.Price&lt;br /&gt;From Products P INNER JOIN Description D On P.DescID = D.DescID&lt;br /&gt;Where D.LangID = 1 &lt;br /&gt;&lt;br /&gt;That works but it will be really slow because your DB needs to match 100,000 records with 10,000,000 records and then filter that Where LangID = 1.&lt;br /&gt;The solution is to filter On LangID = 1 before joining the tables. &lt;br /&gt;&lt;br /&gt;Corrected:&lt;br /&gt;Select D.Text As ProductName, P.Price&lt;br /&gt;From (Select DescID, Text From Description Where D.LangID = 1) D&lt;br /&gt;INNER JOIN Products P On D.DescID = P.DescID &lt;br /&gt;&lt;br /&gt;Now, that will be much faster. You should also make that query a Stored Procedure to make it faster. &lt;br /&gt;&lt;br /&gt;Example 6 (Views):&lt;br /&gt;Create View v_Employees AS&lt;br /&gt;Select * From Employees &lt;br /&gt;&lt;br /&gt;Select * From v_Employees &lt;br /&gt;&lt;br /&gt;This is just like running Select * From Employees twice.&lt;br /&gt;You should not use the view in that case. &lt;br /&gt;&lt;br /&gt;If you were to always use the data for employees of R&amp;D and would not like to give the rights to everyone on that table because of salaries being confidential, &lt;br /&gt;you could use a view like that:&lt;br /&gt;&lt;br /&gt;Create View v_R&amp;DEmployees AS&lt;br /&gt;Select Name, Salary From Employees Where Dept = 1&lt;br /&gt;(Dept 1 is R&amp;D). &lt;br /&gt;&lt;br /&gt;You would then give the rights to View v_R&amp;DEmployees to some people and would restrict the rights to Employees table to the DBA only.&lt;br /&gt;&lt;br /&gt;That would be a possibly good use of views.&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6649380655245556641?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6649380655245556641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/sql-server-query-optimization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6649380655245556641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6649380655245556641'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/sql-server-query-optimization.html' title='Sql Server query Optimization'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8853319581063093317</id><published>2010-09-18T07:33:00.002-07:00</published><updated>2011-12-20T04:29:00.643-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>GridView with checkbox</title><content type='html'>This article is very simple.Many time developer need to how develop Gridview with checkbox,so we can select single or multiple record to update.&lt;br /&gt;Javascript file&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;script language="javascript" type="text/javascript"&amp;gt;  &lt;br /&gt;      function SelectAllCheckboxes(spanChk)  &lt;br /&gt;      {  &lt;br /&gt;           var oItem = spanChk.children;  &lt;br /&gt;           var theBox=(spanChk.type=="checkbox")?spanChk:spanChk.children.item[0];  &lt;br /&gt;           xState=theBox.checked;  &lt;br /&gt;           elm=theBox.form.elements;  &lt;br /&gt;           for(i=0;i if(elm[i].type=="checkbox" &amp;amp;&amp;amp; elm[i].id!=theBox.id)  &lt;br /&gt;           {   &lt;br /&gt;                if(elm[i].checked!=xState)  &lt;br /&gt;                elm[i].click();   &lt;br /&gt;           }  &lt;br /&gt;      }  &lt;br /&gt; &amp;lt;/script&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Html code&lt;br /&gt;&lt;br /&gt;    &lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;form id="form1" runat="server"&amp;gt;  &lt;br /&gt;      &amp;lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="CustomerID" Width="366px" CellPadding="4" ForeColor="#333333" GridLines="None"&amp;gt;  &lt;br /&gt;           &amp;lt;Columns&amp;gt;  &lt;br /&gt;                &amp;lt;asp:CommandField ShowSelectButton="True" /&amp;gt;  &lt;br /&gt;                &amp;lt;asp:BoundField DataField="CustomerID" HeaderText="CustomerID" InsertVisible="False" ReadOnly="True" SortExpression="PersonID" /&amp;gt;  &lt;br /&gt;                &amp;lt;asp:BoundField DataField="Fname" HeaderText="Fname" SortExpression="Fname" /&amp;gt;  &lt;br /&gt;                &amp;lt;asp:TemplateField HeaderText="Select"&amp;gt;  &lt;br /&gt;                     &amp;lt;ItemTemplate&amp;gt;  &lt;br /&gt;                          &amp;lt;asp:CheckBox ID="chkSelect" runat="server" /&amp;gt;  &lt;br /&gt;                     &amp;lt;/ItemTemplate&amp;gt;  &lt;br /&gt;                     &amp;lt;HeaderTemplate&amp;gt;  &lt;br /&gt;                          &amp;lt;input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" /&amp;gt;  &lt;br /&gt;                     &amp;lt;/HeaderTemplate&amp;gt;  &lt;br /&gt;                &amp;lt;/asp:TemplateField&amp;gt;  &lt;br /&gt;           &amp;lt;/Columns&amp;gt;   &lt;br /&gt;      &amp;lt;/asp:GridView&amp;gt;  &lt;br /&gt;      &amp;lt;br /&amp;gt;  &lt;br /&gt;      &amp;lt;asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Delete" /&amp;gt;   &lt;br /&gt;      &amp;lt;asp:Label ID="lblmsg" runat="server" Text="Label" Visible="false"&amp;gt;&amp;lt;/asp:Label&amp;gt;  &lt;br /&gt; &amp;lt;/form&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;.cs code&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; public partial class GridWithCheck : System.Web.UI.Page  &lt;br /&gt; {  &lt;br /&gt;   SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["StrConnect"].ToString());  &lt;br /&gt;   protected void Page_Load(object sender, EventArgs e)  &lt;br /&gt;   {  &lt;br /&gt;     if (!IsPostBack)  &lt;br /&gt;     {  &lt;br /&gt;       BindGridView();  &lt;br /&gt;     }  &lt;br /&gt;   }  &lt;br /&gt;   public void BindGridView()  &lt;br /&gt;   {      &lt;br /&gt;     SqlDataAdapter ad = new SqlDataAdapter("select * from tbl_CustomerDetail order by CustomerID", con);  &lt;br /&gt;     DataSet ds = new DataSet();  &lt;br /&gt;     ad.Fill(ds);  &lt;br /&gt;     GridView1.DataSource = ds;  &lt;br /&gt;     GridView1.DataBind();  &lt;br /&gt;   }  &lt;br /&gt;   protected void Button1_Click(object sender, EventArgs e)  &lt;br /&gt;   {   &lt;br /&gt;     foreach (GridViewRow row in GridView1.Rows)  &lt;br /&gt;     {  &lt;br /&gt;       CheckBox cb = ((CheckBox)(row.FindControl("chkSelect")));  &lt;br /&gt;       if (cb != null &amp;amp;&amp;amp; cb.Checked)  &lt;br /&gt;       {   &lt;br /&gt;         int custID = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);  &lt;br /&gt;         string sqlstr = "delete from tbl_CustomerDetail where CustomerID='" + custID + "'";  &lt;br /&gt;         SqlCommand mycmd;  &lt;br /&gt;         mycmd = new SqlCommand(sqlstr, con);  &lt;br /&gt;         con.Open();  &lt;br /&gt;         mycmd.ExecuteNonQuery();  &lt;br /&gt;         Page.RegisterStartupScript("pop", "&amp;amp;lt;script&amp;amp;gt;alert('Row deleted')&amp;amp;lt;/script&amp;amp;gt;");  &lt;br /&gt;         BindGridView();          &lt;br /&gt;       }  &lt;br /&gt;     }   &lt;br /&gt;   }  &lt;br /&gt;  }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8853319581063093317?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8853319581063093317/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/languagejavascript-typetextjavascript.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8853319581063093317'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8853319581063093317'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/languagejavascript-typetextjavascript.html' title='GridView with checkbox'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1979925805252226372</id><published>2010-09-17T10:32:00.000-07:00</published><updated>2010-11-01T10:37:16.415-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>GridView Bind</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Here code shows how to bind gridview from database. &lt;/span&gt;&lt;br /&gt; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;  {&lt;br /&gt;         if (!Page.IsPostBack)&lt;br /&gt;         {&lt;br /&gt;             bindGridView();&lt;br /&gt;         }&lt;br /&gt; }&lt;br /&gt; public void bindGridView()&lt;br /&gt;    {&lt;br /&gt;        SqlConnection myconnection;&lt;br /&gt;        SqlCommand mycmd;&lt;br /&gt;        SqlDataAdapter myda;&lt;br /&gt;        DataSet ds;&lt;br /&gt;        myconnection = new SqlConnection("Data Source=YourServer;Initial Catalog=Test;Integrated Security=True");&lt;br /&gt;        myda = new SqlDataAdapter("Select * from tblCustDetail ", myconnection);&lt;br /&gt;        ds = new DataSet();&lt;br /&gt;        myda.Fill(ds);&lt;br /&gt;        gvCust.DataSource = ds;&lt;br /&gt;        gvCust.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1979925805252226372?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1979925805252226372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/gridview-bind.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1979925805252226372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1979925805252226372'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/gridview-bind.html' title='GridView Bind'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4404015033240829895</id><published>2010-09-17T08:01:00.000-07:00</published><updated>2010-10-17T08:15:39.823-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sql Server Interview Questions'/><title type='text'>Sql Server Interview Questions</title><content type='html'>1.What are the blocks in stored procedure&lt;br /&gt;2. How do you handle exceptions. Give the syntax for it&lt;br /&gt;3. What is normalization and types of normalization&lt;br /&gt;4. When would you denormalize&lt;br /&gt;5. Difference between a query and strored procedure&lt;br /&gt;6. What is clustered and non-clustered indexes&lt;br /&gt;7. Types of joins&lt;br /&gt;8. How do you get all records from 2 tables. Which join do you use&lt;br /&gt;9. Types of optimization&lt;br /&gt;10. Difference between inline query and stored procedure&lt;br /&gt;11. How do you rate yourrself in oracle and sql server&lt;br /&gt;12. What is E-R diagram&lt;br /&gt;13. Draw E-R diagram for many to many relationship&lt;br /&gt;14. Design databaseraw er diagram for a certain scenario(many author many books)&lt;br /&gt;15. Diff between primary key and unique key&lt;br /&gt;16. What is Normalization&lt;br /&gt;17. Difference between sub query and nested query&lt;br /&gt;18. Indexes in oracle&lt;br /&gt;19. Querry to retrieve record for a many to many relationship&lt;br /&gt;20. Querry to get max and second max in oracle in one querry&lt;br /&gt;21. Write a simple Store procedure and pass parameter to it&lt;br /&gt;22. What are the types of triggers&lt;br /&gt;23. Types of locks in database&lt;br /&gt;24. Types of indexes. What is the default key created when a primary key is created in a table&lt;br /&gt;25. What is clustered, non-clustured and unique index. How many indexes can be created on a table&lt;br /&gt;26. Can we create non-clustured index on a clustered index&lt;br /&gt;27. Types of backups&lt;br /&gt;28. What is INSTEAD OF trigger&lt;br /&gt;29. What is difference between triggers and stored procedures. And advantages of SP over triggers&lt;br /&gt;30. What is DTS and purpose of DTS&lt;br /&gt;31. Write a query to get 2nd maximum salary in an employee table Types of joins.&lt;br /&gt;32. What is currency type in database&lt;br /&gt;33. What are nested triggers&lt;br /&gt;34. What is a heap related to database&lt;br /&gt;35. Types of cursors and explanation each of them&lt;br /&gt;36. Types of cursor locations and explanation on each of them&lt;br /&gt;37. Types of cursor locks and explanation each of them&lt;br /&gt;38 How do you retrieve set of records from database server.{Set max records = 100 &amp; use paging where pager page no or records = 10 &amp; after displaying 100 records&lt;br /&gt;again connect to database retrieve next 100 }&lt;br /&gt;39. How do you optimize SQL queries&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4404015033240829895?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4404015033240829895/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/sql-server-interview-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4404015033240829895'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4404015033240829895'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/sql-server-interview-questions.html' title='Sql Server Interview Questions'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3418340946573694226</id><published>2010-09-16T22:49:00.000-07:00</published><updated>2010-10-17T08:10:08.522-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Dropdownlist in Gridview</title><content type='html'>Here this example show how to bind dropdown list in Gridview control.&lt;br /&gt;&lt;br /&gt;protected void GridDegree_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;        {                &lt;br /&gt;            DropDownList ddlDegreeType = (DropDownList)e.Row.FindControl("ddlDegreeType");&lt;br /&gt;            if (ddlDegreeType != null)&lt;br /&gt;            {&lt;br /&gt;                ddlDegreeType.DataSource = objDegreeDAL.GetDegree(); &lt;br /&gt;                ddlDegreeType.DataBind();&lt;br /&gt;                ddlDegreeType.SelectedValue = dsDegree.Tables[0].Rows[e.Row.RowIndex]["DegreeId"].ToString();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    .aspx page    &lt;br /&gt;    &amp;lt;asp:TemplateField HeaderText="Degree Type"gt&amp;;&lt;br /&gt; &amp;lt;ItemTemplategt&amp;;&lt;br /&gt;     &amp;lt;asp:Label ID="lblDegreeType" runat="server" Text='&amp;lt;%# Bind("[Degree]") %&gt;'gt&amp;;&amp;lt;/asp:Labelgt&amp;;&lt;br /&gt; &amp;lt;/ItemTemplategt&amp;;&lt;br /&gt; &amp;lt;EditItemTemplategt&amp;;&lt;br /&gt;     &amp;lt;asp:DropDownList ID="ddlDegreeType" runat="server" DataTextField="Degree"&lt;br /&gt;  DataValueField="Degreeid"gt&amp;;&lt;br /&gt;     &amp;lt;/asp:DropDownListgt&amp;;&lt;br /&gt; &amp;lt;/EditItemTemplategt&amp;; &lt;br /&gt;    &amp;lt;/asp:TemplateFieldgt&amp;;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regard&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3418340946573694226?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3418340946573694226/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/dropdownlist-in-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3418340946573694226'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3418340946573694226'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/dropdownlist-in-gridview.html' title='Dropdownlist in Gridview'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5835492204121581395</id><published>2010-09-15T04:14:00.000-07:00</published><updated>2011-04-02T07:35:55.823-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Create pdf from GridView asp.net with c#</title><content type='html'>Here this article show full code for create the pdf file from asp.net GridView.&lt;br /&gt;Some time developer need how to do GridView to pdf .Here i have written the method according to my requirement.You can change according to your requirement and use this.&lt;br /&gt;&lt;br /&gt;public void ConvertDataInPdf(DataTable dtExportInPdf, string reportName, string OtherInfo)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            float CompanyNameSize = 11;&lt;br /&gt;            float ReportNameSize = 9;&lt;br /&gt;            float HeaderTextSize = 7;&lt;br /&gt;            float ReportTextSize = 6;&lt;br /&gt;&lt;br /&gt;            int totalWidth = 0;&lt;br /&gt;            int tableWidthPercent = 100;&lt;br /&gt;            int[] widths = new int[dtExportInPdf.Columns.Count];&lt;br /&gt;&lt;br /&gt;            for (int h = 0; h &lt; dtExportInPdf.Columns.Count; h++)   //Data table header column width&lt;br /&gt;            {&lt;br /&gt;                string strWidth = dtExportInPdf.Columns[h].ToString();&lt;br /&gt;                widths[h] = strWidth.Length;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            foreach (DataRow dr in dtExportInPdf.Rows) //Data table column width&lt;br /&gt;            {&lt;br /&gt;                int[] colItemWidth = new int[dtExportInPdf.Columns.Count];&lt;br /&gt;                for (int i = 0; i &lt; dtExportInPdf.Columns.Count; i++) //Data table max item width&lt;br /&gt;                {&lt;br /&gt;                    if (dr[i].ToString().Length &gt; 20)&lt;br /&gt;                    {&lt;br /&gt;                        colItemWidth[i] = 20;&lt;br /&gt;                    }&lt;br /&gt;                    else if (dr[i].ToString().Length &lt; 3)&lt;br /&gt;                    {&lt;br /&gt;                        colItemWidth[i] = 3;&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        colItemWidth[i] = dr[i].ToString().Length;&lt;br /&gt;                    }&lt;br /&gt;&lt;br /&gt;                    if (colItemWidth[i] &gt; widths[i])&lt;br /&gt;                    {&lt;br /&gt;                        widths[i] = colItemWidth[i];&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            for (int h = 0; h &lt; dtExportInPdf.Columns.Count; h++)&lt;br /&gt;            {&lt;br /&gt;                totalWidth += widths[h];&lt;br /&gt;            }&lt;br /&gt;            Document pdfDoc = null;&lt;br /&gt;            if (totalWidth &gt; 0 &amp;&amp; totalWidth &lt;= 110)&lt;br /&gt;            {&lt;br /&gt;                pdfDoc = new Document(PageSize.A4, 20, 20, 20, 20);&lt;br /&gt;            }&lt;br /&gt;            else if (totalWidth &gt; 110 &amp;&amp; totalWidth &lt;= 160)&lt;br /&gt;            {&lt;br /&gt;                pdfDoc = new Document(PageSize.A4.Rotate(), 20, 20, 20, 20);&lt;br /&gt;            }&lt;br /&gt;            else if (totalWidth &gt; 160 &amp;&amp; totalWidth &lt;= 250)&lt;br /&gt;            {&lt;br /&gt;                HeaderTextSize = 6;&lt;br /&gt;                ReportTextSize = 5;&lt;br /&gt;                pdfDoc = new Document(PageSize.LEGAL.Rotate(), 20, 20, 20, 20);&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            else if (totalWidth &gt; 250 &amp;&amp; totalWidth &lt;= 300)&lt;br /&gt;            {&lt;br /&gt;                CompanyNameSize = 9;&lt;br /&gt;                ReportNameSize = 7;&lt;br /&gt;                HeaderTextSize = 6;&lt;br /&gt;                ReportTextSize = 5;&lt;br /&gt;                pdfDoc = new Document(PageSize.B1, 20, 20, 20, 20);&lt;br /&gt;            }&lt;br /&gt;            else if (totalWidth &gt; 300)&lt;br /&gt;            {&lt;br /&gt;                CompanyNameSize = 9;&lt;br /&gt;                ReportNameSize = 7;&lt;br /&gt;                HeaderTextSize = 6;&lt;br /&gt;                ReportTextSize = 5;&lt;br /&gt;                pdfDoc = new Document(PageSize.B1.Rotate(), 20, 20, 20, 20);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // Creates a PdfPTable with column count of the table equal to no of columns of the datatable or gridview or gridview datasource.&lt;br /&gt;            PdfPTable pdfTable = new PdfPTable(dtExportInPdf.Columns.Count);&lt;br /&gt;            pdfTable.WidthPercentage = tableWidthPercent;&lt;br /&gt;            pdfTable.HeaderRows = 4; // Sets the first 4 rows of the table as the header rows which will be repeated in all the pages.&lt;br /&gt;&lt;br /&gt;            #region PDFHeader&lt;br /&gt;            PdfPTable headerTable = new PdfPTable(3); // Creates a PdfPTable with 3 columns to hold the header in the exported PDF.&lt;br /&gt;            byte[] logo = (byte[])System.Web.HttpContext.Current.Session["Logo"];&lt;br /&gt;            iTextSharp.text.Image imgLogo = iTextSharp.text.Image.GetInstance(logo);&lt;br /&gt;            imgLogo.ScaleToFit(80f, 40f);//Resize image depend upon your need  &lt;br /&gt;            imgLogo.SpacingBefore = 0f;//Give space before image            &lt;br /&gt;            imgLogo.SpacingAfter = 1f;//Give some space after the image             &lt;br /&gt;            PdfPCell clLogo = new PdfPCell(imgLogo);// Creates a PdfPCell which accepts a phrase as a parameter.&lt;br /&gt;            clLogo.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt;            clLogo.HorizontalAlignment = Element.ALIGN_LEFT;// Sets the Horizontal Alignment of the PdfPCell to left.&lt;br /&gt;            clLogo.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt;            // Creates a phrase to hold the application name at the left hand side of the header.&lt;br /&gt;            Phrase phApplicationName = new Phrase("" + System.Web.HttpContext.Current.Session["CompanyName"] + "", FontFactory.GetFont("Arial", CompanyNameSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            PdfPCell clApplicationName = new PdfPCell(phApplicationName);// Creates a PdfPCell which accepts a phrase as a parameter.&lt;br /&gt;            clApplicationName.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt;            clApplicationName.HorizontalAlignment = Element.ALIGN_CENTER;// Sets the Horizontal Alignment of the PdfPCell to left.&lt;br /&gt;            clApplicationName.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt;            // Creates a phrase to show the current date at the right hand side of the header.&lt;br /&gt;            Phrase phDate = new Phrase(DateTime.Now.Date.ToString("dd/MM/yyyy"), FontFactory.GetFont("Arial", 7, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            PdfPCell clDate = new PdfPCell(phDate);// Creates a PdfPCell which accepts the date phrase as a parameter.&lt;br /&gt;            clDate.HorizontalAlignment = Element.ALIGN_RIGHT;// Sets the Horizontal Alignment of the PdfPCell to right.&lt;br /&gt;            clDate.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt;            clDate.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt;            headerTable.AddCell(clLogo);&lt;br /&gt;            headerTable.AddCell(clApplicationName);// Adds the cell which holds the application name to the headerTable.&lt;br /&gt;            headerTable.AddCell(clDate);// Adds the cell which holds the date to the headerTable.&lt;br /&gt;            headerTable.DefaultCell.Border = PdfPCell.NO_BORDER;// Sets the border of the headerTable to zero.  &lt;br /&gt;&lt;br /&gt;            // Creates a PdfPCell that accepts the headerTable as a parameter and then adds that cell to the main PdfPTable.&lt;br /&gt;            PdfPCell cellHeader = new PdfPCell(headerTable);&lt;br /&gt;            cellHeader.VerticalAlignment = Element.ALIGN_TOP;&lt;br /&gt;            cellHeader.Border = PdfPCell.NO_BORDER;&lt;br /&gt;            cellHeader.Colspan = dtExportInPdf.Columns.Count;// Sets the column span of the header cell to noOfColumns.&lt;br /&gt;            pdfTable.AddCell(cellHeader);// Adds the above header cell to the table.&lt;br /&gt;            #endregion PDFHeader&lt;br /&gt;&lt;br /&gt;            //Creates a phrase for a new line.&lt;br /&gt;            Phrase phSpace1 = new Phrase("\n");&lt;br /&gt;            PdfPCell clSpace1 = new PdfPCell(phSpace1);&lt;br /&gt;            clSpace1.Border = PdfPCell.BOTTOM_BORDER;&lt;br /&gt;            clSpace1.BorderWidth = 1;&lt;br /&gt;            clSpace1.BorderColor = iTextSharp.text.Color.DARK_GRAY;&lt;br /&gt;            clSpace1.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt;            pdfTable.AddCell(clSpace1);&lt;br /&gt;&lt;br /&gt;            // Creates a phrase to hold the report name.&lt;br /&gt;            Phrase phHeader = new Phrase("" + reportName + "", FontFactory.GetFont("Arial", ReportNameSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            PdfPCell clHeader = new PdfPCell(phHeader);&lt;br /&gt;            clHeader.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt;            clHeader.Border = PdfPCell.NO_BORDER;&lt;br /&gt;            clHeader.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt;            clHeader.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;            clHeader.PaddingTop = 5;&lt;br /&gt;            clHeader.PaddingBottom = 2;&lt;br /&gt;            pdfTable.AddCell(clHeader);&lt;br /&gt;&lt;br /&gt;            //Create Phrage to hold other informations&lt;br /&gt;            Phrase phOtherInfo = new Phrase(OtherInfo, FontFactory.GetFont("Arial", ReportTextSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            PdfPCell cellOtherInfo = new PdfPCell(phOtherInfo);&lt;br /&gt;            cellOtherInfo.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt;            cellOtherInfo.Border = Element.ALIGN_LEFT;&lt;br /&gt;            cellOtherInfo.PaddingBottom = 10;&lt;br /&gt;            pdfTable.AddCell(cellOtherInfo);&lt;br /&gt;&lt;br /&gt;            PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);&lt;br /&gt;            string strFooter = "Copyright © 2010 By Cnergee. Page:";&lt;br /&gt;            Phrase phCopyright = new Phrase(strFooter, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            Phrase phPageNo = new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));&lt;br /&gt;            HeaderFooter footer = new HeaderFooter(phCopyright, phPageNo);&lt;br /&gt;            //footer.Alignment = Element.ALIGN_LEFT;&lt;br /&gt;            footer.Alignment = Element.ALIGN_RIGHT;&lt;br /&gt;            footer.Border = iTextSharp.text.Rectangle.TOP_BORDER;&lt;br /&gt;            footer.GrayFill = 10;&lt;br /&gt;            pdfDoc.Footer = footer;&lt;br /&gt;&lt;br /&gt;            pdfDoc.Open();&lt;br /&gt;            Font font8 = FontFactory.GetFont("ARIAL Narrow", 7);&lt;br /&gt;            if (dtExportInPdf != null)&lt;br /&gt;            {&lt;br /&gt;                pdfDoc.Header = null;&lt;br /&gt;                //Create header for pdf table&lt;br /&gt;                string cloName = null;&lt;br /&gt;                Phrase ph = null;&lt;br /&gt;                for (int i = 0; i &lt; dtExportInPdf.Columns.Count; i++)&lt;br /&gt;                {&lt;br /&gt;                    cloName = dtExportInPdf.Columns[i].ColumnName;&lt;br /&gt;                    if (dtExportInPdf.Columns.Count &gt; 0)&lt;br /&gt;                    {&lt;br /&gt;                        ph = new Phrase(cloName, FontFactory.GetFont("Arial", HeaderTextSize, iTextSharp.text.Font.BOLD));&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        ph = new Phrase(cloName, FontFactory.GetFont("Arial", HeaderTextSize, iTextSharp.text.Font.BOLD));&lt;br /&gt;                    }&lt;br /&gt;                    pdfTable.AddCell(ph);&lt;br /&gt;                }&lt;br /&gt;&lt;br /&gt;                //Add data into the pdf table               &lt;br /&gt;                for (int rows = 0; rows &lt; dtExportInPdf.Rows.Count; rows++)&lt;br /&gt;                {&lt;br /&gt;                    ph = null;&lt;br /&gt;                    PdfPCell pCell = null;&lt;br /&gt;                    for (int column = 0; column &lt; dtExportInPdf.Columns.Count; column++)&lt;br /&gt;                    {&lt;br /&gt;                        ph = new Phrase(dtExportInPdf.Rows[rows][column].ToString(), FontFactory.GetFont("Arial", ReportTextSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt;                        pCell = new PdfPCell(ph);&lt;br /&gt;                        if (dtExportInPdf.Columns[column].ColumnName == "SrNo" || dtExportInPdf.Columns[column].ColumnName == "Sr.No." || dtExportInPdf.Columns[column].ColumnName == "Sr. No." || dtExportInPdf.Columns[column].ColumnName == "Code" || dtExportInPdf.Columns[column].ColumnName == "EmpCode" || dtExportInPdf.Columns[column].ColumnName == "EmployeeCode")&lt;br /&gt;                        {&lt;br /&gt;                            pCell.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt;                        }&lt;br /&gt;                        else if (dtExportInPdf.Columns[column].ColumnName == "Amount")&lt;br /&gt;                        {&lt;br /&gt;                            pCell.HorizontalAlignment = Element.ALIGN_RIGHT;&lt;br /&gt;                        }&lt;br /&gt;                        else if (dtExportInPdf.Columns[column].ColumnName == "Date" || dtExportInPdf.Columns[column].ColumnName == "From" || dtExportInPdf.Columns[column].ColumnName == "To")&lt;br /&gt;                        {&lt;br /&gt;                            pCell.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt;                        }&lt;br /&gt;                        else&lt;br /&gt;                        {&lt;br /&gt;                            pCell.HorizontalAlignment = Element.ALIGN_LEFT;&lt;br /&gt;                        }&lt;br /&gt;                        pdfTable.AddCell(pCell);&lt;br /&gt;                    }&lt;br /&gt;                    pdfTable.SetWidths(widths);&lt;br /&gt;                }&lt;br /&gt;                pdfTable.SpacingBefore = 15f; // Give some space after the text or it may overlap the table   &lt;br /&gt;                pdfDoc.Add(pdfTable); // add pdf table to the document                 &lt;br /&gt;            }&lt;br /&gt;            pdfDoc.Close();&lt;br /&gt;&lt;br /&gt;            string pdfFileName = reportName;&lt;br /&gt;            reportName = reportName.Replace(" ", "");&lt;br /&gt;            System.Web.HttpContext.Current.Response.ContentType = "application/pdf";&lt;br /&gt;            System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename= " + pdfFileName + ".pdf");&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(pdfDoc);&lt;br /&gt;&lt;br /&gt;            System.Web.HttpContext.Current.Response.Flush();&lt;br /&gt;            System.Web.HttpContext.Current.Response.End();&lt;br /&gt;        }&lt;br /&gt;        catch (DocumentException de)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(de.Message);&lt;br /&gt;        }&lt;br /&gt;        catch (IOException ioEx)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(ioEx.Message);&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(ex.Message);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5835492204121581395?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5835492204121581395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/create-pdf-from-gridview-aspnet-with-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5835492204121581395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5835492204121581395'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/create-pdf-from-gridview-aspnet-with-c.html' title='Create pdf from GridView asp.net with c#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2251872724014759275</id><published>2010-09-11T03:27:00.000-07:00</published><updated>2010-11-21T07:17:34.595-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='DropDownList'/><title type='text'>Bind dropdownlist default value</title><content type='html'>On RowDataBound&lt;br /&gt;ddlCountry.SelectedValue = Ds.Tables[0].Rows[e.Row.RowIndex]["CountryId"].ToString();&lt;br /&gt;&lt;br /&gt;On SelectedIndexChanged&lt;br /&gt;ddlRGroup.SelectedValue = Ds.Tables[0].Rows[0]["RatingId"].ToString();&lt;br /&gt;&lt;br /&gt;if (!Page.IsPostBack)&lt;br /&gt;SqlDataReader dr = SqlHelper.ExecuteReader(connectionString, "tblFormula_Select", Convert.ToInt32(ViewState["CKFId"]), "S");&lt;br /&gt;ddlTemp.SelectedValue = dr["TemplateId"].ToString();&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2251872724014759275?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2251872724014759275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/bind-dropdownlist-default-value.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2251872724014759275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2251872724014759275'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/bind-dropdownlist-default-value.html' title='Bind dropdownlist default value'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6205162184053600275</id><published>2010-09-10T22:28:00.000-07:00</published><updated>2011-04-02T07:38:35.305-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Javascript validation for Gridview footer textbox</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Javascript validation for Gridview footer textbox.&lt;/span&gt;&lt;br /&gt;Here gridview have footer row that cantain dropdownlist and two textbox.This javascript validate these fields.&lt;br /&gt;&lt;br /&gt;    function ValidateGrid()&lt;br /&gt;    {           &lt;br /&gt;        ddlNewCountry = document.getElementById('&lt;%=((DropDownList)gv.FooterRow.FindControl("ddlNewCountry")).ClientID%&gt;');&lt;br /&gt;        txtNewEmpName = document.getElementById('&lt;%=((TextBox)gv.FooterRow.FindControl("txtNewEmpName")).ClientID %&gt;');&lt;br /&gt;        txtNewAge = document.getElementById('&lt;%=((TextBox)gv.FooterRow.FindControl("txtNewAge")).ClientID %&gt;');&lt;br /&gt;        if(ddlNewCountry.value == 0)&lt;br /&gt;        {&lt;br /&gt;            alert("Please Select Country...!");&lt;br /&gt;            ddlNewCountry.focus();&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        if(txtNewEmpName.value == 0)&lt;br /&gt;        {&lt;br /&gt;            alert("Please Enter Emp name...!");&lt;br /&gt;            txtNewEmpName.focus();&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;        if(txtNewAge.value == 0)&lt;br /&gt;        {&lt;br /&gt;            alert("Please Enter age...!");&lt;br /&gt;            txtNewAge.focus();&lt;br /&gt;            return false;&lt;br /&gt;        } &lt;br /&gt;        return true;           &lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6205162184053600275?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6205162184053600275/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/javascript-validation-for-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6205162184053600275'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6205162184053600275'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/javascript-validation-for-gridview.html' title='Javascript validation for Gridview footer textbox'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7060891751626043968</id><published>2010-09-10T21:48:00.000-07:00</published><updated>2011-04-02T07:38:35.306-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Javascript validation for Gridview in edit mode</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Javascript validation for Gridview in edit mode.&lt;/span&gt;&lt;br /&gt;Here gridview have dropdownlist and two textbox.This javascript validate these fields in edit mode.    &lt;br /&gt;&lt;br /&gt;        function ValidateGridEditMode()&lt;br /&gt;        {&lt;br /&gt;            var Gid = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer').rows.length;&lt;br /&gt;            var i;&lt;br /&gt;            for(i=2; i &lt;=Gid; i++)&lt;br /&gt;            {              &lt;br /&gt;                if(i&lt;10)&lt;br /&gt;                {&lt;br /&gt;                    ddlCustLocation = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl0'+i+'_ddlCustLocation');&lt;br /&gt;                    txtCustCode = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl0'+i+'_txtCustCode');&lt;br /&gt;                    txtCustName = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl0'+i+'_txtCustName'); &lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    ddlCustLocation = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl'+i+'_ddlCustLocation');&lt;br /&gt;                    txtCustCode = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl'+i+'_txtCustCode');&lt;br /&gt;                    txtCustName = document.getElementById('ctl00_ContentPlaceHolder1_TabContaner_tabCustomer_gvCustomer_ctl'+i+'_txtCustName'); &lt;br /&gt;                }&lt;br /&gt;                &lt;br /&gt;                ddlCustLocation != null || txtCustCode != null || txtCustName != null)&lt;br /&gt;                {&lt;br /&gt;                    ddlCustLocation == 0)&lt;br /&gt;                    {&lt;br /&gt;                        alert("Please Select Location..");&lt;br /&gt;                        ddlCustLocation.focus();&lt;br /&gt;                        return false;&lt;br /&gt;                    } &lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        if(txtCustCode.value == 0)&lt;br /&gt;                        {&lt;br /&gt;                            alert("Please enter Customer Code..");  &lt;br /&gt;                            txtCustCode.focus(); &lt;br /&gt;                            return false;&lt;br /&gt;                        } &lt;br /&gt;                        else&lt;br /&gt;                        {&lt;br /&gt;                            if(txtCustName.value == "")&lt;br /&gt;                            {&lt;br /&gt;                                alert("Please enter Customer Name ..");  &lt;br /&gt;                                txtCustName.focus(); &lt;br /&gt;                                return false;&lt;br /&gt;                            }&lt;br /&gt;                        }        &lt;br /&gt;                    } &lt;br /&gt;                }    &lt;br /&gt;            }&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7060891751626043968?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7060891751626043968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/javascript-validation-for-gridview-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7060891751626043968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7060891751626043968'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/javascript-validation-for-gridview-in.html' title='Javascript validation for Gridview in edit mode'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7745791523809094134</id><published>2010-09-10T09:43:00.000-07:00</published><updated>2011-04-02T07:25:57.353-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>GridView control with full feature</title><content type='html'>Introduction &lt;br /&gt;This example explains the GridView binding  with simple DataSet , and also explains the methods like Add new record, Edit, Update and&lt;br /&gt;Delete function.&lt;br /&gt;&lt;br /&gt;Featur of this gridview"&lt;br /&gt;1.This example used three tier architecture.&lt;br /&gt;2.Add new record using footer.&lt;br /&gt;3.Update and delete record.&lt;br /&gt;4.For edit and delete i have used image button for nice look.&lt;br /&gt;5.If table is empty(No record in table) a blank dynamic Gridview display for with Add New buttion.&lt;br /&gt;6.On Click Edit or Add New cursor focus to Textbox.&lt;br /&gt;7.Auto Generated Serial Number In Gridview Control.&lt;br /&gt;&lt;br /&gt;I have used property layer but i didnt write here,i think you can implement it according to your logic.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.&lt;br /&gt;aspx page&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&amp;lt;asp:GridView ID="GridViewEmpSkill" runat="server" AllowPaging="True" AutoGenerateColumns="False"&lt;br /&gt; PageSize="12" OnPageIndexChanging="GridViewEmpSkill_PageIndexChanging" OnRowDataBound="GridViewEmpSkill_RowDataBound"&lt;br /&gt; TabIndex="2" Width="697px" OnRowCancelingEdit="GridViewEmpSkill_RowCancelingEdit" OnRowEditing="GridViewEmpSkill_RowEditing"&lt;br /&gt; OnRowUpdating="GridViewEmpSkill_RowUpdating" ShowFooter="True" OnRowCommand="GridViewEmpSkill_RowCommand"&lt;br /&gt; OnRowDeleting="GridViewEmpSkill_RowDeleting" DataKeyNames="EmpSkillId"&amp;gt;&lt;br /&gt; &amp;lt;Columns&amp;gt;&lt;br /&gt;&amp;lt;asp:TemplateField HeaderText="Sr No"&amp;gt;&lt;br /&gt;   &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:Label ID="lblSrNo" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;   &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:Label ID="lblNewSrNo" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;   &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt;   &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;&amp;lt;asp:TemplateField HeaderText="EmpSkillId" Visible="False"&amp;gt;&lt;br /&gt;   &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:Label ID="lblEmpSkillId" runat="server" Text='&amp;lt;%# Bind("EmpSkillId") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;   &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;&amp;lt;asp:TemplateField HeaderText="EmpSkill"&amp;gt;&lt;br /&gt;   &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:TextBox ID="txtEmpSkill" runat="server" Width="493px" BorderColor="White" BorderWidth="0px"&lt;br /&gt;    Height="14px" Text='&amp;lt;%# Bind("EmpSkill") %&amp;gt;'&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;   &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:TextBox ID="txtNewEmpSkill" runat="server" Width="493px" BorderColor="White" BorderWidth="0px"&lt;br /&gt;    Height="14px" Visible="false"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;   &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt;   &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:Label ID="lblEmpSkill" runat="server" Text='&amp;lt;%# Bind("EmpSkill") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;   &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;FooterStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;   &amp;lt;ItemStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;&amp;lt;asp:TemplateField HeaderText="Activity"&amp;gt;&lt;br /&gt;   &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgEdit" runat="server" ImageUrl="~/Image/img_edit.png" CommandName="Edit" ToolTip="Edit" /&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgbtnDelete" runat="server" ImageUrl="~/Image/img_delete.png" ToolTip="Delete"&lt;br /&gt;    CommandName="Delete" OnClientClick="return ConfirmDelete();" /&amp;gt;&lt;br /&gt;   &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgUpdate" runat="server" CausesValidation="True" CommandName="Update" ToolTip="Update"&lt;br /&gt;    ImageUrl="~/Image/update.png" Text="Update" /&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel"&lt;br /&gt;    ImageUrl="~/Image/cancel.png" Text="Cancel" /&amp;gt;&lt;br /&gt;   &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgNewAdd" runat="server" ImageUrl="~/Image/row_add.png"&lt;br /&gt;    CommandName="AddNew" ToolTip="Add New" /&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgbtnNewInsert" runat="server" CausesValidation="True" CommandName="Insert" ToolTip="Save"&lt;br /&gt;    ImageUrl="~/Image/add.png" Visible="false" Text="Add" /&amp;gt;&lt;br /&gt;&amp;lt;asp:ImageButton ID="imgNewCancel" runat="server" CausesValidation="False" CommandName="Cancel" ToolTip="Cancel"&lt;br /&gt;    ImageUrl="~/Image/cancel.png" Visible="false" Text="Cancel" /&amp;gt;&lt;br /&gt;   &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt;   &amp;lt;FooterStyle HorizontalAlign="Center" Width="140px" /&amp;gt;&lt;br /&gt;   &amp;lt;ItemStyle HorizontalAlign="Center" Width="140px" /&amp;gt;&lt;br /&gt;&amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;/Columns&amp;gt;&lt;br /&gt;&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;===========&lt;br /&gt;.cs page&lt;br /&gt;&lt;br /&gt;protected void GridViewEmployeeSkill()&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        Ds = SkillBLLobj.GetEmpSkillData();&lt;br /&gt;        if (Ds.Tables[0].Rows.Count &gt; 0)&lt;br /&gt;        {&lt;br /&gt;&lt;/div&gt;               GridViewEmpSkill.DataSource = Ds;&lt;br /&gt;            GridViewEmpSkill.DataBind();&lt;br /&gt;&lt;div style="text-align: justify;"&gt;           }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            ShowNoResultFound(Ds,GridViewEmpSkill);&lt;br /&gt;            SrNoSkill = 1;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;        msgEmpSkill.Text = ex.Message;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void GridViewEmpSkill_RowEditing(object sender, GridViewEditEventArgs e)&lt;br /&gt;{&lt;br /&gt;    GridViewEmpSkill.EditIndex = e.NewEditIndex;&lt;br /&gt;    GridViewEmpSkill();&lt;br /&gt;    GridViewEmpSkill.Rows[e.NewEditIndex].FindControl("txtEmpSkill").Focus();&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)&lt;br /&gt;{&lt;br /&gt;    GridViewEmpSkill.EditIndex = -1;&lt;br /&gt;    GridViewSkill();&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;{&lt;br /&gt;    GridViewEmpSkill.PageIndex = e.NewPageIndex;&lt;br /&gt;    GridViewSkill();&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;{&lt;br /&gt;    if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;    {&lt;br /&gt;        Label lblSrNo = (Label)e.Row.FindControl("lblSrNo");&lt;br /&gt;        lblSrNo.Text = SrNo.ToString();&lt;br /&gt;        SrNo++;       &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_RowUpdating(object sender, GridViewUpdateEventArgs e)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {       &lt;br /&gt;        SkillClsobj.SkillId = Convert.ToInt32(((Label)GridViewEmpSkill.Rows[e.RowIndex].FindControl("lblEmpSkillId")).Text);&lt;br /&gt;        SkillClsobj.Skill = Convert.ToString(((TextBox)GridViewEmpSkill.Rows[e.RowIndex].FindControl("txtEmpSkill")).Text);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;        int Update = SkillBLLobj.UpdateEmpSkill(SkillClsobj);&lt;br /&gt;        if (Update &gt; 0)&lt;br /&gt;        {&lt;br /&gt;            msgEmpSkill.Text = "Record Updated Successfully !";&lt;br /&gt;            GridViewEmpSkill.EditIndex = -1;&lt;br /&gt;            GridViewSkill();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;        msgEmpSkill.Text = ex.Message.ToString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_RowCommand(object sender, GridViewCommandEventArgs e)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        if (e.CommandName.Equals("AddNew") || e.CommandName.Equals("Insert"))&lt;br /&gt;        {&lt;br /&gt;            if (e.CommandName.Equals("AddNew"))&lt;br /&gt;            {&lt;br /&gt;                GridViewEmpSkill.EditIndex = -1;&lt;br /&gt;                GridViewSkill();                &lt;br /&gt;                Label lblNewSrNo = (Label)GridViewEmpSkill.FooterRow.FindControl("lblNewSrNo");&lt;br /&gt;                lblNewSrNo.Text = SrNo.ToString();&lt;br /&gt;&lt;br /&gt;                ImageButton imgNewInsert = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewInsert");&lt;br /&gt;                ImageButton imgNewCancel = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewCancel");&lt;br /&gt;                ImageButton imgNewAdd = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewAdd");&lt;br /&gt;                imgNewInsert.Visible = true;&lt;br /&gt;                imgNewCancel.Visible = true;&lt;br /&gt;                imgNewAdd.Visible = false;&lt;br /&gt;                TextBox txtNewEmpSkill = (TextBox)GridViewEmpSkill.FooterRow.FindControl("txtNewEmpSkill");&lt;br /&gt;                txtNewEmpSkill.Visible = true;&lt;br /&gt;                txtNewEmpSkill.Focus();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch(Exception ex)&lt;br /&gt;    {&lt;br /&gt;        throw ex;&lt;br /&gt;    }&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        if (e.CommandName.Equals("Insert"))&lt;br /&gt;        {&lt;br /&gt;            ImageButton imgNewInsert = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewInsert");&lt;br /&gt;            ImageButton imgNewCancel = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewCancel");&lt;br /&gt;            ImageButton imgNewAdd = (ImageButton)GridViewEmpSkill.FooterRow.FindControl("imgNewAdd");&lt;br /&gt;            imgNewInsert.Visible = false;&lt;br /&gt;            imgNewCancel.Visible = false;&lt;br /&gt;            imgNewAdd.Visible = true;&lt;br /&gt;            TextBox txtNewSkill = (TextBox)GridViewEmpSkill.FooterRow.FindControl("txtNewEmpSkill");&lt;br /&gt;            txtNewEmpSkill.Visible = true;&lt;br /&gt;            txtNewEmpSkill.Focus();&lt;br /&gt;      &lt;br /&gt;            SkillClsobj.Skill = Convert.ToString(((TextBox)GridViewEmpSkill.FooterRow.FindControl("txtNewSkill")).Text);&lt;br /&gt;        &lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (SkillClsobj.Skill == "")&lt;br /&gt;                {&lt;br /&gt;                    msgEmpSkill.Text = "Pleae Enter !";&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    int intResult= SkillBLLobj.InsertEmpSkill(SkillClsobj);&lt;br /&gt;                    if (intResult&gt; 0)&lt;br /&gt;                    {&lt;br /&gt;                        msgEmpSkill.Text = "Record Added !";&lt;br /&gt;                        GridViewEmpSkill.EditIndex = -1;&lt;br /&gt;                        GridViewSkill();&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ee)&lt;br /&gt;            {&lt;br /&gt;                msgEmpSkill.Text = ee.Message.ToString();&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                SkillBLLobj = null;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch(Exception ex)&lt;br /&gt;    {&lt;br /&gt;        throw ex;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;protected void GridViewEmpSkill_RowDeleting(object sender, GridViewDeleteEventArgs e)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        SkillClsobj.SkillId = (int)GridViewEmpSkill.DataKeys[e.RowIndex].Value;&lt;br /&gt;        int result = SkillBLLobj.DeleteSkill(SkillClsobj);&lt;br /&gt;        if (result &gt; 0)&lt;br /&gt;        {&lt;br /&gt;            msgEmpSkill.Text = "Record Deleted Successfully !";&lt;br /&gt;            GridViewEmpSkill.EditIndex = -1;&lt;br /&gt;            GridViewSkill();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt;        msgEmpSkill.Text = ex.Message.ToString();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;private void ShowNoResultFound(DataSet ds,GridView gv)&lt;br /&gt;{&lt;br /&gt;    DataTable dt = (DataTable)ds.Tables[0];&lt;br /&gt;    dt.Rows.Add(dt.NewRow());&lt;br /&gt;    gv.DataSource = dt;&lt;br /&gt;    gv.DataBind();&lt;br /&gt;    int TotalColumns = gv.Rows[0].Cells.Count;&lt;br /&gt;    gv.Rows[0].Cells.Clear();&lt;br /&gt;    gv.Rows[0].Cells.Add(new TableCell());&lt;br /&gt;    gv.Rows[0].Height = 0;&lt;br /&gt;    gv.Rows[0].Visible = false;&lt;br /&gt;}&lt;br /&gt;======================&lt;br /&gt;business logic layer&lt;br /&gt;&lt;br /&gt;public class EmpSkillBLL&lt;br /&gt;{&lt;br /&gt;EmpSkillDAL SkillDALobj = new EmpSkillDAL();&lt;br /&gt;&lt;br /&gt;public DataSet GetEmpSkillData()&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        return SkillDALobj.GetEmpSkillData();&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public int InsertSkill(EmpSkillCls objSkillCls)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        return SkillDALobj.InsertEmpSkill(objSkillCls);&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public int UpdateSkill(EmpSkillCls objSkillCls)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        return SkillDALobj.UpdateEmpSkill(objSkillCls);&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public int DeleteSkill(EmpSkillCls objSkillCls)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        return objSkillDAL.DeleteEmpSkill(objSkillCls);&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;===========&lt;br /&gt;data acess layer&lt;br /&gt;&lt;br /&gt;public class EmpSkillDAL&lt;br /&gt;{&lt;br /&gt;SqlConnection conn = new SqlConnection("your connection string");&lt;br /&gt;DataSet Ds = new DataSet();&lt;br /&gt;&lt;br /&gt;public DataSet GetEmpSkillData()&lt;br /&gt;{&lt;br /&gt;    Ds = SqlHelper.ExecuteDataset(conn, "sp_SelectDelete");&lt;br /&gt;    return Ds;&lt;br /&gt;}&lt;br /&gt;public int InsertEmpSkill(EmpSkillCls Emp)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        int Insert = SqlHelper.ExecuteNonQuery(conn, "usp_EmpSkillMasterAddEdit", Emp.SkillId, Emp.Skill);&lt;br /&gt;        return Insert;&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;    finally&lt;br /&gt;    {&lt;br /&gt;        conn.Close();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public int UpdateEmpSkill(EmpSkillCls emp)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        int Result = SqlHelper.ExecuteNonQuery(conn, "usp_EmpSkillMaster_AddEdit", Emp.SkillId, Emp.Skill);&lt;br /&gt;        return Result;&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;    finally&lt;br /&gt;    {&lt;br /&gt;        conn.Close();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;public int DeleteEmpSkill(EmpSkillCls emp)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt;        int result = SqlHelper.ExecuteNonQuery(conn, "usp_EmpSkillMasterSelect", emp.SkillId);&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;    catch&lt;br /&gt;    {&lt;br /&gt;        throw;&lt;br /&gt;    }&lt;br /&gt;    finally&lt;br /&gt;    {&lt;br /&gt;        conn.Close();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="color: rgb(153, 153, 153);"&gt;Thank &amp;amp; Regard&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 102, 255);"&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7745791523809094134?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7745791523809094134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/07/gridview-control-with-full-feature.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7745791523809094134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7745791523809094134'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/07/gridview-control-with-full-feature.html' title='GridView control with full feature'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6002475942346182413</id><published>2010-09-10T00:49:00.000-07:00</published><updated>2011-04-02T07:26:42.872-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Onclick Gridview Select button fill all the data to textbox.</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Onclick Gridview Select button fill all the data to textbox.&lt;/span&gt;&lt;br /&gt;All the textbox out of gridview.&lt;br /&gt;&lt;br /&gt;protected void ImgSelect_Click(object sender, ImageClickEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        ImageButton aspSender = sender as ImageButton;&lt;br /&gt;        Label Id = aspSender.FindControl("lblContId") as Label;&lt;br /&gt;        hdnId.Value = Id.Text;&lt;br /&gt;        DataSet dsContact = new DataSet();&lt;br /&gt;        dsContact = SqlHelper.ExecuteDataset(connectionString, "usp_GetContact", Convert.ToInt32(Id.Text.Trim()), EmpId, "S");&lt;br /&gt;        if (dsContact.Tables[0].Rows.Count != 0)&lt;br /&gt;        {&lt;br /&gt;            txtName.Text = dsContact.Tables[0].Rows[0]["Name"].ToString();&lt;br /&gt;            ddlRelation.SelectedValue = dsContact.Tables[0].Rows[0]["RelId"].ToString();            &lt;br /&gt;            txtAddress.Text = dsContact.Tables[0].Rows[0]["Address"].ToString();&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6002475942346182413?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6002475942346182413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/onclick-gridview-select-button-fill-all.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6002475942346182413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6002475942346182413'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/onclick-gridview-select-button-fill-all.html' title='Onclick Gridview Select button fill all the data to textbox.'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3582521844421608716</id><published>2010-09-06T01:34:00.001-07:00</published><updated>2010-10-17T07:57:56.448-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Join Three Table</title><content type='html'>&lt;span style="font-weight:bold;"&gt;How to join three table&lt;/span&gt; &lt;br /&gt;SELECT e.emp_name, d.DeptName&lt;br /&gt;FROM Emp e INNER JOIN DeptName d&lt;br /&gt;   ON e.emp_id = d.emp_id JOIN Sal s&lt;br /&gt;   ON d.dept_id = s.dept_id&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SELECT a.au_lname, a.au_fname, t.title&lt;br /&gt;FROM authors a INNER JOIN titleauthor ta&lt;br /&gt;   ON a.au_id = ta.au_id JOIN titles t&lt;br /&gt;   ON ta.title_id = t.title_id&lt;br /&gt;&lt;br /&gt;select&lt;br /&gt;    r.recipe_name,&lt;br /&gt;    i.ingredients_list,&lt;br /&gt;    p.products_list&lt;br /&gt;from&lt;br /&gt;    recipes r,&lt;br /&gt;    ingredients i,&lt;br /&gt;    products p&lt;br /&gt;where&lt;br /&gt;    r.RecipeID = i.IngreRecipeID and&lt;br /&gt;    i.IngreProductID = p.ProductID&lt;br /&gt;;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3582521844421608716?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3582521844421608716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/jointhreetable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3582521844421608716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3582521844421608716'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/jointhreetable.html' title='Join Three Table'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8824584488225629214</id><published>2010-09-06T01:33:00.003-07:00</published><updated>2011-01-09T07:08:16.776-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>How to Store Multiple Value In Session using asp.net c#</title><content type='html'>We can add multiple values by using class entiry or hashtable or arralist:&lt;br /&gt;Here a we will use Hashtable for storing multiple value in session&lt;br /&gt;&lt;br /&gt;Hashtable htEmpInfo = new Hashtable();&lt;br /&gt;&lt;br /&gt;htEmpInfo.Add("Name", "Santosh");&lt;br /&gt;htEmpInfo.Add("Designation", "SE");&lt;br /&gt;htEmpInfo.Add("Department", "MS");&lt;br /&gt;&lt;br /&gt;session["EmpDetails"]=htEmpInfo;&lt;br /&gt;&lt;br /&gt;Retrieving the values from the session&lt;br /&gt;&lt;br /&gt;Hashtable htEmpInformaiton = (Hashtable)session["EmpDetails"];&lt;br /&gt;lblEmopName.Text=htEmpInformaiton["Name"].ToString();&lt;br /&gt;lblDesignation.Text=htEmpInformaiton["Designation"].ToString();&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8824584488225629214?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8824584488225629214/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/storingmultiplevalueinsession.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8824584488225629214'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8824584488225629214'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/storingmultiplevalueinsession.html' title='How to Store Multiple Value In Session using asp.net c#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3146681646168458203</id><published>2010-09-06T01:31:00.000-07:00</published><updated>2011-12-22T02:34:46.411-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>OnkeyPress attributes in TextBox using JavaScript</title><content type='html'>Here code shows how to use onkeypress in TextBox.When user write in textbox a Label show no. of charachter entered in TextBox&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; function valid(txt,maxLen,lbl1)  &lt;br /&gt; {  &lt;br /&gt;      lbl1.innerText=(txt.value.length+1);   &lt;br /&gt;      if(txt.value.length &amp;gt; (maxLen-1))  &lt;br /&gt;      {  &lt;br /&gt;           alert("Entered Text reach at its maximum size..!");  &lt;br /&gt;           return false;  &lt;br /&gt;      }  &lt;br /&gt; }   &lt;br /&gt; txtFeedback.Attributes["onkeypress"] = "return valid(this,500," + Label1.ClientID + ")";  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3146681646168458203?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3146681646168458203/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/onkeypress-attributes-in-textbox-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3146681646168458203'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3146681646168458203'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/onkeypress-attributes-in-textbox-using.html' title='OnkeyPress attributes in TextBox using JavaScript'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3914025519097237882</id><published>2010-09-05T03:26:00.000-07:00</published><updated>2011-12-22T02:38:48.346-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Gridview  RowCommand</title><content type='html'>If you hav any button inside Gridview you handle that button under RowCommand like here Gridview have a Insert button inside Grid.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void gvStuDetails_RowCommand(object sender, GridViewCommandEventArgs e)  &lt;br /&gt; {  &lt;br /&gt;      if (e.CommandName.Equals("Insert"))  &lt;br /&gt;      {   &lt;br /&gt;           objStuCls.StuId = Convert.ToInt32(((DropDownList)gvStuDetails.FooterRow.FindControl("ddlNewStuId")).SelectedValue);  &lt;br /&gt;           objStuCls.StuName = Convert.ToString(((TextBox)gvStuDetails.FooterRow.FindControl("txtNewStuName")).Text);  &lt;br /&gt;           try  &lt;br /&gt;           {   &lt;br /&gt;                int int = objClassMasterBLL.InsertClassMaster(objStuCls);  &lt;br /&gt;                if (int &amp;gt; 0)  &lt;br /&gt;                {  &lt;br /&gt;                     msgText = "Record Added Successfully !";  &lt;br /&gt;                     gvStuDetails.EditIndex = -1;  &lt;br /&gt;                     gvStu();  &lt;br /&gt;                }  &lt;br /&gt;                else  &lt;br /&gt;                {  &lt;br /&gt;                     msg.Text = "This record already exists !";  &lt;br /&gt;                }  &lt;br /&gt;           }  &lt;br /&gt;           catch (Exception ee)  &lt;br /&gt;           {  &lt;br /&gt;                msg.Text = ee.Message.ToString();  &lt;br /&gt;           }   &lt;br /&gt;      }  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3914025519097237882?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3914025519097237882/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/gridview-rowcommand.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3914025519097237882'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3914025519097237882'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/gridview-rowcommand.html' title='Gridview  RowCommand'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4573877567967830032</id><published>2010-09-04T09:48:00.000-07:00</published><updated>2011-12-22T02:53:38.074-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Insert Images to SqlServer in ASP .NET</title><content type='html'>Here I am explaining how insert images into database using asp.net.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void Button1_Click(object sender, EventArgs e)  &lt;br /&gt; {  &lt;br /&gt;      FileUpload fileUpload1 = ((FileUpload)(this.FindControl("fileUpload1")));  &lt;br /&gt;      if (((fileUpload1.PostedFile == null) || (string.IsNullOrEmpty(fileUpload1.PostedFile.FileName) || (fileUpload1.PostedFile.InputStream == null))))   &lt;br /&gt;      {  &lt;br /&gt;           Label1.Text = "Please Upload Valid picture file";  &lt;br /&gt;           return;  &lt;br /&gt;      }  &lt;br /&gt;      int len = fileUpload1.PostedFile.ContentLength;  &lt;br /&gt;      byte[] pic = new byte[len];  &lt;br /&gt;      fileUpload1.PostedFile.InputStream.Read(pic, 0, len);  &lt;br /&gt;      string extension = System.IO.Path.GetExtension(fileUpload1.PostedFile.FileName).ToLower();  &lt;br /&gt;      string MIMEType = null;  &lt;br /&gt;      switch (extension)  &lt;br /&gt;      {  &lt;br /&gt;           case ".gif":  &lt;br /&gt;           MIMEType = "image/gif";  &lt;br /&gt;           break;  &lt;br /&gt;           case ".jpg":  &lt;br /&gt;           case ".jpeg":  &lt;br /&gt;           case ".jpe":  &lt;br /&gt;           MIMEType = "image/jpeg";  &lt;br /&gt;           break;  &lt;br /&gt;           case ".png":  &lt;br /&gt;           MIMEType = "image/png";  &lt;br /&gt;           break;  &lt;br /&gt;           default:  &lt;br /&gt;           Label1.Text = "Not a Valid file format";  &lt;br /&gt;           return;  &lt;br /&gt;           break;  &lt;br /&gt;      }   &lt;br /&gt;      string fname = txtName.Text;  &lt;br /&gt;      string lname = txtLName.Text;  &lt;br /&gt;      string gender = rdGender.SelectedItem.Text;  &lt;br /&gt;      string age = drpAge.SelectedItem.Text;  &lt;br /&gt;      string state = txtState.Text;   &lt;br /&gt;      SqlConnection myConnection;  &lt;br /&gt;      myConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["StrConnectSan"].ToString());   &lt;br /&gt;      SqlCommand myCommand = new SqlCommand("usp_InsertPersonDetail", myConnection);  &lt;br /&gt;      myCommand.CommandType = CommandType.StoredProcedure;  &lt;br /&gt;      myCommand.Parameters.Add("@FirstName", SqlDbType.VarChar, 50).Value = fname;  &lt;br /&gt;      myCommand.Parameters.Add("@LastName", SqlDbType.VarChar, 50).Value = lname;  &lt;br /&gt;      myCommand.Parameters.Add("@GenderID", SqlDbType.VarChar, 50).Value = gender;  &lt;br /&gt;      myCommand.Parameters.Add("@Age", SqlDbType.VarChar, 50).Value = age;  &lt;br /&gt;      myCommand.Parameters.Add("@MCA", SqlDbType.VarChar, 50).Value = str;  &lt;br /&gt;      myCommand.Parameters.Add("@State", SqlDbType.VarChar, 50).Value = state;  &lt;br /&gt;      myCommand.Parameters.Add("@MIMEType", SqlDbType.VarChar, 50).Value = MIMEType;   &lt;br /&gt;      myCommand.Parameters.Add("@ImageData",SqlDbType.Image,16).Value = pic;  &lt;br /&gt;      myCommand.Parameters.Add("@Length", SqlDbType.VarChar, 50).Value = len;  &lt;br /&gt;      myConnection.Open();  &lt;br /&gt;      myCommand.ExecuteNonQuery();  &lt;br /&gt;      myConnection.Close();  &lt;br /&gt;      msg.Text = "Record save successfully";        &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4573877567967830032?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4573877567967830032/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/save-image-to-sql-server-databse.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4573877567967830032'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4573877567967830032'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/save-image-to-sql-server-databse.html' title='Insert Images to SqlServer in ASP .NET'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8376473022511142242</id><published>2010-09-03T04:21:00.000-07:00</published><updated>2011-12-22T02:58:10.015-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Validation Groups in ASP.NET 2.0</title><content type='html'>Validation groups is a new feature of asp.net 2.0.Validation groups help you to group the controls in a page and you can have separate submit buttons for each group.When you submit a group of values from a group,the validation controls pertaining to that group alone is executed.&lt;br /&gt;&lt;br /&gt;Here is a example how to use validation group.&lt;br /&gt;On clicking of Save Button,it should fire the Required Field validator of Name is required fields only. In the same way,on clicking Save Password it should fire &lt;br /&gt;the Required Field validator only for Password is required fields.&lt;br /&gt;&lt;br /&gt;For Group1&lt;br /&gt; &lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;asp:TextBox ID="txtusername" runat="server" ValidationGroup="Group1"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;  &lt;br /&gt; &amp;lt;asp:RequiredFieldValidator ID="rfvUname" runat="server" ControlToValidate="txtusername"  &lt;br /&gt;    ErrorMessage="Name is required." ValidationGroup="Group1"&amp;gt;*&amp;lt;/asp:RequiredFieldValidator&amp;gt;  &lt;br /&gt; &amp;lt;asp:Button ID="btnSave" runat="server" Text="Save" ValidationGroup="Group1" /&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;For Group2&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;asp:TextBox ID="txtPassword" runat="server" TextMode="Password" ValidationGroup="Group2&amp;gt;&amp;lt;/asp:TextBox&amp;gt;  &lt;br /&gt; &amp;lt;asp:RequiredFieldValidator ID="rfvpass" runat="server" ControlToValidate="txtPassword"  &lt;br /&gt;    ErrorMessage="Password is required." ValidationGroup="Group2"&amp;gt;*&amp;lt;/asp:RequiredFieldValidator&amp;gt;  &lt;br /&gt; &amp;lt;asp:Button ID="btnSavePass" runat="server" Text="Save Password" ValidationGroup="Group2" /&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8376473022511142242?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8376473022511142242/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/validation-groups-in-aspnet-20.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8376473022511142242'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8376473022511142242'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/validation-groups-in-aspnet-20.html' title='Validation Groups in ASP.NET 2.0'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-600958006977094939</id><published>2010-09-02T06:24:00.000-07:00</published><updated>2010-10-13T05:53:06.947-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview'/><title type='text'>Dot net interview Questions and Answers</title><content type='html'>&lt;span style="font-weight:bold;"&gt;1. What is a static class?&lt;/span&gt;&lt;br /&gt;      Ans.A static class is a class which can not be instantiated using the ‘new’ keyword. They also only contain static members,are sealed and have a private constructor.&lt;br /&gt;          Static classes are classes that contain only static members.A static  class is basically the same as a non-static class, but there is one difference: a static class cannot be instantiated. In other words, you cannot use the new  keyword&lt;br /&gt;          to create a variable of the class type. Because there is no instance variable, you access the members of a static class by using the class name itself. For example, if you have a static class that is named UtilityClass that has a public method named MethodA, you call the method as shown in the following example:&lt;br /&gt;          UtilityClass.MethodA();&lt;br /&gt;          &lt;br /&gt;          A static class can be used as a convenient container for sets of methods that just operate on input parameters and do not have to get or set any internal instance fields. For example, in the .NET Framework Class Library, the static System.Math  class contains methods that perform mathematical operations,without any requirement to store or retrieve data that is  unique to a particular instance of the Math class. That is, you apply the members of the class by specifying the class name  and the method name, as shown in the following example.&lt;br /&gt;            public static class TemperatureConverter&lt;br /&gt;            {&lt;br /&gt;                public static double CelsiusToFahrenheit(string temperatureCelsius)&lt;br /&gt;                {&lt;br /&gt;                    // Convert argument to double for calculations.&lt;br /&gt;                    double celsius = Double.Parse(temperatureCelsius);        &lt;br /&gt;                    // Convert Celsius to Fahrenheit.&lt;br /&gt;                    double fahrenheit = (celsius * 9 / 5) + 32;        &lt;br /&gt;                    return fahrenheit;&lt;br /&gt;                }        &lt;br /&gt;                public static double FahrenheitToCelsius(string temperatureFahrenheit)&lt;br /&gt;                {&lt;br /&gt;                    // Convert argument to double for calculations.&lt;br /&gt;                    double fahrenheit = Double.Parse(temperatureFahrenheit);        &lt;br /&gt;                    // Convert Fahrenheit to Celsius.&lt;br /&gt;                    double celsius = (fahrenheit - 32) * 5 / 9;        &lt;br /&gt;                    return celsius;&lt;br /&gt;                }&lt;br /&gt;            }        &lt;br /&gt;            class TestTemperatureConverter&lt;br /&gt;            {&lt;br /&gt;                static void Main()&lt;br /&gt;                {&lt;br /&gt;                    Console.WriteLine("Please select the convertor direction");&lt;br /&gt;                    Console.WriteLine("1. From Celsius to Fahrenheit.");&lt;br /&gt;                    Console.WriteLine("2. From Fahrenheit to Celsius.");&lt;br /&gt;                    Console.Write(":");&lt;br /&gt;        &lt;br /&gt;                    string selection = Console.ReadLine();&lt;br /&gt;                    double F, C = 0;        &lt;br /&gt;                    switch (selection)&lt;br /&gt;                    {&lt;br /&gt;                        case "1":&lt;br /&gt;                            Console.Write("Please enter the Celsius temperature: ");&lt;br /&gt;                            F = TemperatureConverter.CelsiusToFahrenheit(Console.ReadLine());&lt;br /&gt;                            Console.WriteLine("Temperature in Fahrenheit: {0:F2}", F);&lt;br /&gt;                            break;        &lt;br /&gt;                        case "2":&lt;br /&gt;                            Console.Write("Please enter the Fahrenheit temperature: ");&lt;br /&gt;                            C = TemperatureConverter.FahrenheitToCelsius(Console.ReadLine());&lt;br /&gt;                            Console.WriteLine("Temperature in Celsius: {0:F2}", C);&lt;br /&gt;                            break;        &lt;br /&gt;                        default:&lt;br /&gt;                            Console.WriteLine("Please select a convertor.");&lt;br /&gt;                            break;&lt;br /&gt;                    }        &lt;br /&gt;                    // Keep the console window open in debug mode.&lt;br /&gt;                    Console.WriteLine("Press any key to exit.");&lt;br /&gt;                    Console.ReadKey();&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            /* Example Output:&lt;br /&gt;                Please select the convertor direction&lt;br /&gt;                1. From Celsius to Fahrenheit.&lt;br /&gt;                2. From Fahrenheit to Celsius.&lt;br /&gt;                :2&lt;br /&gt;                Please enter the Fahrenheit temperature: 20&lt;br /&gt;                Temperature in Celsius: -6.67&lt;br /&gt;                Press any key to exit.&lt;br /&gt;             */&lt;br /&gt;    &lt;br /&gt;    The following list provides the main features of a static class:&lt;br /&gt;         - Contains only static members.&lt;br /&gt;         - Cannot be instantiated.&lt;br /&gt;         - Is sealed.&lt;br /&gt;         - Cannot contain Instance Constructors.&lt;br /&gt;    There are few limitations for static classes&lt;br /&gt;    - It can only contain static members (members explicitly marked with keyword ‘static’)&lt;br /&gt;    - It can not be instantiated&lt;br /&gt;    - It is sealed by default (i.e., it can not be inherited)&lt;br /&gt;    - It can not contain a constructor (although it may have a static constructor)&lt;br /&gt;    &lt;br /&gt;    The static classes might be useful when we want a class which can not be instantiated or which should only be initiated once (Singleton class).&lt;br /&gt;    We may achieve the same functionality by declaring all members in ordinary class as static and making its constructor private. But when using&lt;br /&gt;    static classes, compiler ensures that none of the member of its members is non-static (i.e., all members are static).&lt;br /&gt;&lt;br /&gt;   &lt;span style="font-weight:bold;"&gt;2. What is static member?&lt;/span&gt;&lt;br /&gt;   Ans.A non-static class can contain static methods, fields, properties, or events. The static member is callable on a class even when no instance of the  class has been created. The static member is always accessed by the class name, not the instance name. Only one copy of a static member exists, regardless  of how many instances of the class are created. Static methods and properties cannot access non-static fields and events in their containing type, and they cannot access an instance variable of any object unless it is explicitly passed in a method parameter.&lt;br /&gt;&lt;br /&gt;   It is more typical to declare a non-static class with some static members, than to declare an entire class as static. Two common uses of static fields are to keep a count of the number of objects that have been instantiated, or to store a value that must be shared among all instances.&lt;br /&gt;&lt;br /&gt;   Static methods can be overloaded but not overridden, because they belong to the class, and not to any instance of the class.&lt;br /&gt;&lt;br /&gt;   Although a field cannot be declared as static const, a const field is essentially static in its behavior. It belongs to the type, not to instances  of the type. Therefore, const fields can be accessed by using the same ClassName.MemberName notation that is used for static fields. No object  instance is required.&lt;br /&gt;&lt;br /&gt;   C# does not support static local variables (variables that are declared in method scope).&lt;br /&gt;&lt;br /&gt;   You declare static class members by using the static keyword before the return type of the member, as shown in the following example:&lt;br /&gt;&lt;br /&gt;    public class Automobile&lt;br /&gt;    {&lt;br /&gt;        public static int NumberOfWheels = 4;&lt;br /&gt;        public static int SizeOfGasTank&lt;br /&gt;        {&lt;br /&gt;            get&lt;br /&gt;            {&lt;br /&gt;                return 15;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        public static void Drive() { }&lt;br /&gt;        public static event EventType RunOutOfGas;&lt;br /&gt;    &lt;br /&gt;        // Other non-static fields and properties...&lt;br /&gt;    }&lt;br /&gt;   Static members are initialized before the static member is accessed for the first time and before the static constructor, if there is one, is called. To access a static class member, use the name of the class instead of a variable name to specify the location of the member, as shown  in the following example:&lt;br /&gt;   Automobile.Drive();&lt;br /&gt;   int i = Automobile.NumberOfWheels;&lt;br /&gt;   &lt;br /&gt;   If your class contains static fields, provide a static constructor that initializes them when the class is loaded.&lt;br /&gt;   &lt;br /&gt;   A call to a static method generates a call instruction in Microsoft intermediate language (MSIL), whereas a call to an instance method generates a callvirt instruction, which also checks for a null object references. However, most of the time the performance difference between the two is not significant. &lt;br /&gt;&lt;br /&gt; The C# provides a special type of constructor known as static constructor to initialize the static data members when the class is loaded at first. Remember&lt;br /&gt; that, just like any other static member functions, static constructors can't access non-static data members directly.&lt;br /&gt;&lt;br /&gt; The name of a static constructor must be the name of the class and even they don't have any return type. The keyword static is used to differentiate the&lt;br /&gt; static constructor from the normal constructors. The static constructor can't take any arguments. That means there is only one form of static constructor,&lt;br /&gt; without any arguments. In other way it is not possible to overload a static constructor.&lt;br /&gt;&lt;br /&gt; We can't use any access modifiers along with a static constructor.&lt;br /&gt;&lt;br /&gt; // C# static constructor&lt;br /&gt; // Author: rajeshvs@msn.com&lt;br /&gt; using System;&lt;br /&gt; class MyClass&lt;br /&gt; {&lt;br /&gt;   public static int x;&lt;br /&gt;   public static int y;&lt;br /&gt;   static MyClass ()&lt;br /&gt;    {&lt;br /&gt;      x = 100;&lt;br /&gt;      Y = 200;&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt; class MyClient&lt;br /&gt; {&lt;br /&gt;   public static void Main()&lt;br /&gt;    {&lt;br /&gt;     Console.WriteLine("{0},{1},{2}",MyClass.x,MyClass.y);&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Note that static constructor is called when the class is loaded at the first time. However we can't predict the exact time and order of static constructor&lt;br /&gt; execution. They are called before an instance of the class is created, before a static member is called and before the static constructor of the derived class&lt;br /&gt; is called. &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;   3. What is static function?&lt;/span&gt;&lt;br /&gt;   Ans.A static function is another term for a static method. It allows you to execute the function without creating an instance of its defining class. &lt;br /&gt;       They are similar to global functions. An example of a static function could be: ConvertFromFarenheitToCelsius with a signature as follows:&lt;br /&gt;&lt;br /&gt; public static double ConvertFromFarenheitToCelsius (string valToConvert)&lt;br /&gt; {&lt;br /&gt; //add code here&lt;br /&gt; } &lt;br /&gt; Inside a C# class, member functions can also be declared as static. But a static member function can access only other static members. They can access non-static &lt;br /&gt; members only through an instance of the class.&lt;br /&gt;&lt;br /&gt; We can invoke a static member only through the name of the class. In C#, static members can't invoked through an object of the class as like in C++ or JAVA.&lt;br /&gt; // C#:static &amp; non-static&lt;br /&gt; // Author: rajeshvs@msn.com&lt;br /&gt; using System;&lt;br /&gt; class MyClass&lt;br /&gt; {&lt;br /&gt;   private static int x = 20;&lt;br /&gt;   private static int y = 40;&lt;br /&gt;   public static void Method()&lt;br /&gt;   {&lt;br /&gt;     Console.WriteLine("{0},{1}",x,y); &lt;br /&gt;   }&lt;br /&gt; }&lt;br /&gt; class MyClient&lt;br /&gt; {&lt;br /&gt;   public static void Main()&lt;br /&gt;   {&lt;br /&gt;    MyClass.Method();&lt;br /&gt;    }&lt;br /&gt; }&lt;br /&gt; &lt;br /&gt; &lt;span style="font-weight:bold;"&gt;  4. What is static constructor?&lt;/span&gt;&lt;br /&gt;      Ans.A static constructor has a similar function as a normal constructor i.e. it is automatically called the first time a class is loaded. The differences between &lt;br /&gt;      a conventional constructor are that it cannot be overloaded, cannot have any parameters nor have any access modifiers and must be preceded by the&lt;br /&gt;      keyword static. In addition, a class with a static constructor may only have static members.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt; 5. How can we inherit a static variable?&lt;/span&gt;&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt; 6. How can we inherit a static member?&lt;/span&gt;&lt;br /&gt;      Ans. of 5 &amp; 6&lt;br /&gt;      When inheriting static members there is no need to instantiate the defining class using the ‘new’ keyword.&lt;br /&gt;      &lt;br /&gt;      public class MyBaseClass&lt;br /&gt;      {&lt;br /&gt;      MyBaseClass()&lt;br /&gt;      {&lt;br /&gt;      }&lt;br /&gt;      public static void PrintName()&lt;br /&gt;      {&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public class MyDerivedClass : MyBaseClass&lt;br /&gt;      {&lt;br /&gt;      MyDerivedClass ()&lt;br /&gt;      {&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;      public void DoSomething()&lt;br /&gt;      {&lt;br /&gt;      MyBaseClass.GetName();&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt; 7. Can we use a static function with a non-static variable?&lt;/span&gt;&lt;br /&gt;      Ans.No.&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt; 8. How can we access static variable?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      By employing the use of a static member field as follows:&lt;br /&gt;      public class CashSales&lt;br /&gt;      {&lt;br /&gt;      //declare static member field&lt;br /&gt;      private static int maxUnitsAllowed = 50;&lt;br /&gt;      &lt;br /&gt;      //declare method to return maximum number of units allowed&lt;br /&gt;      &lt;br /&gt;      public static int GetMaxUnitsAllowed ()&lt;br /&gt;      {&lt;br /&gt;      Return maxUnitsAllowed;&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      }&lt;br /&gt;      The static field can now be accessed by simply doing CashSales.GetMaxUnitsAllowed(). No need to create an instance of the class.&lt;br /&gt;      &lt;br /&gt;   &lt;span style="font-weight:bold;"&gt;9. Why main function is static?&lt;/span&gt;&lt;br /&gt;      Ans.Because it is automatically loaded by the CLR and initialised by the runtime when the class is first loaded. If it wasn’t static an instance of&lt;br /&gt;      the class would first need to be created and initialised.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;10. How will you load dynamic assembly? How will create assesblies at run time?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Load assembly:&lt;br /&gt;      By using classes from the System.Reflection namespace.&lt;br /&gt;      Assembly x = Assembly.LoadFrom( “LoadMe.dll” );&lt;br /&gt;      &lt;br /&gt;      Create assembly;&lt;br /&gt;      Use classes from System.CodeDom.Compiler;&lt;br /&gt;      &lt;br /&gt;&lt;span style="font-weight:bold;"&gt;  11. What is Reflection?&lt;/span&gt;&lt;br /&gt;      Ans.The System.Reflection namespace provides us with a series of classes that allow us to interrogate the codebase at run-time and perform functions &lt;br /&gt;      such as dynamically load assemblies, return property info e.t.c.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 12. If I have more than one version of one assemblies, then how will I use old version (how/where to specify version number?) in my application?&lt;/span&gt;&lt;br /&gt;      Ans.The version number is stored in the following format: …. The assembly manifest can then contain a reference to which version number we want to use.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 13. How do you create threading in.NET? What is the namespace for that?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;       System.Threading;&lt;br /&gt;       &lt;br /&gt;       //create new thread using the thread class’s constructor&lt;br /&gt;       &lt;br /&gt;       Thread myThread = new Thread(new ThreadStart (someFunction));&lt;br /&gt;       &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 14. What do you mean by Serialize and MarshalByRef?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Serialization is the act of saving the state of an object so that it can be recreated (i.e deserialized) at a later date.&lt;br /&gt;      The MarshalByRef class is part of the System.Runtime.Remoting namespace and enables us to access and use objects that reside in different application &lt;br /&gt;      domains. It is the base class for objects that need to communicate across application domains. MarshalByRef objects are accessed directly within their own &lt;br /&gt;      application domain by using a proxy to communicate. With MarshalByValue the a copy of the entire object is passed across the application domain&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 15. What is the difference between Array and LinkedList?&lt;/span&gt;&lt;br /&gt;      Ans.An array is a collection of the same type. The size of the array is fixed in its declaration.&lt;br /&gt;       A linked list is similar to an array but it doesn’t have a limited size.&lt;br /&gt;       &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;16. What is Asynchronous call and how it can be implemented using delegates?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      A synchronous call will wait for a method to complete before program flow is resumed. With an asynchronous call the program flow continues whilst the method executes.&lt;br /&gt;      &lt;br /&gt;      //create object&lt;br /&gt;      SomeFunction objFunc = new SomeFunction();&lt;br /&gt;      &lt;br /&gt;      //create delegate&lt;br /&gt;      SomeDelegate objDel = new SomeDelegate(objFunc.FunctionA);&lt;br /&gt;      &lt;br /&gt;      //invoke the method asynchronously (use interface IAsyncResult)&lt;br /&gt;      IAsyncResult asynchCall = SomeDelegate.Invoke();&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;17. How to create events for a control? What is custom events? How to create it?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      An event is a mechanism used in a class that can be used to provide a notification when something interesting happens. (typical evens in a windows application &lt;br /&gt;      include: change text in textbox, double click or click a button, select an item in dropdown box).      &lt;br /&gt;      A custom event is an event created by the user that other developers can use. For example assuming that we have a CashTransaction class and we have a bank &lt;br /&gt;      balance property in that class. We may want to set-up an event that provides a notification when the bank balance drops below a certain amount. In order to &lt;br /&gt;      produce an event the process would be roughly as follows:      &lt;br /&gt;      Create the class for the event derived from EventArgs.&lt;br /&gt;      Create a delegate with a return type of void.&lt;br /&gt;      Create a class containing the method that will activate the event.&lt;br /&gt;      Create a class with methods to handle the event.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;18. If you want to write your own dot net language, what steps you will you take care?&lt;/span&gt;&lt;br /&gt;      Ans.We will need to ensure that the high level code is compiled to MSIL (Microsoft intermediate language) so that it can be interpreted by the CLR.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 19. Describe the diffeerence between inline and code behind - which is best in a loosely coupled solution?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      The term ‘code behind’ refers to application code that is not embedded within the ASPX page and is separated out into a separate file which is then referenced &lt;br /&gt;      from the ASPX page. Inline code is the traditional ASP architectural model where business logic code was embedded within the ASP page. Separating the business &lt;br /&gt;      logic code from the presentation layer offers several advantages:      &lt;br /&gt;      1) It allows graphic designers and web developers to work on the presentation layer whilst the application developers concentrate on the business logic.&lt;br /&gt;      2) The codebehind file is compiled as a single dll increasing the efficiency of the application,&lt;br /&gt;      3) The codebehind model offers a true OO development platform,&lt;br /&gt;      4) It speeds up development time as it allows developers to fully maximise the features of the .NET framework such as Cahing, ViewState, Session, Smart Navigation etc.&lt;br /&gt;      5) Code is much easier to maintain and susceptible for change.&lt;br /&gt;      6) The compiler and VS.NET provides much better support for error checking, intellisense and debugging when using the code behind model.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;20. How dot net compiled code will become platform independent?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      The raison d’etre for .NET was to cater for multiples languages on a single windows platform whereas the aim of Java was to be a single language on multiple &lt;br /&gt;      platforms. The only way that .NET can be platform independent is if there is a version of the .NET framework installed on the target machine.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;21. Without modifying source code if we compile again, will it be generated MSIL again?&lt;/span&gt;&lt;br /&gt;      Ans.No.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 22. How does you handle this COM components developed in other programming languages in.NET?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      use TlbImp.exe to import the COM types into your .NET project. If no type library for the COM component then use System.Runtime.InteropServices&lt;br /&gt;      use RegAsm.exe to call a .NET developed component in a COM application.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;23. How CCW (Com Callable Wrapper) and RCW (Runtime Callable Wrappers) works?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      CCW: When a COM application calls a NET object the CLR creates the CCW as a proxy since the COM application is unable to directly access the .NET object.&lt;br /&gt;      RCW: When a .NET application calls a COM object the CLR creates the RCW as a proxy since the .NET application is unable to directly access the .COM object.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;24. What are the new thee features of COM+ services, which are not there in COM (MTS)?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Role based security.&lt;br /&gt;      Neutral apartment threading.&lt;br /&gt;      New environment called context which defines the execution environment&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;25. What are the differences between COM architecture and.NET architecture?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      .Net architecture has superseded the old COM architecture providing a flexible rapid application development environment which can be used to create windows, &lt;br /&gt;       web and console applications and web services. .NET provides a powerful development environment that can be used to create objects in any .NET compliant language.&lt;br /&gt;      .NET addresses the previous problems of dll hell with COM by providing strongly named assemblies and side-by-side execution where two assemblies with the same name can run on the same box.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 26. Can we copy a COM dll to GAC folder?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      No. It only stores .NET assemblies.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;27. What is Shared and Repeatable Inheritance?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;28. Can you explain what inheritance is and an example of when you might use it?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Inheritance is a fundamental feature of any OO language. It allows us to inherit the members and attributes from a base class to a new derived class. This &lt;br /&gt;      leads to increased code reusability and also makes applications easier to develop, maintain and extend as the new derived class can contain new features not &lt;br /&gt;      available in the base class whilst at the same time preserving the attributes inherited from the base class.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;29. How can you write a class to restrict that only one object of this class can be created (Singleton class)?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Use the singleton design pattern.&lt;br /&gt;      public sealed class Singleton&lt;br /&gt;      {&lt;br /&gt;      static readonly Singleton Instance=new Singleton();&lt;br /&gt;      &lt;br /&gt;      static Singleton()&lt;br /&gt;      {&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      Singleton()&lt;br /&gt;      {&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;      public static Singleton Instance&lt;br /&gt;      {&lt;br /&gt;      get&lt;br /&gt;      {&lt;br /&gt;      return Instance;&lt;br /&gt;      }&lt;br /&gt;      }&lt;br /&gt;      }&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;30. What are virtual destructures?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      A constructor can not be virtual but a destructor may. Use virtual destructors when you want to implement polymorphic tearing down of an object.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;31. What is close method? How its different from Finalize and Dispose?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      finalise is the process that allows the garbage collector to clean up any unmanaged resources before it is destroyed.&lt;br /&gt;      The finalise method can not be called directly; it is automatically called by the CLR. In order to allow more control over the release of unmanaged resources&lt;br /&gt;      the .NET framework provides a dispose method which unlike finalise can be called directly by code.&lt;br /&gt;      Close method is same as dispose. It was added as a convenience.&lt;br /&gt;      &lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;32. What is Boxing and UnBoxing?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      Boxing is the process of converting a value type to a reference type. More specifically it involves encapsulating a copy of the object and moving it from&lt;br /&gt;      stack to heap. Unboxing is the reverse process.&lt;br /&gt;      &lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 33. What is check/uncheck?&lt;/span&gt;&lt;br /&gt;      Ans.&lt;br /&gt;      checked: used to enable overflow checking for arithmetic and conversion functions.&lt;br /&gt;      unchecked: used to disable overflow checking for arithmetic and conversion functions      &lt;br /&gt;&lt;br /&gt;  &lt;span style="font-weight:bold;"&gt;34. What is the use of base keyword? Tell me a practical example for base keyword’s usage?&lt;/span&gt;&lt;br /&gt;   Ans.&lt;br /&gt;      The base keyword is used to access members of the base class from within a derived class:&lt;br /&gt;          * Call a method on the base class that has been overridden by another method.&lt;br /&gt;          * Specify which base-class constructor should be called when creating instances of the derived class.&lt;br /&gt;      &lt;br /&gt;      A base class access is permitted only in a constructor, an instance method, or an instance property accessor.&lt;br /&gt;      It is an error to use the base keyword from within a static method.&lt;br /&gt;      Example:In this example, both the base class, Person, and the derived class, Employee, have a method named Getinfo. By using the base keyword,&lt;br /&gt;      it is possible to call the Getinfo method on the base class, from within the derived class.&lt;br /&gt;      // keywords_base.cs&lt;br /&gt;      // Accessing base class members&lt;br /&gt;      using System;&lt;br /&gt;         public class Person &lt;br /&gt;         {&lt;br /&gt;            protected string ssn = "444-55-6666";&lt;br /&gt;            protected string name = "John L. Malgraine";&lt;br /&gt;      &lt;br /&gt;            public virtual void GetInfo() &lt;br /&gt;            {&lt;br /&gt;               Console.WriteLine("Name: {0}", name);&lt;br /&gt;               Console.WriteLine("SSN: {0}", ssn);&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;         class Employee: Person &lt;br /&gt;         {&lt;br /&gt;            public string id = "ABC567EFG";&lt;br /&gt;      &lt;br /&gt;            public override void GetInfo() &lt;br /&gt;            {&lt;br /&gt;               // Calling the base class GetInfo method:&lt;br /&gt;               base.GetInfo();&lt;br /&gt;               Console.WriteLine("Employee ID: {0}", id);&lt;br /&gt;            }&lt;br /&gt;         }&lt;br /&gt;      &lt;br /&gt;      class TestClass {&lt;br /&gt;         public static void Main() &lt;br /&gt;         {&lt;br /&gt;            Employee E = new Employee();&lt;br /&gt;            E.GetInfo();&lt;br /&gt;         }&lt;br /&gt;      }&lt;br /&gt;&lt;br /&gt; &lt;span style="font-weight:bold;"&gt; 35. What are the different.NET tools which you used in projects?&lt;/span&gt;&lt;br /&gt;Ans:Just read your question once again and thought Interviewer might be asking about the development tool you have used to develop ASP.NET projects. &lt;br /&gt;      So your answer can be Visual Studio 2005 or 2008 or 2010 whatever you have used, you may also tell Visual Web Developer or any other tool you might&lt;br /&gt;      have used to develop your ASP.NET Projects&lt;br /&gt;&lt;br /&gt;Remaining answers coming soon&lt;br /&gt;  36. What will do to avoid prior case?&lt;br /&gt;  37. What happens when you try to update data in a dataset in.NET while the record is already deleted in SQL Server as backend?&lt;br /&gt;  38. What is concurrency? How will you avoid concurrency when dealing with dataset?&lt;br /&gt;  39. One user deleted one row after that another user through his dataset was trying to update same row. What will happen? How will you avoid this problem?&lt;br /&gt;  40. How do you merge two datasets into the third dataset in a simple manner?&lt;br /&gt;  41. If you are executing these statements in commandObject.Select * from Table1; Select * from Table2? How you will deal result set?&lt;br /&gt;  42. How do you sort a dataset.&lt;br /&gt;  43. If a dataset contains 100 rows, how to fetch rows between 5 and 15 only?&lt;br /&gt;  44. What is the use of Parameter object?&lt;br /&gt;  45. How to generateXML from a dataset and vice versa?&lt;br /&gt;  46. How do you implement locking concept for dataset?&lt;br /&gt;  47. How will you do Redo and Undo in TextBox control?&lt;br /&gt;  48. How to implement DataGrid in.NET? How would you make a combo-box appear in one column of a DataGrid? What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods. what is the access specifier used for that methods in the code behind file and why?&lt;br /&gt;  49. How can we create Tree control in asp.NET?&lt;br /&gt;  50. Write a program in C# to find the angle between the hours and minutes in a clock?&lt;br /&gt;  51. Write a program to create a user control with name and surname as data members and login as method and also the code to call it.&lt;br /&gt;  52. How can you read 3rd line from a text file?&lt;br /&gt;  53. Explain the code behind wors and contrast that using the inline style.&lt;br /&gt;  54. Explain different types of HTML, Web and server controls.&lt;br /&gt;  55. What are the differences between user control and server control?&lt;br /&gt;  56. How server form post-back works?&lt;br /&gt;  57. Can the action attribute of a server-side&lt;br /&gt;      tag be set to a value and if not how can you possibly pass data from a form page to a subsequent page?&lt;br /&gt;  58. How would ASP and ASP.NET apps run at the same time on the same server?&lt;br /&gt;  59. What are good ADO.NET object to replace to ADO Recordset object.&lt;br /&gt;  60. Explain the differences between Server-side code and Client-side code.&lt;br /&gt;  61. What type of code(server or client) is found in a Code-Behind class?&lt;br /&gt;  62. Should validation (did the user enter a real date) occur server-side or client-side? Why?&lt;br /&gt;  63. What does the EnableViewState property do? Why would I want it on or off?&lt;br /&gt;  64. What is the difference between Server.Transfer and response.Redirect? Why?&lt;br /&gt;  65. Can you give an example of when it would be appropriate to use a web service as opposed to a non-serviced.NET component?&lt;br /&gt;  66. Let’s say I have an existing application written using VB6 and this application utilizes Windows 2000 COM+ transaction services. How would you approach migrating this application to.NET?&lt;br /&gt;  67. If I am developing an application that must accomodate multiple security levels though secure login and my ASP.NET web application is spanned across three web-servers (using round-robin load balancing). What would be the best approach to maintain login-in state for the users?&lt;br /&gt;  68. What are ASP.NET web forms? How is this technology different than what is available though ASP(1.0-3.0)?&lt;br /&gt;  69. How does VB.NET achieve polymorphism?&lt;br /&gt;  70. How does C# achieve polymorphism?&lt;br /&gt;  71. Can you explain what is Inheritance and an example in VB.NET and C# of when you might use it?&lt;br /&gt;  72. Describe difference between inline and code-behind?&lt;br /&gt;  73. What is loosely coupled solution in.NET?&lt;br /&gt;  74. What is diffgram?&lt;br /&gt;  75. Where would you use an iHTTPModule and what are the limitations of any approach you might take in implementing one?&lt;br /&gt;  76. What are the Advantages and DisAdvantages of viewstate?&lt;br /&gt;  77. Describe session handling in a webform, how does it work and what are the limitations?&lt;br /&gt;  78. How would you get ASP.NET running in Apache web servers? Explain it’s limitations.&lt;br /&gt;  79. What is MSIL and why should my developers need an appreciation of it if at all?&lt;br /&gt;  80. Which methos do you invoke on the DataAdapter control to load your generated dataset with data?&lt;br /&gt;  81. Can you edit data in Repeater control? How?&lt;br /&gt;  82. Which template must you provide, in order to display data in a Repeater control?&lt;br /&gt;  83. How can you provide an alternating color scheme in a Repeater control?&lt;br /&gt;  84. What property must you set, and what method must you call in your code, in order to bind the data from some data source to the repeater control?&lt;br /&gt;  85. What base class do all web forms inherit from?&lt;br /&gt;  86. What method do you use to explicitly kill a user’s session? How?&lt;br /&gt;  87. How do you turn off cookies for one page in your site? Give an example.&lt;br /&gt;  88. Which two properties are on every validation control?&lt;br /&gt;  89. What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.&lt;br /&gt;  90. How do you create a permanent cookie?&lt;br /&gt;  91. What tag do you use to add a hyperlink column to the dataGrid?&lt;br /&gt;  92. What is the standard you use to wrap up a call to a Web Service?&lt;br /&gt;  93. Which method do you use to redirect the user to another page without performing a round trip to the client? How?&lt;br /&gt;  94. What is the transport protocol you use to call a Seb Service SOAP?&lt;br /&gt;  95. What does WSDL stand for?&lt;br /&gt;  96. What property do you have to set to tell the grid which page to go to when using the Pager object?&lt;br /&gt;  97. Where on the Internet would you look for Web Services?&lt;br /&gt;  98. What tags do you need to add within the asp:datagrid tags to bind columns manually? How?&lt;br /&gt;  99. Which property on a Combo Box do you set with a column name, prior to setting the DataSource, to display data in the combo box?&lt;br /&gt; 100. How is a property designated as read-only?&lt;br /&gt; 101. Which control would you use if you needed to make sure the values in two different controls matched?&lt;br /&gt; 102.How do you manage session in ASP and ASP.NET&lt;br /&gt; 103.How do you handle session management in ASP.NET and how do you implement them. How do you handle in case of SQLServer mode.&lt;br /&gt; 104.What are different authentication types. How do you retreive user id in case of windows authentication&lt;br /&gt; 105.For a server control, you need to have same properties like color maxlength, size,and allowed character throughout the application. How do you handle this.&lt;br /&gt; 106.What is custom control. What is the difference between custom control and user control&lt;br /&gt; 107 What is the syntax for datagrid and specifying columns&lt;br /&gt;108. How do you add a javascript function for a link button in a datagrid.&lt;br /&gt;109. Does C# supports multi-dimensional arrays&lt;br /&gt;110 How to transpose rows into columns and columns into rows in a multi-dimensional array&lt;br /&gt;111.What are object oriented concepts&lt;br /&gt;112. How do you create multiple inheritance in C#&lt;br /&gt;113. ADO and ADO.NET differences&lt;br /&gt;114. Features and disadvantages of dataset&lt;br /&gt;115. What is the difference between and ActiveX dll and control&lt;br /&gt;116. How do you perform validations&lt;br /&gt;117. What is reflection and disadvantages of reflection&lt;br /&gt;118. What is boxing and how it is done internally&lt;br /&gt;119 Types of authentications in IIS&lt;br /&gt;120. What are the security issues if we send a query from the application&lt;br /&gt;121. Difference between ByVal and ByRef&lt;br /&gt;122. Disadvantages of COM components&lt;br /&gt;123. How do we invoke queries from the application&lt;br /&gt;124. What is the provider and namespaces being used to access oracle database&lt;br /&gt;125. How do you load XML document and perform validation of the document&lt;br /&gt;126. How do you access elements in XML document&lt;br /&gt;127. What is ODP.NET&lt;br /&gt;128. Types of session management in ASP.NET&lt;br /&gt;129. Difference between datareader and dataset&lt;br /&gt;130. What are the steps in connecting to database&lt;br /&gt;131. How do you register a .NET assembly&lt;br /&gt;132. Usage of web.config&lt;br /&gt;133. About remoting and web services. Difference between them&lt;br /&gt;134. Caching techniques in .NET&lt;br /&gt;135. About CLS and CTS&lt;br /&gt;136. Is overloading possible in web services&lt;br /&gt;137. Difference between .NET and previous version&lt;br /&gt;138. Types of chaching. How to implement caching&lt;br /&gt;139. Features in ASP.NET&lt;br /&gt;140. How do you do validations. Whether client-side or server-side validations are better&lt;br /&gt;141. How do you implement multiple inheritance in .NET&lt;br /&gt;142. Difference between multi-level and multiple inheritance&lt;br /&gt;143. Difference between dataset and datareader&lt;br /&gt;144. What are runtime hosts&lt;br /&gt;145. What is an application domain&lt;br /&gt;146. What is viewstate&lt;br /&gt;147. About CLR, reflection and assemblies&lt;br /&gt;148. Difference between .NET components and COM components&lt;br /&gt;149. What does assemblyinfo.cs consists&lt;br /&gt;150. Types of objects in ASP&lt;br /&gt;151. Difference between VB dll and assemblies in .NET&lt;br /&gt;152. What is machine.config and web.config&lt;br /&gt;153. Tell about WSDL&lt;br /&gt;154. About web methods and its various attributes&lt;br /&gt;155. What is manifest&lt;br /&gt;156. Types of caching&lt;br /&gt;157. What does connection string consists of&lt;br /&gt;158. Where do you store connection string&lt;br /&gt;159. What is the difference between session state and session variables&lt;br /&gt;160. How do you pass session values from one page to another&lt;br /&gt;161. What are WSDL ports&lt;br /&gt;162. What is dataset and tell about its features. What are equivalent methods of previous, next etc. Of ADO in ADO.NET&lt;br /&gt;163. What is abstract class&lt;br /&gt;164. What is difference between interface inheritance and class inheritance&lt;br /&gt;165. What are the collection classes&lt;br /&gt;166. Which namespace is used for encryption&lt;br /&gt;167. What are the various authentication mechanisms in ASP.NET&lt;br /&gt;168. What is the difference between authentication and autherization&lt;br /&gt;169. What are the types of threading models&lt;br /&gt;170. How do you send an XML document from client to server&lt;br /&gt;171. How do you create dlls in .NET&lt;br /&gt;172. What is inetermediate language in .NET&lt;br /&gt;173. Write steps of retrieving data using ado.net&lt;br /&gt;174. Call a stored procedure from ado.net and pass parameter to it&lt;br /&gt;175. Different type of validation controls in asp.net&lt;br /&gt;176. Difference between server.Execute and response.redirect What is Response.Flush method&lt;br /&gt;177. How Response.flush works in server.Execute&lt;br /&gt;178. What is the need of clinet side and server side validation&lt;br /&gt;179. Tell About Global.asax&lt;br /&gt;180. What is application variable and when it is initialized&lt;br /&gt;181. Tell About Web.config&lt;br /&gt;182. Can we write one page in c# and other in vb in one application&lt;br /&gt;183. When web.config is called&lt;br /&gt;184. How many web.config a application can have&lt;br /&gt;185. How do you set language in web.cofig&lt;br /&gt;186. Rate yourself in vb and com&lt;br /&gt;187. Whether I have any specific technology in mind to work on&lt;br /&gt;188. About types of indexes in SQL server&lt;br /&gt;189. Difference between writing SQL query and stored procedure&lt;br /&gt;190. About DTS usage&lt;br /&gt;191. How do you optimize Sql queries&lt;br /&gt;192. What is SOAP and why it is required&lt;br /&gt;193. Any disadvantages in Dataset and in reflection&lt;br /&gt;194. Difference between Active Exe and Activex dll&lt;br /&gt;195. Can we make activex dll also ti execute in some process as that of client ? How can we do?&lt;br /&gt;196. Types of compatabilities and explain them&lt;br /&gt;197. Types of instancing properties and explain each. Tell the difference between multiuse,singleuse and globalmultiuse and which is default&lt;br /&gt;198. What is assembly?&lt;br /&gt;199. Difference between COM and .NET component&lt;br /&gt;200. What is early binding and Late binding. Difference which is better&lt;br /&gt;201. What happens when we instantiate a COM component&lt;br /&gt;202. What happens when we instantiate a .NET component&lt;br /&gt;203. Are you aware of containment and Aggregation&lt;br /&gt;204. What is UUID and GUID what is the size of this ID?&lt;br /&gt;205. About Iunknown interface Queue ,its methods Querry Interface Addref,Release and Explane each&lt;br /&gt;206. What ‘ll u do in early and late binding&lt;br /&gt;207. In early binding will the method invoked on com component will verify it’s existance in the system or not?&lt;br /&gt;208. Difference between dynamic query and static query&lt;br /&gt;209. About performance issues on retrieving records&lt;br /&gt;210. About ADO and its objects&lt;br /&gt;211. What is unmannaged code and will CLR handle this kind of code or not .&lt;br /&gt;212. Garbage collector’s functionality on unmanaged code&lt;br /&gt;213. If Instancing = Single use for ActiveX Exe, how will this be executed if there are 2 consecutive client requests ?&lt;br /&gt;214. Threading Types.&lt;br /&gt;215. How about the security in Activex DLL and Activex EXE &lt;br /&gt;216. Define .NET architecture&lt;br /&gt;217. Where does ADO.NET and XML web services come in the architecture&lt;br /&gt;218. What is MSIL code&lt;br /&gt;219. Types of JIT and what is econo-JIT&lt;br /&gt;220. What is CTS, CLS and CLR&lt;br /&gt;221. Uses of CLR&lt;br /&gt;222. Difference between ASP and ASP.NET&lt;br /&gt;223. What are webservices, its attributes. Where they are available&lt;br /&gt;224. What is UDDI and how to register a web service&lt;br /&gt;225. Without UDDI, is it possible to access a remote web service&lt;br /&gt;226. How a web service is exposed to outside world&lt;br /&gt;227. What is boxing and unboxing&lt;br /&gt;228. What is WSDL and disco file&lt;br /&gt;229. What is web.config and machine.config&lt;br /&gt;230. What is difference between ASP and ASP.NET&lt;br /&gt;231. What is dataset and uses of dataset&lt;br /&gt;232. What does ADO.NET consists of?&lt;br /&gt;233.What are various authentication mechanisms in ASP.NET&lt;br /&gt;234. What do you mean by passport authentication and windows authentication&lt;br /&gt;235. What is an assembly and what does manifest consists&lt;br /&gt;236. What is strong name and what is the purpose of strong name&lt;br /&gt;237. What are various types of assemblies&lt;br /&gt;238. Difference between VB.NET and C#. Which is faster&lt;br /&gt;239. Types of caching&lt;br /&gt;240. How WSDL is stored&lt;br /&gt;241. What is the key feature of ADO.NET compared to ADO&lt;br /&gt;242. How does dataset acts in a disconnected fashion&lt;br /&gt;243. Does the following statement executes successfully:&lt;br /&gt;Response.Write(value of i =  + i);&lt;br /&gt;244. What is ODP.NET&lt;br /&gt;245. What are the providers available with VS.NET&lt;br /&gt;246. What is a process&lt;br /&gt;247. What is binding in web service&lt;br /&gt;248. How a proxy is generated for a web service&lt;br /&gt;249. About delegates&lt;br /&gt;250. What are static assemblies and dynamic assemlies. Differences between them &lt;br /&gt;251. Rate yourself in .NET and SQL&lt;br /&gt;252. About 5 processes&lt;br /&gt;253. About current project and your role&lt;br /&gt;254. What is caching and types of caching&lt;br /&gt;255. What does VS.NET contains&lt;br /&gt;256. What is JIT, what are types of JITS and their pupose&lt;br /&gt;257. What is SOAP, UDDI and WSDL&lt;br /&gt;258. What is dataset&lt;br /&gt;259. Types of threading models in VB.net&lt;br /&gt;260. Types of compatability in VB and their usage&lt;br /&gt;261. Difference between CDATA and PCDATA in XML&lt;br /&gt;262. What is Assync in XML api which version of XML parser u worked with&lt;br /&gt;263. Types of ASP objects&lt;br /&gt;264. Difference between application and session&lt;br /&gt;265. What is web application virtual directory&lt;br /&gt;266. Can two web application share a session and application variable&lt;br /&gt;267. If i have a page where i create an instance of a dll and without invoking any method can I send values to next page&lt;br /&gt;268. Diffeernce between Active Exe and /Dll&lt;br /&gt;269. Can the dictionary object be created in client’s ccope?&lt;br /&gt;270. About MTS and it’s purpose&lt;br /&gt;271. About writting a query and SP which is better&lt;br /&gt;272. I have a component with 3 parameter and deployed to client side now i changed my dll method which takes 4 parameter.How can i deploy this without affecting the&lt;br /&gt;     clent’s code&lt;br /&gt;273. How do you do multithreading application in VB&lt;br /&gt;274. About Global .asax&lt;br /&gt;275. Connection pooling in MTS&lt;br /&gt;276. If cookies is disabled in clinet browser will session work&lt;br /&gt;277. About XLST&lt;br /&gt;278. How do you attach an XSL to an XML in presenting output&lt;br /&gt;279. What is XML&lt;br /&gt;280. How do you make your site SSL enabled&lt;br /&gt;281. Did you work on IIS adminisdtration&lt;br /&gt;282. About response.buffer and repsonse.flush&lt;br /&gt;283. About dataset and data mining&lt;br /&gt;284. About SOAP&lt;br /&gt;285. Usage of htmlencode and urlencode&lt;br /&gt;286. Usage of server variables&lt;br /&gt;287. How to find the client browser type&lt;br /&gt;288. How do you trap errors in ASP and how do you invoke a component in ASP&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-600958006977094939?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/600958006977094939/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/dot-net-interview-questions.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/600958006977094939'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/600958006977094939'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/dot-net-interview-questions.html' title='Dot net interview Questions and Answers'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2609979953098431138</id><published>2010-09-01T23:28:00.000-07:00</published><updated>2010-11-01T23:29:02.656-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sting Manupulation'/><title type='text'>How to add comma in a int or decimal value</title><content type='html'>This code show how to add comma into int or decimal value.Suppose we have a value 33000&lt;br /&gt;            and want to display this 33,000.00.&lt;br /&gt;            &lt;br /&gt;            string FirstP = "";&lt;br /&gt;            string SecP = "";&lt;br /&gt;            string Finalstr = "";&lt;br /&gt;            int MyValue = Convert.ToInt32(Projected);&lt;br /&gt;            string myStr = MyValue.ToString();&lt;br /&gt;            int Length = myStr.Length;&lt;br /&gt;            string dc = ".00";&lt;br /&gt;&lt;br /&gt;            do&lt;br /&gt;            {&lt;br /&gt;                FirstP = myStr.Substring(0, Length - 3);&lt;br /&gt;                SecP = myStr.Substring(Length - 3, 3);&lt;br /&gt;                Finalstr = "," + SecP + Finalstr;&lt;br /&gt;                myStr = FirstP;&lt;br /&gt;                Length = myStr.Length;&lt;br /&gt;            }&lt;br /&gt;            while (Length &gt; 3);&lt;br /&gt;&lt;br /&gt;            if (myStr == "")&lt;br /&gt;            {&lt;br /&gt;                Finalstr = Finalstr.Substring(1, Finalstr.Length);&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                Finalstr = myStr + Finalstr + dc;&lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;            lblSalary.Text = Finalstr.ToString();&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2609979953098431138?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2609979953098431138/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/how-to-add-comma-in-int-or-decimal.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2609979953098431138'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2609979953098431138'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/how-to-add-comma-in-int-or-decimal.html' title='How to add comma in a int or decimal value'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3613914630063668673</id><published>2010-09-01T22:38:00.000-07:00</published><updated>2010-10-13T22:46:47.401-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Validation Controls'/><title type='text'>ASP.NET Validation Controls with example</title><content type='html'>Learning Technique for freshers : R3C2&lt;br /&gt;&lt;br /&gt;1.RequiredFieldValidation Control&lt;br /&gt;2.RangeValidator Control&lt;br /&gt;3.RegularExpressionValidator Control&lt;br /&gt;4.CompareValidator Control&lt;br /&gt;5.CustomValidator Control&lt;br /&gt;&lt;br /&gt;Properties of Validation Controls.&lt;br /&gt;&lt;br /&gt;ControlToValidate - Id of control Which you want to validate.&lt;br /&gt;ErrorMessage - Message that will be displayed in the validation summary.&lt;br /&gt;IsValid - Whether or not the control is valid.&lt;br /&gt;Validate - Method to validate the input control and update the IsValid property.&lt;br /&gt;Display - How the error message will display.options are given below&lt;br /&gt;     None:Message is never displayed.&lt;br /&gt;     Static:Validation message will display in the page layout.&lt;br /&gt;     Dynamic:Validation message is dynamically added to the page if validation fails.&lt;br /&gt;&lt;br /&gt;Example with code:&lt;br /&gt;&lt;br /&gt;1.RequiredFieldValidation:It is simple validation control which checks data is entered or not.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:textbox id="txtEmpName" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;asp:RequiredFieldValidator id="rfvtxtbox" runat="server" ControlToValidate="txtEmpName"&lt;br /&gt;    ErrorMessage="* Please enter the employee name" Display="dynamic"&amp;gt;*&lt;br /&gt;&amp;lt;/asp:RequiredFieldValidator&amp;gt;&lt;br /&gt;&lt;br /&gt;2.RangeValidator:It checks to see if a control value is within a valid range or not.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:textbox id="txtDOB" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;asp:RangeValidator id="rangeVal" runat="server"&lt;br /&gt;    ControlToValidate="txtDOB1"&lt;br /&gt;    MaximumValue="12/06/2009"&lt;br /&gt;    MinimumValue="01/01/1983"&lt;br /&gt;    Type="Date"&lt;br /&gt;    ErrorMessage="* Please enter the valid date" Display="static"&amp;gt;*&amp;lt;/asp:RangeValidator&amp;gt;&lt;br /&gt;&lt;br /&gt;3.RegularExpressionValidator:It can be used for email validation or any specified string based on pattern matching.&lt;br /&gt;&lt;br /&gt;E-mail: &amp;lt;asp:textbox id="txtEmail" runat="server"/&amp;gt;&lt;br /&gt;&amp;lt;asp:RegularExpressionValidator id="revemail" runat="server"&lt;br /&gt;    ControlToValidate="txtEmail"&lt;br /&gt;    ValidationExpression=".*@.*\..*"&lt;br /&gt;    ErrorMessage="* Please enter valid e-mail ."&lt;br /&gt;    display="dynamic"&amp;gt;*&lt;br /&gt;&amp;lt;/asp:RegularExpressionValidator&amp;gt;&lt;br /&gt;&lt;br /&gt;4.CompareValidator: It allows you to make comparisons between two form controls and also compare values contained with&lt;br /&gt; these controls to constants that specified by userd.&lt;br /&gt;&lt;br /&gt;New Password: &amp;lt;asp:textbox id="txtNewPass" runat="server"/&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;Confirm Passowrd: &amp;lt;asp:textbox id="txtConfirmPass" runat="server"/&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;asp:CompareValidator id="valCompare" runat="server"&lt;br /&gt;    ControlToValidate="txtNewPass" ControlToCompare="txtConfirmPass"&lt;br /&gt;    Operator="Equals"&lt;br /&gt;    ErrorMessage="* New Password and confirm password are not same"&lt;br /&gt;    Display="dynamic"&amp;gt;*&lt;br /&gt;&amp;lt;/asp:CompareValidator&amp;gt;&lt;br /&gt;&lt;br /&gt;5.CustomValidator:It allows you to write your own server-side or client-side validations logic and it can be easily applied to your web forms controls.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:CustomValidator ID="cv" runat="server" &lt;br /&gt;        ControlToValidate="txtName" ClientValidationFunction="customvalidationr" &lt;br /&gt;        ErrorMessage="Please enter correct name"&amp;gt;&amp;lt;/asp:CustomValidator&amp;gt;&lt;br /&gt;        &amp;lt;asp:TextBox ID="txtName" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;        &amp;lt;asp:Button ID="btnSubmit" runat="server" /&amp;gt;&lt;br /&gt; &lt;br /&gt;Client side javascript&lt;br /&gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;function customvalidation(oSrc,args)&lt;br /&gt;{ &lt;br /&gt;&lt;br /&gt;write your code here&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3613914630063668673?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3613914630063668673/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/aspnet-validation-controls-with-example.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3613914630063668673'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3613914630063668673'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/aspnet-validation-controls-with-example.html' title='ASP.NET Validation Controls with example'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1966680599236130224</id><published>2010-09-01T22:15:00.000-07:00</published><updated>2010-09-03T09:05:44.862-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Free software Download link'/><title type='text'>Free Download Software</title><content type='html'>Adobe acrobat reader (http://okular.kde.org/download.phd) &lt;br /&gt;Adobe pagemaker  Scribus(http://www.scribus.net/) &lt;br /&gt;Adobe photoshop CinePaint (http://www.cinepaint.org/) &lt;br /&gt;Dream Weaver KompoZer (http://www.kompozer.org) &lt;br /&gt;Fhontografer FontForge (http://fontforge.sourceforge.net/)&lt;br /&gt;Microsoft FrontPage Quanta Plus (http://quanta.kdewebdev.org/) &lt;br /&gt;Microsoft Office OpenOffice (http://openoffice.org/) &lt;br /&gt;Microsoft outlook Express Thunderbird (http://www.mozillamessaging.com/enUS/thunderbird/) &lt;br /&gt;Microsoft Project kplato (http://koffice.org/kplato/) &lt;br /&gt;MSN Messenger  Pidgin (http://pidgin.im) &lt;br /&gt;Nero Burning Rom X-CD-Roast (http://www.xcdroast.org/) &lt;br /&gt;Winamp auidence (http://audacious-media-player.org/Main_Page) &lt;br /&gt;Window Media player KPlayer (http://kplayer.sourceforge.net/) &lt;br /&gt;VLC Player (http://www.videolan.org/vlc/) &lt;br /&gt;Winzip (http://www.7-zip.org)&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1966680599236130224?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1966680599236130224/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/free-download-software.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1966680599236130224'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1966680599236130224'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/free-download-software.html' title='Free Download Software'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6699415664415956798</id><published>2010-09-01T09:10:00.000-07:00</published><updated>2010-09-24T03:17:13.587-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview'/><title type='text'>General HR questions</title><content type='html'>1. Tell about yourself and job&lt;br /&gt;2. Tell about current project&lt;br /&gt;3. What are sequence diagrams, collaboration diagrams and difference between them&lt;br /&gt;4. What is your role in the current project and what kinds of responsibilites you are handling&lt;br /&gt;5. What is the team size and how do you ensure quality of code&lt;br /&gt;6. What is the S/W model used in the project. What are the optimization techniques used. Give examples.&lt;br /&gt;7. What are the SDLC phases you have invloved&lt;br /&gt;8. About educational background&lt;br /&gt;9. About work experience&lt;br /&gt;10. About area of work&lt;br /&gt;11. Current salary, why are looking for a change and about notice period About company strength, verticals, clients, domains etc.&lt;br /&gt;12. Rate yourself in different areas of .NET and SQL &lt;br /&gt;13. About procsses followed&lt;br /&gt;14. Notice period&lt;br /&gt;15. Appraisal process&lt;br /&gt;16. About effort estimation&lt;br /&gt;17. Whether salary negotiable&lt;br /&gt;18. Why are looking for a change&lt;br /&gt;19. How fo you appraise a person&lt;br /&gt;20. Do you think CMM process takes time&lt;br /&gt;21. About peer reviews&lt;br /&gt;22. About educational background, work experience, and area of work &lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6699415664415956798?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6699415664415956798/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/general-hr-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6699415664415956798'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6699415664415956798'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/general-hr-questions.html' title='General HR questions'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5110505793815813010</id><published>2010-09-01T09:08:00.000-07:00</published><updated>2010-09-24T03:16:48.631-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview'/><title type='text'>Project related questions</title><content type='html'>1.Tell about your current project&lt;br /&gt;2. Tell about your role&lt;br /&gt;3. What is the toughest situation you faced in the development&lt;br /&gt;4. How often you communicate with the client&lt;br /&gt;5. For what purposes, you communicate with the client&lt;br /&gt;6. What is the process followed&lt;br /&gt;7. Explain complete process followed for the development&lt;br /&gt;8. What is the life cycle model used for the development&lt;br /&gt;9. How do communicate with team members&lt;br /&gt;10. How do you say you are having excellent team management skills&lt;br /&gt;11. If your client gives a change and asks for early delivery. How will you manage.&lt;br /&gt;12.How will gather requirements and where do you record. Is it in word / Excel or do you have any tool for that&lt;br /&gt;13. What is the stage when code is delivered to the client and he is testing it.&lt;br /&gt;14. What are the different phases of SDLC&lt;br /&gt;15. How do you handle change requests&lt;br /&gt;16. How do you perform impact analysis&lt;br /&gt;17. How do you write unit test cases.&lt;br /&gt;18. About current project architecture&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5110505793815813010?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5110505793815813010/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/project-related-questions.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5110505793815813010'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5110505793815813010'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/project-related-questions.html' title='Project related questions'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7895220367082337394</id><published>2010-09-01T05:25:00.000-07:00</published><updated>2010-09-08T01:40:13.279-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Errors and Solutions'/><title type='text'>Errors and solution</title><content type='html'>Errors and their solutions:&lt;br /&gt;&lt;br /&gt;1.The IListSource does not contain any data sources:&lt;br /&gt;  Sol:parameter mismatch does not match from stored procedure which you passing from .net  &lt;br /&gt;  &lt;br /&gt;2.Procedure or Function 'genInstituteMaster_SelectDelete' expects parameter '@Select', which was not supplied.&lt;br /&gt;  Sol: Parameter mismatch check in c# code passing parameter.&lt;br /&gt;   &lt;br /&gt;3.No overload for method 'GetInstitute' takes '3' arguments&lt;br /&gt;  Sol:  check your calling mathod parameter not match.&lt;br /&gt;&lt;br /&gt;4.Parameter count does not match Parameter Value count. &lt;br /&gt;  Sol:  Check parameter both .net and sp&lt;br /&gt;&lt;br /&gt;5.A field or property with the name 'CountryName' was not found on the selected data source. &lt;br /&gt;  Sol: In grid you have field but in not table&lt;br /&gt;&lt;br /&gt;4.EXECUTE permission denied on object 'usp_login', database 'Database', schema 'dbo'&lt;br /&gt;  Please check your database user roles.&lt;br /&gt;  It's necessary the database user to be owner.&lt;br /&gt;  What you should instead do, is grant the user the following Roles:&lt;br /&gt;    &lt;br /&gt;    - aspnet_Membership_FullAccess&lt;br /&gt;    - aspnet_Roles_FullAccess&lt;br /&gt;    - etc. depending on what features you have enabled/installed into this database&lt;br /&gt;&lt;br /&gt; Do this by using Microsoft SQL Server Management Studio or Microsoft SQL Server Management Studio Express&lt;br /&gt;&lt;br /&gt;   1. Connect to the database you are working with&lt;br /&gt;   2. Open Databases&lt;br /&gt;   3. Open the database you are working with&lt;br /&gt;   4. Open Security&lt;br /&gt;   5. Open Users&lt;br /&gt;   6. Double-click the user who is accessing the database&lt;br /&gt;   7. In the list of Owned Schemas, check off the roles indicated above&lt;br /&gt;&lt;br /&gt;5.A network-related or instance-specific error occurred while establishing a connection to SQL Server&lt;br /&gt;  Things to check:&lt;br /&gt; 1. Make sure your database engine is configured to accept remote connections&lt;br /&gt;  Start &gt; All Programs &gt; SQL Server 2005 &gt; Configuration Tools &gt; SQL Server Surface Area Configuration&lt;br /&gt;  Click on Surface Area Configuration for Services and Connections&lt;br /&gt;  Select the instance that is having a problem &gt; Database Engine &gt; Remote Connections&lt;br /&gt;  Enable local and remote connections&lt;br /&gt;  Restart instance&lt;br /&gt;&lt;br /&gt; 2. Check the SQL Server service account&lt;br /&gt;    If you are not using a domain account as a service account (for example if you are using NETWORK SERVICE), you may want to switch this&lt;br /&gt;    first before proceeding&lt;br /&gt; 3. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings in your ASweb P.NET application&lt;br /&gt;  Usually the format needed to specify the database server is machinename\instancename&lt;br /&gt;  Check your connection string as well&lt;br /&gt; &lt;connectionStrings&gt;&lt;br /&gt; &lt;add name=SampleConnectionString; connectionString=Data Source=machinename\instancename;Initial Catalog=AdventureWorks;&lt;br /&gt;  Integrated Security=SSPI;Min Pool Size=5;Max Pool Size=60;Connect Timeout=30? providerName=System.Data.SqlClient/&gt;&lt;br /&gt; &lt;/connectionStrings&gt;&lt;br /&gt; 4.You may need to create an exception on the firewall for the SQL Server instance and port you are using&lt;br /&gt;  Start &gt; Run &gt; Firewall.cpl&lt;br /&gt;  Click on exceptions tab&lt;br /&gt;  Add the sqlservr.exe (typically located in C:\Program Files (x86)\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433)&lt;br /&gt;  Check your connection string as well&lt;br /&gt; 5. If you are using a named SQL Server instance, make sure you are using that instance name in your connection strings&lt;br /&gt; 6. Check SQLBrowser; check that it is running. You may also need to create an exception in your firewall for SQLBrowser.&lt;br /&gt; 7. Check that you have connectivity to the SQL Server. Note what you are using to connect: machine name, domain name or IP address? Use &lt;br /&gt;    this when checking connectivity. For example if you are using myserver&lt;br /&gt;      Start &gt; Run &gt; cmd&lt;br /&gt;      netstat -ano| findstr 1433&lt;br /&gt;      telnet myserver 1433&lt;br /&gt;      ping -a myserver&lt;br /&gt;&lt;br /&gt; 8.CS1061: 'System.Web.UI.WebControls.TextBox' does not contain a definition for 'Value' and no extension method 'Value' accepting a first argument&lt;br /&gt;    of type 'System.Web.UI.WebControls.TextBox' could be found (are you missing a using directive or an assembly reference?)&lt;br /&gt;    Sol:You have take a textbox control in page but assign textbox.value in cs code. Use Textbox.Text&lt;br /&gt; 9.DataBinding: 'System.Data.DataRowView' does not contain a property with the name 'Company'. &lt;br /&gt;Sol: Check the GridView columns and select query which you are using for bind GridView.Columns should be same in both place&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7895220367082337394?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7895220367082337394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/errors-and-solution.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7895220367082337394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7895220367082337394'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/errors-and-solution.html' title='Errors and solution'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6935883376768584475</id><published>2010-09-01T05:09:00.001-07:00</published><updated>2011-04-03T09:04:49.309-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>How to handle OnActiveTabChanged event of AJAX Tab control</title><content type='html'>This Articles explian how to handle ActiveTabChanged Event of AJAX TabControl in asp.net.&lt;br /&gt;&lt;br /&gt;&lt;ajaxToolkit:TabContainer ID="tbcRatingMaster" runat="server" CssClass="ajax__tab_yuitabview-theme"&lt;br /&gt;   ActiveTabIndex="0" BorderStyle="None" Width="742px" BorderWidth="0" OnActiveTabChanged="tbcRatingMaster_ActiveTabChanged"&lt;br /&gt;   AutoPostBack="True"&gt;&lt;br /&gt;&lt;/ajaxToolkit:TabContainer&gt;&lt;br /&gt;&lt;br /&gt;protected void tbcRatingMaster_ActiveTabChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt; if (tbcRatingMaster.ActiveTabIndex == 0)&lt;br /&gt; {&lt;br /&gt;     //AddGrpBind();&lt;br /&gt;     btnSaveRG.Text = "Save";&lt;br /&gt;     txtGroup.Text = "";&lt;br /&gt;     txtGroup.Text = "";&lt;br /&gt; }&lt;br /&gt; if (tbcRatingMaster.ActiveTabIndex == 1)&lt;br /&gt; {&lt;br /&gt;     txtItem.Text = "";&lt;br /&gt; }&lt;br /&gt; if (tbcRatingMaster.ActiveTabIndex == 2)&lt;br /&gt; {            &lt;br /&gt;     rbtnType.SelectedValue = "P";&lt;br /&gt;     gvRating.Visible = false;&lt;br /&gt;     txtItem.Text = "";&lt;br /&gt;     txtGroup.Text = "";&lt;br /&gt; }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6935883376768584475?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6935883376768584475/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/how-to-handle-onactivetabchanged-event.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6935883376768584475'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6935883376768584475'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/how-to-handle-onactivetabchanged-event.html' title='How to handle OnActiveTabChanged event of AJAX Tab control'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4602326980194315534</id><published>2010-09-01T03:01:00.000-07:00</published><updated>2010-10-15T03:04:47.732-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Page Life Cycle of an ASP.NET'/><title type='text'>Page Life Cycle of an ASP.NET</title><content type='html'>The life cycle starts when a user requests a web page through his/her browser. The Web server than process the page through a sequence of steps before response is sent back to the user's browser. The steps are as:&lt;br /&gt;&lt;br /&gt;   1. Page Request&lt;br /&gt;   2. Start&lt;br /&gt;   3. Page Initialization&lt;br /&gt;   4. Load&lt;br /&gt;   5. Validation&lt;br /&gt;   6. PostBack Event Handling&lt;br /&gt;   7. Render&lt;br /&gt;   8. Unload&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Page Request&lt;/span&gt;&lt;br /&gt;The page request occurs before the page life cycle begins. When a user requests the page, ASP.NET determines whether the page needs to be parsed and compiled (therefore beginning the life of a page), or whether a cached version of the page can be sent in response without running the page.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Start&lt;/span&gt;&lt;br /&gt;In the start step, page properties such as Request and Response are set. At this stage, the page also determines whether the request is a postback or a new request and sets the IsPostBack property. Additionally, during the start step, the page's UICulture property is set.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Page Initialization&lt;/span&gt;&lt;br /&gt;During page initialization, controls on the page are available and each control's UniqueID are generated but not their properties. Any themes are also applied to the page.&lt;br /&gt;&lt;br /&gt;Developers have access to the Init, InitComplete and PreLoad methods in this stage. The methods are as follows:&lt;br /&gt;&lt;br /&gt;    * Init: This event is raised after all controls have been initialized and any skin settings have been applied. This event is used to read or initialize control properties.&lt;br /&gt;    * InitComplete: The Page object raises this event. This event is used for processing tasks that require completion of all initialization.&lt;br /&gt;    * PreLoad: Use this event if you need to perform processing on your page or control before the Load event. After the Page raises this event, it loads view state for itself and all controls, and then processes any postback data included with the Request instance.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Load&lt;/span&gt;&lt;br /&gt;During load, if the current request is a postback, control properties are loaded with information recovered from view state and control state. The OnLoad event method is fired during this stage.&lt;br /&gt;This is where you will want to set properties for all of the server controls on your page, request query strings, and establish database connections.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Validation&lt;/span&gt;&lt;br /&gt;During validation, the Validate method of all validator controls is called, which sets the IsValid property of individual validator controls and of the page.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;PostBack Event Handling&lt;/span&gt;&lt;br /&gt;If the request is a postback, any event handlers are called. The event handling for server controls occurs during this stage.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Render&lt;/span&gt;&lt;br /&gt;During rendering, view state is saved to the page and then the page calls on each control to contribute its rendered output to the OutputStream of the page's Response property. Render is not really an event. The HTML of the page and all controls are sent to the browser for rendering.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Unload&lt;/span&gt;&lt;br /&gt;Unload is called when the page has been fully rendered, sent to the client, and is ready to be discarded. At this point, page properties such as Response and Request are unloaded and any cleanup is performed. The cleanup includes routines such as closing database connections and file streams, or, event logging and other tasks.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;When a Web page is requested, the server creates objects associated with the page and all of its child controls objects and uses these to render the page to the browser. Once the final stage is complete, the web server destroys these objects, to free up resource to handle additional request.&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4602326980194315534?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4602326980194315534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/page-life-cycle-of-aspnet.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4602326980194315534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4602326980194315534'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/10/page-life-cycle-of-aspnet.html' title='Page Life Cycle of an ASP.NET'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1306720210805424835</id><published>2010-09-01T01:19:00.000-07:00</published><updated>2011-12-22T03:14:47.631-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Insert record in database using stored procedure in asp.net</title><content type='html'>In this article am explaining very simpe thing insert record in database using stored procedure,that will very help full for entry level programmer. &lt;br /&gt;&lt;br /&gt;web.config&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;connectionStrings&amp;gt;  &lt;br /&gt;      &amp;lt;add name="conString" connectionString="Data Source=.\SQLEXPRESS; database=Northwind;Integrated Security=true"/&amp;gt;:  &lt;br /&gt; &amp;lt;/connectionStrings&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Used Stored procedure&lt;br /&gt;CREATE PROCEDURE [dbo].[AddUser]&lt;br /&gt;(&lt;br /&gt; @FName varchar(50),&lt;br /&gt; @LName varchar(50),&lt;br /&gt; @DateOfBirth datetime,&lt;br /&gt; @City varchar(50),&lt;br /&gt; @State varchar(50)&lt;br /&gt;)&lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;&lt;br /&gt;SET NOCOUNT ON;&lt;br /&gt; INSERT INTO UserDetails (FName, LName, DateOfBirth, City, State)&lt;br /&gt; VALUES (@FName, @LName, @DateOfBirth, @City, @State)&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;C# code&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; String ConnString = ConfigurationManager.ConnectionStrings["conString"].ConnectionString;  &lt;br /&gt; SqlConnection con = new SqlConnection(ConnString);  &lt;br /&gt; SqlCommand cmd = new SqlCommand();  &lt;br /&gt; cmd.CommandType = CommandType.StoredProcedure;  &lt;br /&gt; cmd.CommandText = "AddUser";  &lt;br /&gt; cmd.Parameters.Add("@FName",SqlDbType.VarChar).Value = txtFName.Text.Trim();  &lt;br /&gt; cmd.Parameters.Add("@LName", SqlDbType.VarChar).Value = txtLName.Text.Trim();  &lt;br /&gt; cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value = txtDOB.Text.Trim();  &lt;br /&gt; cmd.Parameters.Add("@City", SqlDbType.VarChar).Value = txtCity.Text.Trim();  &lt;br /&gt; cmd.Parameters.Add("@State", SqlDbType.VarChar).Value = txtState.Text.Trim();  &lt;br /&gt; cmd.Connection = con;  &lt;br /&gt; try  &lt;br /&gt; {  &lt;br /&gt;      con.Open();  &lt;br /&gt;      cmd.ExecuteNonQuery();  &lt;br /&gt;      lblMessage.Text = "Record inserted successfully";  &lt;br /&gt; }  &lt;br /&gt; catch (Exception ex)  &lt;br /&gt; {  &lt;br /&gt;      throw ex;  &lt;br /&gt; }  &lt;br /&gt; finally  &lt;br /&gt; {  &lt;br /&gt;      con.Close();  &lt;br /&gt;      con.Dispose();  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1306720210805424835?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1306720210805424835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/insert-record-in-database-using-stored.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1306720210805424835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1306720210805424835'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/09/insert-record-in-database-using-stored.html' title='Insert record in database using stored procedure in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6565024610828049180</id><published>2010-08-31T05:38:00.001-07:00</published><updated>2010-09-03T09:10:30.552-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Deployment'/><title type='text'>Website Deployment</title><content type='html'>Internet Information Services is used to make your computer a web server. If we want to have a web server for developing dynamic website or want to publish &lt;br /&gt;website on our own server then we install the IIS.Internet Information Server (IIS) is a World Wide Web server, a Gopher server and an FTP server all rolled&lt;br /&gt;into one. IIS means that you can publish WWW pages.&lt;br /&gt;If you want to your web application accessible to any other pc in intranet or internet you need to IIS.&lt;br /&gt;&lt;br /&gt;Below are steps for deployment:&lt;br /&gt;1.Right click your website and click on Publish website.All compiles files are ready for deployment.&lt;br /&gt;2.Create a backup for database whichever you are using and restore it on production server.&lt;br /&gt;3.Go to server using ftp or filezila copy all compiles file on server.&lt;br /&gt;4.Open Webconfig and change the connection string according to your Database name and server.&lt;br /&gt;5.Create a virtual directory for this website.&lt;br /&gt;6.Your website is ready.&lt;br /&gt;7.Test website http://192.163.0.234(ServerName)/VDName/Login.aspx&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6565024610828049180?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6565024610828049180/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/website-deployment.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6565024610828049180'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6565024610828049180'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/website-deployment.html' title='Website Deployment'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5977009564034315527</id><published>2010-08-31T02:30:00.000-07:00</published><updated>2010-08-31T02:31:31.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Interview'/><title type='text'>Difference Between .net framework 2.0,3.0 and 3.5</title><content type='html'>NET framework 2.0:&lt;br /&gt;&lt;br /&gt;It brings a lot of evolution in class of the framework and refactor control including the support of&lt;br /&gt;&lt;br /&gt;Generics&lt;br /&gt;Anonymous methods&lt;br /&gt;Partial class&lt;br /&gt;Nullable type&lt;br /&gt;The new API gives a fine grain control on the behavior of the runtime with regards to multithreading, memory allocation, assembly loading and more&lt;br /&gt;Full 64-bit support for both the x64 and the IA64 hardware platforms&lt;br /&gt;New personalization features for ASP.NET, such as support for themes, skins and webparts.&lt;br /&gt;.NET Micro Framework&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.NET framework 3.0:&lt;br /&gt;&lt;br /&gt;Also called WinFX,includes a new set of managed code APIs that are an integral part of Windows Vista and Windows Server 2008 operating systems and provides&lt;br /&gt;&lt;br /&gt;Windows Communication Foundation (WCF), formerly called Indigo; a service-oriented messaging system which allows programs to interoperate locally or remotely similar to web services.&lt;br /&gt;Windows Presentation Foundation (WPF), formerly called Avalon; a new user interface subsystem and API based on XML and vector graphics, which uses 3D computer graphics hardware and Direct3D technologies.&lt;br /&gt;Windows Workflow Foundation (WF) allows for building of task automation and integrated transactions using workflows.&lt;br /&gt;Windows CardSpace, formerly called InfoCard; a software component which securely stores a person's digital identities and provides a unified interface for choosing the identity for a particular transaction, such as logging in to a website&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;.NET framework 3.5:&lt;br /&gt;&lt;br /&gt;It implement Linq evolution in language. So we have the folowing evolution in class:&lt;br /&gt;&lt;br /&gt;Linq for SQL, XML, Dataset, Object&lt;br /&gt;Addin system&lt;br /&gt;p2p base class&lt;br /&gt;Active directory&lt;br /&gt;ASP.NET Ajax&lt;br /&gt;Anonymous types with static type inference&lt;br /&gt;Paging support for ADO.NET&lt;br /&gt;ADO.NET synchronization API to synchronize local caches and server side datastores&lt;br /&gt;Asynchronous network I/O API&lt;br /&gt;Support for HTTP pipelining and syndication feeds.&lt;br /&gt;New System.CodeDom namespace.&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5977009564034315527?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5977009564034315527/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/difference-between-net-framework-2030.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5977009564034315527'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5977009564034315527'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/difference-between-net-framework-2030.html' title='Difference Between .net framework 2.0,3.0 and 3.5'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6891372638991657095</id><published>2010-08-29T04:47:00.000-07:00</published><updated>2010-10-17T07:35:50.497-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Sting Manupulation'/><title type='text'>String Manupulation</title><content type='html'>i have a string like "a,b,c. upto n values".. &lt;br /&gt; Show this string like&lt;br /&gt; a,&lt;br /&gt; b,&lt;br /&gt; C&lt;br /&gt;&lt;br /&gt;Sol&lt;br /&gt;string str = "a,b,c";&lt;br /&gt;string[] arr = str.Split(',');&lt;br /&gt;foreach (string s in arr)&lt;br /&gt;{&lt;br /&gt;Response.Write(s + ",&lt;br /&gt;");&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6891372638991657095?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6891372638991657095/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/string-manupulation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6891372638991657095'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6891372638991657095'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/string-manupulation.html' title='String Manupulation'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5413917091857739960</id><published>2010-08-28T05:09:00.000-07:00</published><updated>2011-04-02T08:30:00.934-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>GridView Edit:on clicking edit a new page should be open where user can update data</title><content type='html'>On clicking edit in GridView a new page should be open where user can update data. In this article i am explaining how to update record using GridView.When User Click edit button in GridView  new page will be open where user can update record.in second page i have just find the data not wrriten the code for update.&lt;br /&gt;Here also i have written code for delete record in GridView and if GridView has no record show message no record found.&lt;br /&gt;   &lt;br /&gt;     public void GridViewBind()&lt;br /&gt; {&lt;br /&gt;     using (SqlConnection conn = new SqlConnection(conStr))&lt;br /&gt;     {&lt;br /&gt;  DataSet ds = SqlHelper.ExecuteDataset(conn, "LeaveMaster_Select");&lt;br /&gt;  GridView1.DataSource = ds.Tables[0];&lt;br /&gt;  GridView1.DataBind();&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt; protected void ImgDelete_Click(object sender, ImageClickEventArgs e)&lt;br /&gt; {&lt;br /&gt;     ImageButton img = (ImageButton)sender;&lt;br /&gt;     Label Leave = img.FindControl("Label1") as Label;&lt;br /&gt;     using (SqlConnection conn = new SqlConnection(conStr))&lt;br /&gt;     {&lt;br /&gt;  conn.Open();&lt;br /&gt;  using (SqlTransaction t = conn.BeginTransaction())&lt;br /&gt;  {&lt;br /&gt;      try&lt;br /&gt;      {&lt;br /&gt;   exceptionMessage.Text = SqlHelper.ExecuteScalar(t, "LeaveMaster_Delete", Leave.Text, "", 'D').ToString();&lt;br /&gt;   t.Commit();   &lt;br /&gt;   GridViewBind();&lt;br /&gt;      }&lt;br /&gt;      catch&lt;br /&gt;      {&lt;br /&gt;   t.Rollback();&lt;br /&gt;      }&lt;br /&gt;  }&lt;br /&gt;  conn.Close();&lt;br /&gt;     }&lt;br /&gt; } &lt;br /&gt; protected void ImgbtnDetails_Click(object sender, ImageClickEventArgs e)&lt;br /&gt; {&lt;br /&gt;     //Selecting a Record from Grid For Updation..&lt;br /&gt;     ImageButton aspSender = sender as ImageButton;&lt;br /&gt;     Label lblId = aspSender.FindControl("lblLeaveID") as Label;&lt;br /&gt;     Response.Redirect("~/LeaveDetails.aspx?Id=" + lblId.Text + "");        &lt;br /&gt; }&lt;br /&gt;    &lt;br /&gt;    ===========&lt;br /&gt;    2nd page&lt;br /&gt;    &lt;br /&gt;    if (Request.QueryString["Id"] != null)&lt;br /&gt;            {&lt;br /&gt;    &lt;br /&gt;                Id = Convert.ToInt32(Request.QueryString["Id"].ToString());&lt;br /&gt;                string str = "SELECT  LeaveCode, LeaveDesc, LeaveId FROM LeaveMaster WHERE  (LeaveId = "+Id+")";&lt;br /&gt;                DataTable dt1 = SqlHelper.ExecuteDataset(conStr, CommandType.Text, str).Tables[0];&lt;br /&gt;                txtCode.Text = dt1.Rows[0]["LeaveCode"].ToString();&lt;br /&gt;                txtCode.Enabled = false;&lt;br /&gt;                txtShortName.Text = dt1.Rows[0]["LeaveDesc"].ToString();&lt;br /&gt;                txtShortName.Enabled = false;               &lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;aspx Page&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:GridView ID="GridView1" &lt;br /&gt;    runat="server" &lt;br /&gt;    AutoGenerateColumns="False" &lt;br /&gt;    DataKeyNames="LeaveId"                                        &lt;br /&gt;    OnSelectedIndexChanged="GridView1_SelectedIndexChanged"                                         &lt;br /&gt;    Width="700px" &lt;br /&gt;    PageSize="10" AllowPaging="True" OnPageIndexChanging="GridView1_PageIndexChanging" &amp;gt;&lt;br /&gt; &amp;lt;Columns&amp;gt;&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="LeaveId" InsertVisible="False" SortExpression="LeaveId"&lt;br /&gt;  Visible="False"&amp;gt;&lt;br /&gt;  &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:Label ID="Label1" runat="server" Text='&amp;lt;%# Eval("LeaveId") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;  &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:Label ID="Label1" runat="server" Text='&amp;lt;%# Bind("LeaveId") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="LeaveCode" HeaderText="Leave Code" SortExpression="LeaveCode" /&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="LeaveShortDesc" HeaderText="Short Desc" SortExpression="LeaveShortDesc" /&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="LeaveLongDesc" HeaderText="Long Desc" SortExpression="LeaveLongDesc" /&amp;gt;&lt;br /&gt;     &amp;lt;asp:CommandField ButtonType="Image" HeaderText="Edit" SelectImageUrl="~/Image/img_edit.png"&lt;br /&gt;  ShowSelectButton="True"&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:CommandField&amp;gt;&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="Details"&amp;gt;&lt;br /&gt;  &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:TextBox ID="TextBox1" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;  &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" Width="40px" /&amp;gt;&lt;br /&gt;  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:ImageButton ID="ImgbtnDetails" runat="server" &lt;br /&gt;   OnClick="ImgbtnDetails_Click" /&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="Delete"&amp;gt;&lt;br /&gt;  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:ImageButton ID="imgbtnDelete" runat="server" &lt;br /&gt;   OnClick="ImgDelete_Click" OnClientClick="return ConfirmDelete();" /&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;/Columns&amp;gt;&lt;br /&gt; &amp;lt;EmptyDataTemplate&amp;gt;No record found !&amp;lt;/EmptyDataTemplate&amp;gt;&lt;br /&gt;    &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5413917091857739960?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5413917091857739960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-editon-clicking-edit-new-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5413917091857739960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5413917091857739960'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-editon-clicking-edit-new-page.html' title='GridView Edit:on clicking edit a new page should be open where user can update data'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6032878392089119068</id><published>2010-08-27T09:01:00.000-07:00</published><updated>2011-12-22T03:50:32.357-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Send mail using asp.net c# code</title><content type='html'>Send mail using asp.net c# code&lt;br /&gt;This code describe how to send mail where mail id is stored in database and mail sender detail From,To,are stored in web.config file.Mail body can be customized according to requirement as described in code.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; public void MailSend()  &lt;br /&gt; {  &lt;br /&gt;      try  &lt;br /&gt;      {  &lt;br /&gt;           string mailToAdd = String.Empty;  &lt;br /&gt;           MailMessage message1 = new MailMessage();  &lt;br /&gt;           string strMail;  &lt;br /&gt;           SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["SqlConnString"]);  &lt;br /&gt;           SqlDataReader dr;  &lt;br /&gt;           conn.Open();  &lt;br /&gt;           SqlCommand cmd = new SqlCommand("usp_MediaRegistration", conn);  &lt;br /&gt;           dr = cmd.ExecuteReader();  &lt;br /&gt;           while (dr.Read())  &lt;br /&gt;           {  &lt;br /&gt;                strMail = (string)dr["emailID"];  &lt;br /&gt;                message1.IsBodyHtml = true;   &lt;br /&gt;                string MailFrom = ConfigurationManager.AppSettings["from"].ToString();  &lt;br /&gt;                message1.From = new MailAddress(MailFrom);  &lt;br /&gt;                message1.To.Add(new MailAddress(strMail).ToString());  &lt;br /&gt;                message1.Subject = "Headline of the press release";  &lt;br /&gt;                if (Request.QueryString["strmail"] == "0")  &lt;br /&gt;                {  &lt;br /&gt;                     message1.Body = "&amp;lt;html&amp;gt;&amp;lt;body&amp;gt;&amp;lt;table&amp;gt;&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Dear Users,&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;br/&amp;gt;" +  &lt;br /&gt;                     "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;t/&amp;gt;This is to inform you that ...your message. &amp;lt;br/&amp;gt;" +  &lt;br /&gt;                     "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;t/&amp;gt;Please click on the link to see details....: &amp;lt;br/&amp;gt;" +  &lt;br /&gt;                     "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;&amp;lt;a href='" + "http://xyz.com/mediapage.aspx?year=" + drlMyyyy.SelectedItem.Value  &lt;br /&gt;                     + "'&amp;gt;" + "http://xyz.com/mediapage.aspx?year=" + drddMyyyy.SelectedItem.Value +  &lt;br /&gt;                     "&amp;lt;/a&amp;gt;&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;&amp;lt;br/&amp;gt;" +  &lt;br /&gt;                     "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;Thanks &amp;amp; Reagrds,&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt;" +  &lt;br /&gt;                     "&amp;lt;tr&amp;gt;&amp;lt;td&amp;gt;santosh singh&amp;lt;/td&amp;gt;&amp;lt;/tr&amp;gt; &amp;lt;/table&amp;gt;&amp;lt;/body&amp;gt;&amp;lt;/html&amp;gt;";  &lt;br /&gt;                }  &lt;br /&gt;           }  &lt;br /&gt;           SmtpClient client = new SmtpClient(ConfigurationManager.AppSettings["SmtpHost"]);  &lt;br /&gt;           client.Send(message1);  &lt;br /&gt;      }  &lt;br /&gt;      catch (Exception ex)  &lt;br /&gt;      {  &lt;br /&gt;           string str1 = string.Format("Message Sending Fail Due To {0}.", ex.Message);  &lt;br /&gt;      }  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6032878392089119068?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6032878392089119068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/send-mail-using-aspnet-c-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6032878392089119068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6032878392089119068'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/send-mail-using-aspnet-c-code.html' title='Send mail using asp.net c# code'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7203815863514392969</id><published>2010-08-25T02:43:00.000-07:00</published><updated>2011-12-22T04:02:27.067-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Resize image in ASP.NET</title><content type='html'>In this example i am going to describe how to resize image in ASP.NET before/and upload to ms sql database using C# and Vb.NET.&lt;br /&gt;&lt;br /&gt;For this i am using FileUpload control to upload the image in datbase after resizing.&lt;br /&gt;I am also displaying the Image in Gridviw after uploading to database.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; public partial class _Default : System.Web.UI.Page   &lt;br /&gt; {  &lt;br /&gt;      protected void Page_Load(object sender, EventArgs e)  &lt;br /&gt;      {  &lt;br /&gt;      }  &lt;br /&gt;      protected void btnUpload_Click(object sender, EventArgs e)  &lt;br /&gt;      {  &lt;br /&gt;           string strImageName = txtName.Text.ToString();  &lt;br /&gt;           if (FileUpload1.PostedFile != null &amp;amp;&amp;amp; FileUpload1.PostedFile.FileName != "")  &lt;br /&gt;           {  &lt;br /&gt;                string strExtension = System.IO.Path.GetExtension(FileUpload1.FileName);  &lt;br /&gt;                if ((strExtension.ToUpper() == ".JPG") | (strExtension.ToUpper() == ".GIF"))  &lt;br /&gt;                {  &lt;br /&gt;                     // Resize Image Before Uploading to DataBase  &lt;br /&gt;                     System.Drawing.Image imageToBeResized = System.Drawing.Image.FromStream(FileUpload1.PostedFile.InputStream);  &lt;br /&gt;                     int imageHeight = imageToBeResized.Height;  &lt;br /&gt;                     int imageWidth = imageToBeResized.Width;  &lt;br /&gt;                     int maxHeight = 240;  &lt;br /&gt;                     int maxWidth = 320;  &lt;br /&gt;                     imageHeight = (imageHeight * maxWidth) / imageWidth;  &lt;br /&gt;                     imageWidth = maxWidth;  &lt;br /&gt;                     if (imageHeight &amp;gt; maxHeight)  &lt;br /&gt;                     {  &lt;br /&gt;                          imageWidth = (imageWidth * maxHeight) / imageHeight;  &lt;br /&gt;                          imageHeight = maxHeight;  &lt;br /&gt;                     }  &lt;br /&gt;                     Bitmap bitmap = new Bitmap(imageToBeResized, imageWidth, imageHeight);  &lt;br /&gt;                     System.IO.MemoryStream stream = new MemoryStream();  &lt;br /&gt;                     bitmap.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg);  &lt;br /&gt;                     stream.Position = 0;  &lt;br /&gt;                     byte[] image = new byte[stream.Length + 1];  &lt;br /&gt;                     stream.Read(image, 0, image.Length);  &lt;br /&gt;                     // Create SQL Connection   &lt;br /&gt;                     SqlConnection con = new SqlConnection();  &lt;br /&gt;                     con.ConnectionString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;  &lt;br /&gt;                     // Create SQL Command   &lt;br /&gt;                     SqlCommand cmd = new SqlCommand();  &lt;br /&gt;                     cmd.CommandText = "INSERT INTO Images(ImageName,Image) VALUES (@ImageName,@Image)";  &lt;br /&gt;                     cmd.CommandType = CommandType.Text;  &lt;br /&gt;                     cmd.Connection = con;  &lt;br /&gt;                     SqlParameter ImageName = new SqlParameter("@ImageName", SqlDbType.VarChar, 50);  &lt;br /&gt;                     ImageName.Value = strImageName.ToString();  &lt;br /&gt;                     cmd.Parameters.Add(ImageName);  &lt;br /&gt;                     SqlParameter UploadedImage = new SqlParameter("@Image", SqlDbType.Image, image.Length);  &lt;br /&gt;                     UploadedImage.Value = image;  &lt;br /&gt;                     cmd.Parameters.Add(UploadedImage);  &lt;br /&gt;                     con.Open();  &lt;br /&gt;                     int result = cmd.ExecuteNonQuery();  &lt;br /&gt;                     con.Close();  &lt;br /&gt;                     if (result &amp;gt; 0)  &lt;br /&gt;                     lblMessage.Text = "File Uploaded";  &lt;br /&gt;                     GridView1.DataBind();  &lt;br /&gt;                }  &lt;br /&gt;           }  &lt;br /&gt;      }  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;aspx code&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;form id="form1" runat="server"&amp;gt;  &lt;br /&gt;      &amp;lt;div&amp;gt;  &lt;br /&gt;      &amp;lt;asp:TextBox ID="txtName" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;  &lt;br /&gt;      &amp;lt;asp:FileUpload ID="FileUpload1" runat="server" /&amp;gt;&amp;lt;br /&amp;gt;  &lt;br /&gt;      &amp;lt;br /&amp;gt;  &lt;br /&gt;      &amp;lt;asp:Button ID="btnUpload" runat="server" OnClick="btnUpload_Click" Text="Upload" /&amp;gt;  &lt;br /&gt;      &amp;lt;asp:Label ID="lblMessage" runat="server"&amp;lt;/asp:Label&amp;gt;  &lt;br /&gt;      &amp;lt;asp:GridView ID="GridView1" runat="server"     AutoGenerateColumns="False" DataKeyNames="ID" DataSourceID="SqlDataSource1"&amp;gt;  &lt;br /&gt;           &amp;lt;Columns&amp;gt;  &lt;br /&gt;                &amp;lt;asp:BoundField DataField="ID" HeaderText="ID" InsertVisible="False" ReadOnly="True" SortExpression="ID" /&amp;gt;  &lt;br /&gt;                &amp;lt;asp:BoundField DataField="ImageName" HeaderText="ImageName" SortExpression="ImageName" /&amp;gt;  &lt;br /&gt;                &amp;lt;asp:TemplateField HeaderText="Image"&amp;gt;  &lt;br /&gt;                     &amp;lt;ItemTemplate&amp;gt;  &lt;br /&gt;                          &amp;lt;asp:Image ID="Image1" runat="server" ImageUrl='&amp;lt;%# "Handler.ashx?ID=" + Eval("ID")%&amp;gt;'/&amp;gt;  &lt;br /&gt;                     &amp;lt;/ItemTemplate&amp;gt;  &lt;br /&gt;                &amp;lt;/asp:TemplateField&amp;gt;  &lt;br /&gt;           &amp;lt;/Columns&amp;gt;  &lt;br /&gt;      &amp;lt;/asp:GridView&amp;gt;  &lt;br /&gt;      &amp;lt;asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="&amp;lt;%$ ConnectionStrings:ConnectionString %&amp;gt;" SelectCommand="SELECT [ID], [ImageName], [Image]   &lt;br /&gt;         FROM [Images]"&amp;gt;  &lt;br /&gt;   &amp;lt;/asp:SqlDataSource&amp;gt;  &lt;br /&gt; &amp;lt;/form&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7203815863514392969?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7203815863514392969/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/resize-image-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7203815863514392969'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7203815863514392969'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/resize-image-in-aspnet.html' title='Resize image in ASP.NET'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1216326850421745183</id><published>2010-08-24T00:30:00.002-07:00</published><updated>2011-12-26T04:21:04.154-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>ViewState And Session example</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;View state is used for store data at page level,you cant access View state data to another page.&lt;br /&gt;Session state is used for store data and you can access anywhere in your website.&lt;br /&gt;Session state is state specific information per client basis.&lt;br /&gt;&lt;br /&gt;Example is given below.&lt;br /&gt;&lt;br /&gt;View State:&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void btnSubmit_Click(object sender, EventArgs e)  &lt;br /&gt; {   &lt;br /&gt;      ViewState["DataScorceName"] = datasource;  &lt;br /&gt;      ViewState["ClientName"] = txtCustomer.Text;  &lt;br /&gt; }  &lt;br /&gt; //Retrieve viewstate information  &lt;br /&gt; txtCname.Text = ViewState["ClientName"]  &lt;br /&gt; Store information in Session State:  &lt;br /&gt; Session["EmpName"] = txtUser.Text;  &lt;br /&gt; //Retrieve session value in 2nd page  &lt;br /&gt; lblEmp.Text = Session["UserName"].ToString();  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1216326850421745183?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1216326850421745183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/viewstateandsession-ex.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1216326850421745183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1216326850421745183'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/viewstateandsession-ex.html' title='ViewState And Session example'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5466116350956815523</id><published>2010-08-24T00:30:00.001-07:00</published><updated>2011-12-26T04:25:34.503-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>How to create connection string dynamically</title><content type='html'>Here i am using viewstate to create connection string at run time.&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void btnSubmit_Click(object sender, EventArgs e)  &lt;br /&gt; {   &lt;br /&gt;      ViewState["DataScorceName"] = datasource;  &lt;br /&gt;      ViewState["Customer"] = txtCustomer.Text;  &lt;br /&gt; }  &lt;br /&gt; public void MyFunction()  &lt;br /&gt; {   &lt;br /&gt;      string sqlConnectionString = "Persist Security Info=True;User ID=sa;Password=Sa;Initial Catalog=" + DBName + ";Data Source='" + ViewState["DataScorceName"] + "'";  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5466116350956815523?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5466116350956815523/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/view-state.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5466116350956815523'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5466116350956815523'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/view-state.html' title='How to create connection string dynamically'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1235934370923739091</id><published>2010-08-24T00:29:00.003-07:00</published><updated>2011-12-26T04:27:54.622-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>How to reverse a string</title><content type='html'>&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; char [] myArray = txtName.Text.ToCharArray();  &lt;br /&gt; Array.Reverse( myArray );  &lt;br /&gt; string strReversed = new string( myArray );  &lt;br /&gt; lblName.Text = strReversed;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1235934370923739091?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1235934370923739091/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-reverse-string.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1235934370923739091'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1235934370923739091'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-reverse-string.html' title='How to reverse a string'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3914873956708972371</id><published>2010-08-24T00:29:00.001-07:00</published><updated>2011-01-09T07:03:06.375-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>how to use Sql server Function</title><content type='html'>Sql server Function With Arguments&lt;br /&gt;&lt;br /&gt;here it is simple example how to use function n sql server.&lt;br /&gt;1.Create function&lt;br /&gt;2.use this function where required.&lt;br /&gt;&lt;br /&gt;CREATE FUNCTION AddTwoNumber(@Num1 Decimal(6,2),&lt;br /&gt;    @Num2 Decimal(6,2))&lt;br /&gt;RETURNS Decimal(6,2)&lt;br /&gt;BEGIN&lt;br /&gt;    DECLARE @Result Decimal(6,2)&lt;br /&gt;    SET @Result = @Num1 + @Num2&lt;br /&gt;    RETURN @Result&lt;br /&gt;END;&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;PRINT MyDbName.dbo.AddTwoNumber(100, 200);&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3914873956708972371?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3914873956708972371/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-use-sql-server-function.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3914873956708972371'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3914873956708972371'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-use-sql-server-function.html' title='how to use Sql server Function'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7773625088412182575</id><published>2010-08-24T00:28:00.003-07:00</published><updated>2010-08-30T08:52:11.282-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Sp for Creating db</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Stored procedure for creating database.&lt;/span&gt;&lt;br /&gt;When you want to create database at run time using c# .net here is stored procedure execute this and pass database name as parameter.&lt;br /&gt;&lt;br /&gt;Create proc [dbo].[usp_Database]&lt;br /&gt;(&lt;br /&gt;@dbName varchar(50)&lt;br /&gt;)&lt;br /&gt;as&lt;br /&gt;&lt;br /&gt;IF NOT EXISTS (SELECT 'True' FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME = @dbName)&lt;br /&gt;   -- DROP DATABASE ' + @dbName + '&lt;br /&gt;&lt;br /&gt;DECLARE @device_directory NVARCHAR(520)&lt;br /&gt;SELECT @device_directory = SUBSTRING(physical_name, 1, CHARINDEX(N'master.mdf', LOWER(physical_name)) - 1)&lt;br /&gt;FROM sys.database_files&lt;br /&gt;WHERE (name = N'master')&lt;br /&gt;&lt;br /&gt;EXECUTE (N'CREATE DATABASE  ' + @dbName + '&lt;br /&gt;            ON&lt;br /&gt;              (NAME = ' + @dbName + ',&lt;br /&gt;               FILENAME = ''' + @device_directory + '' + @dbName + '.mdf'',&lt;br /&gt;               SIZE = 50MB,&lt;br /&gt;               MAXSIZE = 125MB,&lt;br /&gt;               FILEGROWTH = 10MB)&lt;br /&gt;            LOG ON&lt;br /&gt;              (NAME = ''NorthwindBulkLog'',&lt;br /&gt;               FILENAME = ''' + @device_directory + '' + @dbName + '.ldf'',&lt;br /&gt;               SIZE = 5MB,&lt;br /&gt;               MAXSIZE = 25MB,&lt;br /&gt;               FILEGROWTH = 5MB)')&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7773625088412182575?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7773625088412182575/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/sp-for-creating-db.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7773625088412182575'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7773625088412182575'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/sp-for-creating-db.html' title='Sp for Creating db'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2836098078505257823</id><published>2010-08-24T00:28:00.001-07:00</published><updated>2011-12-26T04:33:39.569-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>SetFocus to TextBox in GridView control</title><content type='html'>&lt;span style="font-weight:bold;"&gt;How to set focus in a GridView&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;Set Focus to TextBox in GridView when click on Edit Some time we have requirement to set focus in gridview,so here i am describing to how to this.&lt;br /&gt;Drag and drop a gridview and bind it according to below code.&lt;br /&gt;&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void GridViewBind()  &lt;br /&gt; {  &lt;br /&gt;      try  &lt;br /&gt;      {  &lt;br /&gt;           Ds = obBLLclass.GetData();  &lt;br /&gt;           if (Ds.Tables[0].Rows.Count &amp;gt; 0)  &lt;br /&gt;           {  &lt;br /&gt;                gridview.DataSource = Ds;  &lt;br /&gt;                gridview.DataBind();  &lt;br /&gt;           }   &lt;br /&gt;      }  &lt;br /&gt;      catch (Exception ex)  &lt;br /&gt;      {  &lt;br /&gt;           Message.Text = ex.Message;  &lt;br /&gt;      }  &lt;br /&gt; }  &lt;br /&gt; protected void gridview_RowEditing(object sender, GridViewEditEventArgs e)  &lt;br /&gt; {  &lt;br /&gt;      gridview.EditIndex = e.NewEditIndex;  &lt;br /&gt;      GridViewBind();  &lt;br /&gt;      gridview.Rows[e.NewEditIndex].FindControl("txtname").Focus();  &lt;br /&gt; }  &lt;br /&gt; protected void gridview_PageIndexChanging(object sender, GridViewPageEventArgs e)  &lt;br /&gt; {  &lt;br /&gt;      gridview.PageIndex = e.NewPageIndex;  &lt;br /&gt;      GridViewBind();  &lt;br /&gt; }  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2836098078505257823?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2836098078505257823/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/setfocus-to-textbox-in-gridview-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2836098078505257823'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2836098078505257823'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/setfocus-to-textbox-in-gridview-control.html' title='SetFocus to TextBox in GridView control'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4305645652906508083</id><published>2010-08-24T00:25:00.002-07:00</published><updated>2011-12-26T04:53:27.383-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>How to insert excel file into sql database in ASP.NET</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Import EXCEL sheet data to SQL Database table in ASP.NET&lt;/span&gt;&lt;br /&gt;Here I will explain how to read excel file data and insert into in sql server database.&lt;br /&gt;  &lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; protected void btnupload_Click(object sender, EventArgs e)   &lt;br /&gt; {  &lt;br /&gt;      String excelConnectionString1;   &lt;br /&gt;      String fname = sendupload.PostedFile.FileName;   &lt;br /&gt;      if (sendupload.PostedFile.FileName.EndsWith(".xls"))   &lt;br /&gt;      {   &lt;br /&gt;           String excelsheet;   &lt;br /&gt;           sendupload.SaveAs(Server.MapPath("~/Image/" + sendupload.FileName));   &lt;br /&gt;           if (sendupload.PostedFile.FileName.EndsWith(".xls"))   &lt;br /&gt;           {  &lt;br /&gt;                excelConnectionString1 = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Server.MapPath("~/ExcelFiles/" + sendupload.FileName) + ";Extended Properties=Excel 8.0";   &lt;br /&gt;                OleDbConnection myEcelConnection1 = new OleDbConnection(excelConnectionString1);   &lt;br /&gt;                myEcelConnection1.Open();   &lt;br /&gt;                if (txtsheet.Text.Length == 0)   &lt;br /&gt;                {   &lt;br /&gt;                     lblmsg.Text = "Please Write File Name";   &lt;br /&gt;                }   &lt;br /&gt;                else   &lt;br /&gt;                {   &lt;br /&gt;                     excelsheet = "[" + txtsheet.Text + "$" + "]";   &lt;br /&gt;                     string sheet = "Select * from [" + txtsheet.Text + "$" + "]";   &lt;br /&gt;                     OleDbCommand cmd1 = new OleDbCommand(sheet, myEcelConnection1);   &lt;br /&gt;                     cmd1.CommandType = CommandType.Text;   &lt;br /&gt;                     OleDbDataAdapter myAdapter1 = new OleDbDataAdapter(cmd1);   &lt;br /&gt;                     DataSet myDataSet1 = new DataSet();   &lt;br /&gt;                     myAdapter1.Fill(myDataSet1);   &lt;br /&gt;                     int a = myDataSet1.Tables[0].Rows.Count - 1;   &lt;br /&gt;                     string name;   &lt;br /&gt;                     string id;   &lt;br /&gt;                     string cls;   &lt;br /&gt;                     string num;   &lt;br /&gt;                     for (int i = 0; i &amp;lt;= a; i++)   &lt;br /&gt;                     {   &lt;br /&gt;                          name = myDataSet1.Tables[0].Rows[i].ItemArray[0].ToString();   &lt;br /&gt;                          id = myDataSet1.Tables[0].Rows[i].ItemArray[1].ToString();   &lt;br /&gt;                          cls = myDataSet1.Tables[0].Rows[i].ItemArray[2].ToString();   &lt;br /&gt;                          num = myDataSet1.Tables[0].Rows[i].ItemArray[3].ToString();  &lt;br /&gt;                          SqlConnection con = new SqlConnection(constr);   &lt;br /&gt;                          con.Open();   &lt;br /&gt;                          SqlCommand command = new SqlCommand("Insert into StudentDetails(StudentName,CivilIdNumber,Class,StudentID)values(@valname,@valids,@valcls,@valnum)", con);   &lt;br /&gt;                          command.Parameters.Add("@valname", SqlDbType.VarChar, 50).Value = name;   &lt;br /&gt;                          command.Parameters.Add("@valids", SqlDbType.VarChar, 50).Value = id;   &lt;br /&gt;                          command.Parameters.Add("@valcls", SqlDbType.VarChar, 50).Value = cls;   &lt;br /&gt;                          command.Parameters.Add("@valnum", SqlDbType.VarChar, 50).Value = num;   &lt;br /&gt;                          command.CommandType = CommandType.Text;   &lt;br /&gt;                          SqlDataAdapter da = new SqlDataAdapter(command);   &lt;br /&gt;                          DataSet ds = new DataSet();   &lt;br /&gt;                          da.Fill(ds);   &lt;br /&gt;                          con.Close();  &lt;br /&gt;                     }   &lt;br /&gt;                }   &lt;br /&gt;           }   &lt;br /&gt;      }   &lt;br /&gt; }   &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;.aspx page&lt;br /&gt;&lt;pre  style="font-family:arial;font-size:12px;border:1px dashed #CCCCCC;width:99%;height:auto;overflow:auto;background:#f0f0f0;;background-image:URL(http://2.bp.blogspot.com/_z5ltvMQPaa8/SjJXr_U2YBI/AAAAAAAAAAM/46OqEP32CJ8/s320/codebg.gif);padding:0px;color:#000000;text-align:left;line-height:20px;"&gt;&lt;code style="color:#000000;word-wrap:normal;"&gt; &amp;lt;table width="100%"&amp;gt;   &lt;br /&gt;      &amp;lt;tr&amp;gt;   &lt;br /&gt;           &amp;lt;td colspan="3"&amp;gt; &amp;lt;span style="font-family: Segoe UI"&amp;gt; File Upload&amp;lt;/span&amp;gt; &amp;lt;/td&amp;gt;   &lt;br /&gt;      &amp;lt;/tr&amp;gt;   &lt;br /&gt;      &amp;lt;tr&amp;gt;   &lt;br /&gt;           &amp;lt;td colspan="3"&amp;gt;   &lt;br /&gt;           &amp;lt;asp:FileUpload ID="sendupload" runat="server" /&amp;gt; &amp;lt;/td&amp;gt;   &lt;br /&gt;      &amp;lt;/tr&amp;gt;   &lt;br /&gt;      &amp;lt;tr&amp;gt;   &lt;br /&gt;           &amp;lt;td colspan="3"&amp;gt;   &lt;br /&gt;           &amp;lt;span style="font-family: Segoe UI"&amp;gt; Sheet Name: &amp;lt;/span&amp;gt;   &lt;br /&gt;           &amp;lt;asp:TextBox ID="txtsheet" runat="server"&amp;gt; &amp;lt;/asp:TextBox&amp;gt;   &lt;br /&gt;           &amp;lt;asp:Label ID="lblmsg" runat="server"&amp;gt; &amp;lt;/asp:Label&amp;gt;   &lt;br /&gt;           &amp;lt;/td&amp;gt;   &lt;br /&gt;      &amp;lt;/tr&amp;gt;   &lt;br /&gt;      &amp;lt;tr&amp;gt;   &lt;br /&gt;           &amp;lt;td&amp;gt; &amp;lt;asp:Button ID="btnupload" runat="server" Text="Upload" OnClick="btnupload_Click" /&amp;gt; &amp;lt;/td&amp;gt;   &lt;br /&gt;      &amp;lt;/tr&amp;gt;   &lt;br /&gt; &amp;lt;/table&amp;gt;  &lt;br /&gt;&lt;/code&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4305645652906508083?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4305645652906508083/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/read-excell-and-insert-to-db.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4305645652906508083'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4305645652906508083'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/read-excell-and-insert-to-db.html' title='How to insert excel file into sql database in ASP.NET'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8414214728849483978</id><published>2010-08-24T00:23:00.001-07:00</published><updated>2010-08-30T09:05:09.995-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Open Popup Wnidow With QueryString asp.net C#</title><content type='html'>How to open pop window using asp.net c#.&lt;br /&gt;Here code descibes how to open popup window with passing a query string in popup page.&lt;br /&gt;&lt;br /&gt; string popup = "&amp;lt;script language='javascript'&amp;gt;" + "window.open('poppage.aspx?data=" + HttpUtility.UrlEncode(qs.ToString()) + "','CustomPopUp', " + "'fullscreen=no,height=330,width=350,top=250,left=250,scrollbars=yes, dependant = yes, alwaysRaised = yes, menubar=no,resizable=no')" + "&amp;lt;/script&amp;gt;";&lt;br /&gt; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(), "PopupScript", popup,false);    &lt;br /&gt;&lt;br /&gt;If you want only popup message code is given below.&lt;br /&gt; ScriptManager.RegisterClientScriptBlock(this.Page, this.GetType(),"MyMessage","alert('Please enter!')", true);&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8414214728849483978?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8414214728849483978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/openpopwnidowwithquerystringc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8414214728849483978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8414214728849483978'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/openpopwnidowwithquerystringc.html' title='Open Popup Wnidow With QueryString asp.net C#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2945088425961281047</id><published>2010-08-24T00:22:00.004-07:00</published><updated>2011-04-02T07:37:40.657-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Nested GridView in asp.net</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Gridview within another gridview&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;this exmaple show how we can nest gridview within gridview for disply related data from database.Gridview can be nested in other Gridview control to display the related data of any item retrieved from database using C# code.&lt;br /&gt;&lt;br /&gt;Steps:&lt;br /&gt;1. Drag &amp; drop a gridview in to the page.&lt;br /&gt;2. Add a new template column to this gridview.&lt;br /&gt;3. Place another gridview inside this template column.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:GridView ID="GridView2" runat="server" EnableTheming="False" PageSize="15" Width="700px"&lt;br /&gt;      OnPageIndexChanging="GridView2_PageIndexChanging" OnRowDataBound="GridView2_RowDataBound"&lt;br /&gt;       AutoGenerateColumns="False"&gt;&lt;br /&gt; &amp;lt;Columns&gt;&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="Employee Details"&gt;&lt;br /&gt;  &amp;lt;ItemTemplate&gt;&lt;br /&gt;      &amp;lt;table&gt;&lt;br /&gt;   &amp;lt;tr&gt;&lt;br /&gt;       &amp;lt;td&gt;&lt;br /&gt;    Company Name &amp;lt;/td&gt;&lt;br /&gt;       &amp;lt;td&gt;&lt;br /&gt;    :&amp;lt;/td&gt;&lt;br /&gt;       &amp;lt;td colspan="4"&gt;&lt;br /&gt;    &amp;lt;asp:Label ID="lblCompany" runat="server" Text='&amp;lt;%# Bind("Company") %&gt;'&gt;&amp;lt;/asp:Label&gt;&amp;lt;/td&gt;&lt;br /&gt;   &amp;lt;/tr&gt;&lt;br /&gt;   &amp;lt;tr&gt;&lt;br /&gt;       &amp;lt;td&gt;&lt;br /&gt;    Date&amp;lt;/td&gt;&lt;br /&gt;       &amp;lt;td&gt;&lt;br /&gt;    :&amp;lt;/td&gt;&lt;br /&gt;       &amp;lt;td colspan="4"&gt;&lt;br /&gt;    &amp;lt;asp:Label ID="lblDate" runat="server"&gt;&lt;/asp:Label&gt;&lt;/td&gt;&lt;br /&gt;   &amp;lt;/tr&gt;&lt;br /&gt;   &amp;lt;tr&gt;&lt;br /&gt;       &amp;lt;td colspan="6"&gt;&lt;br /&gt;    &amp;lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" EnableTheming="False"&lt;br /&gt;        PageSize="10" Width="100%" OnPageIndexChanging="GridView1_PageIndexChanging"&lt;br /&gt;        OnRowDataBound="GridView1_RowDataBound" AutoGenerateColumns="False"&amp;gt;&lt;br /&gt;        &amp;lt;Columns&amp;gt;                                                        &lt;br /&gt;     &amp;lt;asp:BoundField DataField="User Name" HeaderText="Name"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="LoanName" HeaderText="Loan"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="Show Name" HeaderText="Payroll Month"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="PDate" HeaderText="Paid Date"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Center" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="OpeningBalance" HeaderText="Open Date"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Right" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;     &amp;lt;asp:BoundField DataField="PaidAmount" HeaderText="Amt. Paid"&amp;gt;&lt;br /&gt;         &amp;lt;ItemStyle HorizontalAlign="Right" &amp;gt;&lt;br /&gt;     &amp;lt;/asp:BoundField&amp;gt;                                                      &lt;br /&gt;        &amp;lt;/Columns&amp;gt;&lt;br /&gt;        &amp;lt;RowStyle CssClass="reporttext" /&amp;gt;&lt;br /&gt;        &amp;lt;EmptyDataTemplate&amp;gt;&lt;br /&gt;     &amp;lt;strong&gt;&amp;lt;span style="font-size: 10pt;"&amp;gt;No Records....!&amp;lt;/span&amp;gt; &amp;lt;/strong&amp;gt;&lt;br /&gt;        &amp;lt;/EmptyDataTemplate&amp;gt;&lt;br /&gt;        &amp;lt;PagerStyle CssClass="reportheader" /&amp;gt;&lt;br /&gt;        &amp;lt;HeaderStyle CssClass="reportheader" Width="80px" /&amp;gt;&lt;br /&gt;        &amp;lt;AlternatingRowStyle CssClass="reporttext" /&amp;gt;&lt;br /&gt;    &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;       &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;/tr&amp;gt;                                       &lt;br /&gt;      &amp;lt;/table&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;/Columns&amp;gt;                       &lt;br /&gt;&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;.cs code&lt;br /&gt;protected void FirstGridBind()&lt;br /&gt;    {&lt;br /&gt;        DataTable dt1DataTable = new DataTable();&lt;br /&gt;        dt1.Columns.Add("CompanyName");&lt;br /&gt;        DataRow drDataRow = dt1DataTable.NewRow();&lt;br /&gt;        if (ddlCompany.SelectedValue != "0")&lt;br /&gt;        {&lt;br /&gt;            drDataRow["CompanyName"] = ddlCompany.SelectedItem.Text;&lt;br /&gt;        }&lt;br /&gt;        else&lt;br /&gt;        {&lt;br /&gt;            drDataRow["CompanyName"] = "All Companies";&lt;br /&gt;        }&lt;br /&gt;        dt1DataTable.Rows.Add(drDataRow);&lt;br /&gt;        GridView2.DataSource = dt1DataTable;&lt;br /&gt;        GridView2.DataBind();&lt;br /&gt;    }&lt;br /&gt;protected void SecondGridBind()&lt;br /&gt;    {&lt;br /&gt;        foreach (GridViewRow row in GridView2.Rows)&lt;br /&gt;        {&lt;br /&gt;            Label lblDate = row.FindControl("lblDate") as Label;&lt;br /&gt;            if (txtFromDate.Text.Trim() != "" &amp;&amp; txtToDate.Text.Trim() != "")&lt;br /&gt;            {&lt;br /&gt;                lblDate.Text = txtFromDate.Text.Trim() + " - " + txtToDate.Text.Trim();&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                lblDate.Text = "All Dates";&lt;br /&gt;            }&lt;br /&gt;            GridView GridView1 = row.FindControl("GridView1") as GridView;&lt;br /&gt;&lt;br /&gt;            string str = @"SELECT     You query;&lt;br /&gt;&lt;br /&gt;            if (ddlCompany.SelectedValue != "0")&lt;br /&gt;            {&lt;br /&gt;                str += " AND (hrdEmployeeMaster.CompanyId = " + Convert.ToInt32(ddlCompany.SelectedValue) + ")";&lt;br /&gt;            } &lt;br /&gt;            DataTable dt = SqlHelper.ExecuteDataset(connString, CommandType.Text, str).Tables[0];&lt;br /&gt;            Session["myDataTable"] = dt;&lt;br /&gt;            GridView1.DataSource = dt;&lt;br /&gt;            GridView1.DataBind();&lt;br /&gt;            if (GridView1.Rows.Count &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                lbExport.Visible = true; &lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;        {&lt;br /&gt;            if (GridView2.Rows.Count &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                GridView GridView1 = GridView2.Rows[0].FindControl("GridView1") as GridView;&lt;br /&gt;                e.Row.Cells[0].Text = Convert.ToString(GridView1.PageIndex * GridView1.PageSize + SrNo);&lt;br /&gt;                SrNo++;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2945088425961281047?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2945088425961281047/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/nested-grid.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2945088425961281047'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2945088425961281047'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/nested-grid.html' title='Nested GridView in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-387055893389559610</id><published>2010-08-24T00:22:00.001-07:00</published><updated>2010-08-27T05:10:27.805-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><title type='text'>JavaScript for textbox should be numeric</title><content type='html'>&lt;span style="font-weight:bold;"&gt;JavaScript for textbox should be numeric&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;This example show validate a textbox value is numeric.When you enter a non nemeric value &lt;br /&gt;in textbox popup message will display.&lt;br /&gt;&amp;lt;asp:TextBox ID="txtMinExperience" onKeyUp="benumeric();" runat="server" MaxLength="50" TabIndex="4" &lt;br /&gt;Width="50px"&amp;gt;0&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt;function benumeric()&lt;br /&gt;    { &lt;br /&gt;        var txtMin=document.getElementById('&lt;%=txtMinExperience.ClientID%&gt;');&lt;br /&gt;        if(isNaN(txtMin.value)== true)&lt;br /&gt;        {&lt;br /&gt;            alert("This Field Should Be Numeric."); &lt;br /&gt;            txtMin.focus();&lt;br /&gt;            txtMin.value="";      &lt;br /&gt;            return false;     &lt;br /&gt;        }  &lt;br /&gt;        return true;&lt;br /&gt;     }&lt;br /&gt; &amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-387055893389559610?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/387055893389559610/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-for-textbox-should-be.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/387055893389559610'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/387055893389559610'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-for-textbox-should-be.html' title='JavaScript for textbox should be numeric'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-505752662824967097</id><published>2010-08-24T00:21:00.003-07:00</published><updated>2010-08-27T05:16:50.671-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><title type='text'>JavaScript validation for dropdownlist</title><content type='html'>This example show how dropdownlist should be selected using javascript.&lt;br /&gt;&lt;br /&gt; function validate()&lt;br /&gt;    {   &lt;br /&gt;     var ddlCountry = document.getElementById('&lt;%=ddlParameter.ClientID%&gt;');     &lt;br /&gt;     if(ddlCountry.value==0)&lt;br /&gt;       {&lt;br /&gt;          alert("Not Selected..!");&lt;br /&gt;          ddlParameter.focus();&lt;br /&gt;          return false;&lt;br /&gt;       }         &lt;br /&gt;    return true;    &lt;br /&gt;    }&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-505752662824967097?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/505752662824967097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-for-dropdownlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/505752662824967097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/505752662824967097'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-for-dropdownlist.html' title='JavaScript validation for dropdownlist'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5976951054058386154</id><published>2010-08-24T00:21:00.001-07:00</published><updated>2010-08-30T09:22:29.362-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><title type='text'>JavaScript form Validation in asp.net</title><content type='html'>This simple code show how to do simple client side validation using javascript&lt;br /&gt;&lt;br /&gt;Create a form with following:&lt;br /&gt;&lt;br /&gt;   1. Emp Name : &amp;lt;asp:TextBox ID="txtEmpName" /&amp;gt;&lt;br /&gt;   2. Email : &amp;lt;asp:TextBox ID="txtEmailAdd" /&amp;gt;&lt;br /&gt;   3. URL : &amp;lt;asp:TextBox ID="txturl" /&amp;gt;&lt;br /&gt;   4. Zip : &amp;lt;asp:TextBox ID="txtZip" /&amp;gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;&amp;lt;asp:Button ID="btnAdd" OnClientClick=" return form_validate()" runat="server" Text="Submit" /&amp;gt;&lt;br /&gt;&lt;br /&gt;Write this javascript to your aspx page&lt;br /&gt;&lt;br /&gt;&amp;lt;script language="javascript" type="text/javascript"&amp;gt;&lt;br /&gt;function form_validate()&lt;br /&gt;{&lt;br /&gt;      if (document.getElementById("&amp;lt;%=txtEmpName.ClientID%&amp;gt;").value=="")&lt;br /&gt;      {&lt;br /&gt;                 alert("Please enter the name");&lt;br /&gt;                 document.getElementById("&amp;lt;%=txtEmpName.ClientID%&amp;gt;").focus();&lt;br /&gt;                 return false;&lt;br /&gt;      }&lt;br /&gt;      if(document.getElementById("&amp;lt;txtEmailAdd.ClientID %&amp;gt;").value=="")&lt;br /&gt;      {&lt;br /&gt;                alert("Email id can not be blank");&lt;br /&gt;                document.getElementById("&amp;lt;%=txtEmailAdd.ClientID %&amp;gt;").focus();&lt;br /&gt;                return false;&lt;br /&gt;      }&lt;br /&gt;     var mailPattern = /^(\".*\"|[A-Za-z]\w*)@(\[\d{1,3}(\.\d{1,3}){3}]|[A-Za-z]\w*(\.[A-Za-z]\w*)+)$/;&lt;br /&gt;     var mailid=document.getElementById("&amp;lt;%=txtEmailAdd.ClientID %&amp;gt;").value;&lt;br /&gt;     var matchArr = mailid.match(mailPattern);&lt;br /&gt;     if (matchArr == null)&lt;br /&gt;       {&lt;br /&gt;               alert("Your email is incorrect.");&lt;br /&gt;               document.getElementById("&amp;lt;%=txtEmailAdd.ClientID %&amp;gt;").focus();&lt;br /&gt;               return false;&lt;br /&gt;       }&lt;br /&gt;    if(document.getElementById("&amp;lt;%=txturl.ClientID %&amp;gt;").value=="")&lt;br /&gt;     {&lt;br /&gt;               alert("Please enter URL");&lt;br /&gt;               document.getElementById("&amp;lt;%=txturl.ClientID %&amp;gt;").value="http://"&lt;br /&gt;               document.getElementById("&amp;lt;%=txturl.ClientID %&amp;gt;").focus();&lt;br /&gt;               return false;&lt;br /&gt;     }&lt;br /&gt;    var Url="^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&amp;\?\/.=]+$"&lt;br /&gt;    var tempURL=document.getElementById("&amp;lt;%=txturl.ClientID%&amp;gt;").value;&lt;br /&gt;    var matchURL=tempURL.match(Url);&lt;br /&gt;     if(matchURL==null)&lt;br /&gt;     {&lt;br /&gt;               alert("URL incorrect try again||");&lt;br /&gt;               document.getElementById("&amp;lt;%=txturl.ClientID %&amp;gt;").focus();&lt;br /&gt;               return false;&lt;br /&gt;     }&lt;br /&gt;     if (document.getElementById("&amp;lt;%=txtZIP.ClientID%&amp;gt;").value=="")&lt;br /&gt;     {&lt;br /&gt;               alert("Zip Code not correct");&lt;br /&gt;               document.getElementById("&amp;lt;%=txtZIP.ClientID%&amp;gt;").focus();&lt;br /&gt;               return false;&lt;br /&gt;     }&lt;br /&gt;     var digits="0123456789";&lt;br /&gt;     var temp;&lt;br /&gt;     for (var i=0;i&lt;document.getElementById("&amp;lt;%=txtZIP.ClientID %&amp;gt;").value.length;i++)&lt;br /&gt;     {&lt;br /&gt;               temp=document.getElementById("&amp;lt;%=txtZIP.ClientID%&amp;gt;").value.substring(i,i+1);&lt;br /&gt;               if (digits.indexOf(temp)==-1)&lt;br /&gt;               {&lt;br /&gt;                        alert("Please enter correct zip code");&lt;br /&gt;                        document.getElementById("&amp;lt;%=txtZIP.ClientID%&amp;gt;").focus();&lt;br /&gt;                        return false;&lt;br /&gt;               }&lt;br /&gt;     }&lt;br /&gt;     return true;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5976951054058386154?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5976951054058386154/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-form-validation-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5976951054058386154'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5976951054058386154'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-form-validation-in-aspnet.html' title='JavaScript form Validation in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4978098914773997999</id><published>2010-08-24T00:19:00.003-07:00</published><updated>2010-08-31T09:15:22.612-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>HyperLinkink in Gridview</title><content type='html'>Hyperlink column in Gridview&lt;br /&gt; Here i am describing very simple code for how to use Hyperlink column in Gridview&lt;br /&gt;&lt;br /&gt; &amp;lt;asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"&lt;br /&gt;    Height="1px" OnPageIndexChanging="GridView1_PageIndexChanging" OnRowDataBound="GridView1_RowDataBound"&lt;br /&gt;    Width="700px"&amp;gt;&lt;br /&gt;     &amp;lt;Columns&amp;gt;&lt;br /&gt;  &amp;lt;asp:BoundField DataField="Designation" HeaderText="Designation"&amp;gt;&lt;br /&gt;  &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;  &amp;lt;asp:BoundField DataField="ContactNo" HeaderText="Contact No."&amp;gt;&lt;br /&gt;      &amp;lt;ItemStyle Width="100px" /&amp;gt;&lt;br /&gt;      &amp;lt;HeaderStyle Width="100px" /&amp;gt;&lt;br /&gt;  &amp;lt;/asp:BoundField&amp;gt;&lt;br /&gt;  &amp;lt;asp:HyperLinkField DataNavigateUrlFields="CandidateAppId" DataNavigateUrlFormatString="~/Salary/frmsalary.aspx?Id={0}"&lt;br /&gt;     HeaderText="Attach" Text="View"&amp;gt;&lt;br /&gt;      &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt;HeaderStyle Width="50px" /&amp;gt;&lt;br /&gt;  &amp;lt;/asp:HyperLinkField&amp;gt;&lt;br /&gt;  &amp;lt;asp:TemplateField HeaderText="View"&amp;gt;&lt;br /&gt;      &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;asp:TextBox ID="TextBox1" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;      &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt;HeaderStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;asp:ImageButton ID="ImageView" runat="server" ImageUrl="~/Image/img.png"&lt;br /&gt;      OnClick="ImageView_Click" /&amp;gt;&lt;br /&gt;      &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;  &amp;lt;asp:TemplateField HeaderText="Delete"&amp;gt;&lt;br /&gt;      &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;asp:TextBox ID="TextBox3" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;      &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt;HeaderStyle Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;   &amp;lt;asp:ImageButton ID="ImgDelete" runat="server" ImageUrl="~/Image/img.png"&lt;br /&gt;      OnClick="ImgDelete_Click" /&amp;gt;&lt;br /&gt;      &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;     &amp;lt;/Columns&amp;gt;&lt;br /&gt; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;Thank &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4978098914773997999?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4978098914773997999/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/hyperlinkinkgrid.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4978098914773997999'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4978098914773997999'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/hyperlinkinkgrid.html' title='HyperLinkink in Gridview'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-898180894594244346</id><published>2010-08-24T00:19:00.001-07:00</published><updated>2010-08-30T01:13:31.235-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to do?'/><title type='text'>How To Use Ajax</title><content type='html'>Hi....&lt;br /&gt;you can start with vs2008..&lt;br /&gt;1.just download ajaxcontrolkit.dll &lt;br /&gt;2.copy this dll in your bin folder.&lt;br /&gt;3.add reference by right click on your website brouwse and add ajaxcontrolkit.dll&lt;br /&gt;4.add a new tab in your tolbox right click on toolbox add new tab and load aajax controll from bin folder.&lt;br /&gt;5.now can find all ajax control in your tolbox ready for use.&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-898180894594244346?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/898180894594244346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-use-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/898180894594244346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/898180894594244346'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-use-ajax.html' title='How To Use Ajax'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2555705258008821567</id><published>2010-08-24T00:18:00.001-07:00</published><updated>2010-08-30T08:43:24.130-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>GridView ScrollBar</title><content type='html'>&lt;span style="font-weight:bold;"&gt;How to make scrollable gridview.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;div style="overflow-y: scroll; height: 200px"&amp;gt;&lt;br /&gt;  &amp;lt;asp:GridView ID="GridView1" runat="server" Font-Size="12px" BackColor="#FFFFFF"&lt;br /&gt;    GridLines="Both" CellPadding="4" Width="560"&amp;gt;&lt;br /&gt;  &amp;lt;HeaderStyle BackColor="#EDEDED" Height="26px" /&amp;gt;&lt;br /&gt;  &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&amp;lt;/div&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2555705258008821567?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2555705258008821567/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-scrollbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2555705258008821567'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2555705258008821567'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-scrollbar.html' title='GridView ScrollBar'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6461640207553263830</id><published>2010-08-24T00:16:00.001-07:00</published><updated>2010-09-08T09:44:32.663-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Add new row using GridView footer column</title><content type='html'>Adding new record in database from Gridview footer row&lt;br /&gt;&lt;br /&gt;Abstract: &lt;br /&gt;Here we will discuss about to add new recored in database using Gridview footer column.&lt;br /&gt;Just drag and drop a gridview in your page and follow the below code.This code in three tier application&lt;br /&gt;so i am writing here only front end code.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; &amp;lt;asp:GridView ID="gvStudentDetail" runat="server" DataKeyNames="StudentDetailId" AllowPaging="True" PageSize="12"&lt;br /&gt;    AutoGenerateColumns="False" OnPageIndexChanging="gvStudentDetail_PageIndexChanging"&lt;br /&gt;    OnRowDataBound="gvStudentDetail_RowDataBound" TabIndex="2" Width="697px" OnRowCancelingEdit="gvStudentDetail_RowCancelingEdit"&lt;br /&gt;    OnRowEditing="gvStudentDetail_RowEditing" OnRowUpdating="gvStudentDetail_RowUpdating"&lt;br /&gt;    ShowFooter="True" OnRowCommand="gvStudentDetail_RowCommand" OnRowDeleting="gvStudentDetail_RowDeleting"&gt;&lt;br /&gt;    &amp;lt;Columns&amp;gt;&lt;br /&gt; &amp;lt;asp:TemplateField HeaderText="Sr. No"&amp;gt;&lt;br /&gt;     &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:Label ID="lblSrNo" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;     &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;asp:TemplateField HeaderText="StudentDetailId" Visible="False"&amp;gt;&lt;br /&gt;     &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:Label ID="lblStudentDetailId" runat="server" Text='&amp;lt;%# Bind("StudentDetailId") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;     &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:Label ID="lblFooterStudentDetailId" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;     &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;asp:TemplateField HeaderText="StudentDetail"&amp;gt;&lt;br /&gt;     &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:Label ID="lblStudentDetail" runat="server" Text='&amp;lt;%# Bind("StudentDetail") %&amp;gt;'&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;     &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:TextBox ID="txtStudentDetail" runat="server" Text='&amp;lt;%# Bind("StudentDetail") %&amp;gt;'&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;     &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:TextBox ID="txtNewStudentDetail" runat="server" Visible="false"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;     &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;asp:TemplateField HeaderText="Edit"&amp;gt;&lt;br /&gt;     &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="ImgYes" runat="server" ImageUrl="~/Image/image_edit.png" CommandName="Edit" /&amp;gt;&lt;br /&gt;     &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"&lt;br /&gt;      ImageUrl="~/Image/imageupdate.png" Text="Update" /&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"&lt;br /&gt;      ImageUrl="~/Image/imagecancel.png" Text="Cancel" /&amp;gt;&lt;br /&gt;     &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;     &amp;lt;FooterTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="ButtonAdd" runat="server" ImageUrl="~/Image/imagerow_add.png" CommandName="AddNew"&lt;br /&gt;      ToolTip="Add New Record" /&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="lbtnAdd" runat="server" CausesValidation="True" CommandName="Add"&lt;br /&gt;      ImageUrl="~/Image/imageadd.png" Visible="false" Text="Add" /&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="lbtnCancel" runat="server" CausesValidation="False" CommandName="Cancel"&lt;br /&gt;      ImageUrl="~/Image/imagecancel.png" Visible="false" Text="Cancel" /&amp;gt;&lt;br /&gt;     &amp;lt;/FooterTemplate&amp;gt;&lt;br /&gt; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt; &amp;lt;asp:TemplateField HeaderText="Delete"&amp;gt;&lt;br /&gt;     &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;asp:ImageButton ID="ImgDelete" runat="server" ImageUrl="~/Image/image_delete.png"&lt;br /&gt;      CommandName="Delete" /&amp;gt;&lt;br /&gt;     &amp;lt;/ItemTemplate&amp;gt;     &lt;br /&gt; &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;    &amp;lt;/Columns&amp;gt;&lt;br /&gt;&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;&lt;br /&gt;----------------------------------------------------------------------------------------&lt;br /&gt;protected void GridViewStudentDetail()&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            Ds = objStudentDetailBLL.GetData();&lt;br /&gt;            if (Ds.Tables[0].Rows.Count &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                gvStudentDetail.DataSource = Ds;&lt;br /&gt;                gvStudentDetail.DataBind();&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                ShowNoResultFound(Ds.Tables[0], gvStudentDetail);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            exceptionMessage.Text = ex.Message;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {   &lt;br /&gt;        if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;        {&lt;br /&gt;            Label lblSrNo = (Label)e.Row.FindControl("lblSrNo");&lt;br /&gt;            lblSrNo.Text = SrNo.ToString();&lt;br /&gt;            SrNo++;          &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        gvStudentDetail.PageIndex = e.NewPageIndex;&lt;br /&gt;        GridViewStudentDetail();&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowEditing(object sender, GridViewEditEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        StudentDetail.EditIndex = e.NewEditIndex;&lt;br /&gt;        GridViewStudentDetail();&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowUpdating(object sender, GridViewUpdateEventArgs e)&lt;br /&gt;    {     &lt;br /&gt;        &lt;br /&gt;        objStudentDetail.StudentDetailId = Convert.ToInt32(((Label)gvStudentDetail.Rows[e.RowIndex].FindControl("lblStudentDetailId")).Text);&lt;br /&gt;        objStudentDetail.StudentDetail = Convert.ToString(((TextBox)gvStudentDetail.Rows[e.RowIndex].FindControl("txtStudentDetail")).Text);      &lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            int intResultUpdate = objStudentDetailBLL.Update(objStudentDetailDetail);&lt;br /&gt;            if (intResultUpdate &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                exception.Text = "Record Updated Successfully !";&lt;br /&gt;                gvStudentDetail.EditIndex = -1;&lt;br /&gt;                GridViewStudentDetail();&lt;br /&gt;            }            &lt;br /&gt;        }&lt;br /&gt;        catch (Exception ee)&lt;br /&gt;        {&lt;br /&gt;            exception.Text = ee.Message.ToString();&lt;br /&gt;        }&lt;br /&gt;        finally&lt;br /&gt;        {&lt;br /&gt;            objStudentDetailBLL = null;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        gvStudentDetail.EditIndex = -1;&lt;br /&gt;        GridViewStudentDetail();&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowDeleting(object sender, GridViewDeleteEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;        objStudentDetail.StudentDetailId = (int)gvStudentDetail.DataKeys[e.RowIndex].Value;&lt;br /&gt;        int result = objStudentDetailBLL.Delete(objStudentDetailDetail);&lt;br /&gt;            if (result &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                exception.Text = "Record Deleted Successfully !";&lt;br /&gt;                gvStudentDetail.EditIndex = -1;&lt;br /&gt;                GridViewStudentDetail();&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        catch(Exception ex)&lt;br /&gt;        {&lt;br /&gt;            exceptionText = ex.Message.ToString();&lt;br /&gt;        &lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void gvStudentDetail_RowCommand(object sender, GridViewCommandEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        ImageButton lbtnAdd = (ImageButton)gvStudentDetail.FooterRow.FindControl("lbtnAdd");&lt;br /&gt;        ImageButton lbtnCancel = (ImageButton)gvStudentDetail.FooterRow.FindControl("lbtnCancel");&lt;br /&gt;        ImageButton ButtonAdd = (ImageButton)gvStudentDetail.FooterRow.FindControl("ButtonAdd");&lt;br /&gt;        ButtonAdd.Visible = false;&lt;br /&gt;&lt;br /&gt;        TextBox txtNewStudentDetail= (TextBox)gvStudentDetail.FooterRow.FindControl("txtNewStudentDetail");&lt;br /&gt;        txtNewStudentDetail.Visible = true;&lt;br /&gt;        lbtnCancel.Visible = true;&lt;br /&gt;        lbtnAdd.Visible = true;&lt;br /&gt;        &lt;br /&gt;        objStudentDetailDetail.StudentDetail = Convert.ToString(((TextBox)gvStudentDetailFooterRow.FindControl("txtNewStudentDetail")).Text);       &lt;br /&gt;&lt;br /&gt;        if (e.CommandName.Equals("Add"))&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (objStudentDetailDetail.StudentDetail == "")&lt;br /&gt;                {&lt;br /&gt;                    exceptionText = "Please Enter the StudentDetail!!";&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    int intResultUpdate = objStudentDetailBLL.Insert(objStudentDetail);&lt;br /&gt;                    if (intResultUpdate &gt; 0)&lt;br /&gt;                    {&lt;br /&gt;                        exception.Text = "Record Added Successfully !";&lt;br /&gt;                        StudentDetail.EditIndex = -1;&lt;br /&gt;                        GridViewStudentDetail();&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ee)&lt;br /&gt;            {&lt;br /&gt;                exceptionMessage.Text = ee.Message.ToString();&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                objStudentDetailBLL = null;&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6461640207553263830?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6461640207553263830/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/add-new-row-using-gridview-footer.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6461640207553263830'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6461640207553263830'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/add-new-row-using-gridview-footer.html' title='Add new row using GridView footer column'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3387303251886889907</id><published>2010-08-23T23:04:00.001-07:00</published><updated>2010-09-04T23:55:20.463-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>AJAX Accordian Example</title><content type='html'>&amp;lt;ajaxToolkit:Accordion ID="acdContactInfo" runat="server" SelectedIndex="0" FadeTransitions="true"&lt;br /&gt;    TransitionDuration="300" HeaderCssClass="accordHeader" ContentCssClass="accordionContent"&lt;br /&gt;    HeaderSelectedCssClass="accordHeaderSelected"&amp;gt;&lt;br /&gt;    &amp;lt;Panes&amp;gt;&lt;br /&gt; &amp;lt;ajaxToolkit:AccordionPane ID="empfirstAdd" runat="server" Width="100%"&amp;gt;&lt;br /&gt;     &amp;lt;Header&amp;gt;&amp;gt;&lt;br /&gt;  First Address &amp;lt;/Header&amp;gt;&lt;br /&gt;     &amp;lt;Content&amp;gt;&lt;br /&gt;  &amp;lt;table&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td colspan="4" style="text-align: left; height: 22px;"&amp;gt;&lt;br /&gt;       &amp;lt;strong&gt;&amp;lt;span style="color: #999999"&gt;Present Address Details&amp;lt;/span&amp;gt;&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 137px; text-align: left; height: 22px;"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="text-align: left; height: 22px; width: 10px;"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; height: 22px; text-align: left"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 187px; text-align: left; height: 22px;"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 204px; text-align: right; vertical-align: middle;" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;strong&gt;Address&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px" valign="top"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td rowspan="3" style="width: 133px; text-align: left" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;asp:TextBox ID="txtFAddress" runat="server" Height="53px" MaxLength="200"&lt;br /&gt;    TextMode="MultiLine" Width="200px"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 137px; text-align: right; vertical-align: middle; height: 19px;"&lt;br /&gt;       valign="to"&amp;gt;&lt;br /&gt;       &amp;lt;strong&amp;gt;Country&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; text-align: center; vertical-align: middle;" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="vertical-align: middle; width: 10px; text-align: center" valign="top"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 187px; text-align: left" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;asp:UpdatePanel ID="UpdatePanel1" runat="server"&amp;gt;&lt;br /&gt;    &amp;lt;ContentTemplate&amp;gt;&lt;br /&gt;        &amp;lt;asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" DataTextField="CountryName"&lt;br /&gt;     DataValueField="CountryId" Height="20px" OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged"&lt;br /&gt;     Width="144px"&amp;gt;&lt;br /&gt;     &amp;lt;asp:ListItem Text="&amp;lt;Select Country&amp;gt;" Value="0"&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;        &amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;    &amp;lt;/ContentTemplate&amp;gt;&lt;br /&gt;       &amp;lt;/asp:UpdatePanel&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 204px; text-align: left" valign="top"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px" valign="top"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px" valign="top"&amp;gt;&lt;br /&gt;       &amp;#160;&amp;#160;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 137px; text-align: right; vertical-align: middle; height: 19px;"&lt;br /&gt;       valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;strong&amp;gt;State&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; text-align: center; vertical-align: middle;" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="vertical-align: middle; width: 10px; text-align: center" valign="top"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 187px; text-align: left" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;asp:UpdatePanel ID="UpdatePanel2" runat="server"&amp;gt;&lt;br /&gt;    &amp;lt;ContentTemplate&amp;gt;&lt;br /&gt;        &amp;lt;asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True" DataTextField="StateName"&lt;br /&gt;     DataValueField="StateId" Height="20px" OnSelectedIndexChanged="ddlState_SelectedIndexChanged"&lt;br /&gt;     Width="144px"&amp;gt;&lt;br /&gt;     &amp;lt;asp:ListItem Text="&amp;lt;Select State&amp;gt;" Value="0"&amp;gt;&amp;lt;/asp:ListItem&amp;gt;&lt;br /&gt;        &amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;    &amp;lt;/ContentTemplate&amp;gt;&lt;br /&gt;       &amp;lt;/asp:UpdatePanel&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 204px; text-align: left; height: 19px;" valign="top"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px; height: 19px;" valign="top"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px; height: 19px;" valign="top"&amp;gt;&lt;br /&gt;       &amp;#160;&amp;#160;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 137px; text-align: right; vertical-align: middle; height: 19px;"&lt;br /&gt;       valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;strong&amp;gt;City&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; text-align: center; vertical-align: middle; height: 19px;"&lt;br /&gt;       valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="vertical-align: middle; width: 10px; height: 19px; text-align: center"&lt;br /&gt;       valign="top"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 200px; text-align: left; height: 19px;" valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;asp:DropDownList ID="ddlCity" runat="server" DataTextField="CityName" DataValueField="CityId"&lt;br /&gt;    Height="20px" Width="150px"&amp;gt;&lt;br /&gt;       &amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;  &amp;lt;/table&amp;gt;&lt;br /&gt;     &amp;lt;/Content&amp;gt;&lt;br /&gt; &amp;lt;/ajaxToolkit:AccordionPane&amp;gt;&lt;br /&gt; &amp;lt;ajaxToolkit:AccordionPane ID="AccPaneEmpSecAdd" runat="server" Width="100%"&amp;gt;&lt;br /&gt;     &amp;lt;Header&amp;gt;&lt;br /&gt;  Second Add&amp;lt;/Header&amp;gt;&lt;br /&gt;     &amp;lt;Content&amp;gt;&lt;br /&gt;  &amp;lt;table&amp;gt;&lt;br /&gt;      &amp;lt;tr&amp;gt;&lt;br /&gt;   &amp;lt;td align="left" style="width: 204px; height: 16px; vertical-align: middle; text-align: right;"&amp;gt;&lt;br /&gt;       &amp;lt;strong&amp;gt;Name&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="height: 16px; width: 2px;"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 3px; height: 16px"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="color: #000000; height: 24px" align="left"&amp;gt;&lt;br /&gt;       &amp;lt;asp:TextBox ID="txtContName" runat="server" MaxLength="50" Width="188px"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="height: 19px; text-align: right; vertical-align: middle;"&amp;gt;&lt;br /&gt;       &amp;lt;strong&amp;gt;Relation&amp;lt;/strong&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; height: 16px; text-align: left"&amp;gt;&lt;br /&gt;       &amp;lt;span style="color: #ff3333"&amp;gt;*&amp;lt;/span&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 10px; height: 16px; text-align: left"&amp;gt;&lt;br /&gt;       :&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td align="left" style="color: #000000; height: 24px"&amp;gt;&lt;br /&gt;       &amp;lt;asp:DropDownList ID="ddlRelation" runat="server" Width="144px" DataTextField="Relation"&lt;br /&gt;    DataValueField="RelationId" Height="20px"&amp;gt;&lt;br /&gt;       &amp;lt;/asp:DropDownList&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;td style="width: 24px"&amp;gt;&lt;br /&gt;   &amp;lt;/td&amp;gt;&lt;br /&gt;      &amp;lt;/tr&amp;gt;&lt;br /&gt;  &amp;lt;/table&amp;gt;&lt;br /&gt;     &amp;lt;/Content&amp;gt;&lt;br /&gt; &amp;lt;/ajaxToolkit:AccordionPane&amp;gt;&lt;br /&gt;    &amp;lt;/Panes&amp;gt;&lt;br /&gt;&amp;lt;/ajaxToolkit:Accordion&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3387303251886889907?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3387303251886889907/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/ajax-accordian-example.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3387303251886889907'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3387303251886889907'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/ajax-accordian-example.html' title='AJAX Accordian Example'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-101241770714977507</id><published>2010-08-23T05:53:00.001-07:00</published><updated>2010-08-23T09:43:18.418-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Simple GridView Bind code</title><content type='html'>&amp;lt;asp:GridView ID="GridView1" runat="server" &lt;br /&gt;AllowPaging="True"&lt;br /&gt;AutoGenerateColumns="False"&lt;br /&gt;OnPageIndexChanging="GridView1_PageIndexChanging"&lt;br /&gt;OnRowDataBound="GridView1_RowDataBound"&lt;br /&gt;PageSize="10" &lt;br /&gt;Width="733px"&lt;br /&gt;TabIndex="2";&amp;gt&lt;br /&gt;&amp;lt;Columns;&amp;gt&lt;br /&gt;     &amp;lt;asp:BoundField HeaderText="Sr. No";&amp;gt&lt;br /&gt;   &amp;lt;ItemStyle HorizontalAlign="Center" /;&amp;gt&lt;br /&gt;     &amp;lt;/asp:BoundField;&amp;gt&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="CityId" Visible="False";&amp;gt&lt;br /&gt;       &amp;lt;EditItemTemplate;&amp;gt&lt;br /&gt;      &amp;lt;asp:TextBox ID="TextBox1" runat="server" Text='&amp;lt;%# Bind("CityId") %&gt;'&gt;&amp;lt;/asp:TextBox;&amp;gt&lt;br /&gt;        &amp;lt;/EditItemTemplate;&amp;gt&lt;br /&gt;        &amp;lt;ItemTemplate;&amp;gt&lt;br /&gt;       &amp;lt;asp:Label ID="lblCityId" runat="server" Text='&lt;%# Bind("CityId") %;&amp;gt';&amp;gt&amp;lt;/asp:Label;&amp;gt&lt;br /&gt;        &amp;lt;/ItemTemplate;&amp;gt&lt;br /&gt;    &amp;lt;/asp:TemplateField;&amp;gt&lt;br /&gt;    &amp;lt;asp:BoundField DataField="CountryName" HeaderText="Country" /;&amp;gt&lt;br /&gt;    &amp;lt;asp:BoundField DataField="StateName" HeaderText="State" /;&amp;gt&lt;br /&gt;&amp;lt;/Columns;&amp;gt&lt;br /&gt;  &lt;/asp:GridView&gt;&lt;br /&gt;&lt;br /&gt;CS code...&lt;br /&gt;protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;        {&lt;br /&gt;            e.Row.Cells[0].Text = Convert.ToString(GridView1.PageIndex * GridView1.PageSize + SrNo);&lt;br /&gt;            SrNo++;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;public void GridViewBind()&lt;br /&gt;    {&lt;br /&gt;        SqlConnection conn = new SqlConnection(connectionString);&lt;br /&gt;        Ds = SqlHelper.ExecuteDataset(myconn, "usp_CityMaster");&lt;br /&gt;        GridView1.DataSource = Ds;&lt;br /&gt;        GridView1.DataBind();&lt;br /&gt;    }&lt;br /&gt; protected void gv_PageIndexChanging(object sender, GridViewPageEventArgs e)&lt;br /&gt;    {&lt;br /&gt;        GridView1.PageIndex = e.NewPageIndex;&lt;br /&gt;        CityBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards &lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-101241770714977507?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/101241770714977507/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/simple-gridview-bind-code.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/101241770714977507'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/101241770714977507'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/simple-gridview-bind-code.html' title='Simple GridView Bind code'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1705519605812167144</id><published>2010-08-23T05:52:00.002-07:00</published><updated>2010-09-04T23:29:30.503-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>GridView find control</title><content type='html'>protected void ddlQty_SelectedIndexChanged(object sender, EventArgs e)   &lt;br /&gt;     {   &lt;br /&gt;         GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent;   &lt;br /&gt;         DropDownList ddlQty = (DropDownList)gr.FindControl("ddlQty");   &lt;br /&gt;         if (ddlQty != null)   &lt;br /&gt;         {   &lt;br /&gt;                &lt;br /&gt;                 Label lblPrice = (Label)gr.FindControl("lblPrice");   &lt;br /&gt;                 Label lblOriginalPrice = (Label)gr.FindControl("lblOriginalPrice");   &lt;br /&gt;                 int price = Convert.ToInt32(lblOriginalPrice.Text);   &lt;br /&gt;                 int NewPrice = price * Convert.ToInt16(ddlQty.SelectedValue);   &lt;br /&gt;                 lblPrice.Text = Convert.ToString(NewPrice);     &lt;br /&gt;              &lt;br /&gt;         }   &lt;br /&gt;         GridViewRow gr = (GridViewRow)((DataControlFieldCell)((DropDownList)sender).Parent).Parent;   &lt;br /&gt;         DropDownList ddlQty = (DropDownList)gr.FindControl("ddlQty");   &lt;br /&gt;         if (ddlQty != null)   &lt;br /&gt;         {   &lt;br /&gt;                &lt;br /&gt;                 Label lblPrice = (Label)gr.FindControl("lblPrice");   &lt;br /&gt;                 Label lblOriginalPrice = (Label)gr.FindControl("lblOriginalPrice");   &lt;br /&gt;                 int price = Convert.ToInt32(lblOriginalPrice.Text);   &lt;br /&gt;                 int NewPrice = price * Convert.ToInt16(ddlQty.SelectedValue);   &lt;br /&gt;                 lblPrice.Text = Convert.ToString(NewPrice);     &lt;br /&gt;         }&lt;br /&gt;     }&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1705519605812167144?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1705519605812167144/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-find-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1705519605812167144'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1705519605812167144'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/gridview-find-control.html' title='GridView find control'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5724775480036779291</id><published>2010-08-23T05:51:00.003-07:00</published><updated>2010-09-04T23:37:11.932-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Enable textbox in gridview on click checkbox</title><content type='html'>JavaScript&lt;br /&gt;&lt;br /&gt;function callonclick(obj)&lt;br /&gt;   {&lt;br /&gt;    &lt;br /&gt;     var sdt = obj.split("_");      &lt;br /&gt;     var chkDeny=document.getElementById('ctl00_ContentPlaceHolder1_gv_'+sdt[3]+'_chkDeny');     &lt;br /&gt;     var txtReason=document.getElementById('ctl00_ContentPlaceHolder1_gv_'+sdt[3]+'_txtReason');     &lt;br /&gt;     if(chkDeny.checked)&lt;br /&gt;     {&lt;br /&gt;     txtReason.value="";    &lt;br /&gt;     txtReason.disabled =false;        &lt;br /&gt;     }&lt;br /&gt;     else&lt;br /&gt;     {&lt;br /&gt;     txtReason.value="Enter Reason";&lt;br /&gt;     txtReason.disabled =true;&lt;br /&gt;     &lt;br /&gt;     }&lt;br /&gt;}   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On Aspx page&lt;br /&gt;&lt;br /&gt;    &amp;lt;asp:TemplateField HeaderText="Deny"&amp;gt;&lt;br /&gt;  &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:TextBox ID="TextBox2" runat="server"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;  &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" /&amp;gt;&lt;br /&gt;  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:CheckBox ID="chkDeny" runat="server" onclick="callonclick(this.id);" /&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" Width="30px" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;     &amp;lt;asp:TemplateField HeaderText="Reason"&amp;gt;&lt;br /&gt;  &amp;lt;EditItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;asp:TextBox ID="txtsan" runat="server" TextMode="MultiLine" Width="80px"&amp;gt;&amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;  &amp;lt;/EditItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;      &amp;lt;table&amp;gt;&lt;br /&gt;   &amp;lt;tr&amp;gt;&lt;br /&gt;       &amp;lt;td valign="top"&amp;gt;&lt;br /&gt;       &amp;lt;/td&amp;gt;&lt;br /&gt;       &amp;lt;td&amp;gt;&lt;br /&gt;    &amp;lt;asp:TextBox ID="txtReason" runat="server" Height="40px" TextMode="MultiLine" Width="250px" Enabled="false"&gt;Enter Reason&amp;lt;/asp:TextBox&amp;gt;&amp;lt;/td&amp;gt;&lt;br /&gt;   &amp;lt;/tr&amp;gt;&lt;br /&gt;      &amp;lt;/table&amp;gt;&lt;br /&gt;      &amp;lt;span style="font-size: 7pt"&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt;  &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;  &amp;lt;ItemStyle HorizontalAlign="Center" /&amp;gt;&lt;br /&gt;     &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;==========================&lt;br /&gt;Nother way Using cs code..&lt;br /&gt;&lt;br /&gt;javascript&lt;br /&gt;&lt;br /&gt;function StatusGridTextBox(txtReason)&lt;br /&gt;       {&lt;br /&gt;            document.getElementById(txtReason).disabled = !document.getElementById(txtReason).disabled;&lt;br /&gt;        }   &lt;br /&gt;&lt;br /&gt;on cs code&lt;br /&gt;&lt;br /&gt;protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {&lt;br /&gt;       &lt;br /&gt;       &lt;br /&gt;        if ((e.Row.RowType == DataControlRowType.DataRow))&lt;br /&gt;        {&lt;br /&gt;            ((CheckBox)e.Row.FindControl("chkDeny")).Attributes.Add("onclick", "javascript:StatusGridTextBox('" + ((TextBox)e.Row.FindControl("txtReason")).ClientID + "')");&lt;br /&gt;        } &lt;br /&gt;        &lt;br /&gt;    } &lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5724775480036779291?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5724775480036779291/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/enable-textbox-in-gridview-on-click.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5724775480036779291'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5724775480036779291'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/enable-textbox-in-gridview-on-click.html' title='Enable textbox in gridview on click checkbox'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-670866177564001172</id><published>2010-08-23T05:51:00.001-07:00</published><updated>2010-08-30T01:13:46.917-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='How to do?'/><title type='text'>Deployment</title><content type='html'>1.Right click your website and click on Publish website.All compiles files are ready for deployment.&lt;br /&gt;2.Create a backup for database whichever you are using and restore it on production server.&lt;br /&gt;3.Go to server using ftp or filezila copy all compiles file on server.&lt;br /&gt;4.Open Webconfig and change the connection string according to your Database name and server.&lt;br /&gt;5.Create a virtual directory for this website.&lt;br /&gt;6.Your website is ready.&lt;br /&gt;7.Test website http://192.163.0.234(ServerName)/VDName/Login.aspx&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-670866177564001172?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/670866177564001172/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/deployment.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/670866177564001172'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/670866177564001172'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/deployment.html' title='Deployment'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4732954633523270677</id><published>2010-08-23T05:49:00.001-07:00</published><updated>2010-09-01T09:18:06.199-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>DataReader</title><content type='html'>A DataReader is a read-only forward-only way of reading data. It is quiet fast when compared to fetching data using a DataSet.&lt;br /&gt;Some important point:&lt;br /&gt;Read-only access&lt;br /&gt;Supports a single table based on a single SQL query of one database&lt;br /&gt;Connected mode&lt;br /&gt;Bind to a single control&lt;br /&gt;Forward-only scanning of data&lt;br /&gt;Faster access to data&lt;br /&gt;Lightweight object with very little overhead&lt;br /&gt;Must be manually coded&lt;br /&gt;&lt;br /&gt;Code Sample:&lt;br /&gt; SqlConnection myconn = new SqlConnection(connString);&lt;br /&gt; SqlCommand mycomm = new SqlCommand("select * from emp", myconn);&lt;br /&gt; mycomm.Connection.Open();&lt;br /&gt; SqlDataReader dr =  &lt;br /&gt;     mycomm.ExecuteReader(CommandBehavior.CloseConnection);&lt;br /&gt; while(dr.Read())  &lt;br /&gt; {&lt;br /&gt;   Console.WriteLined(r.GetString(0));&lt;br /&gt; }&lt;br /&gt; dr.Close();&lt;br /&gt; myconn.Close();&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4732954633523270677?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4732954633523270677/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/datareader.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4732954633523270677'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4732954633523270677'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/datareader.html' title='DataReader'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-581935614234375841</id><published>2010-08-23T05:47:00.003-07:00</published><updated>2010-08-30T01:06:55.128-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS StyleSheet'/><title type='text'>CSS For FieldSet control in asp.net</title><content type='html'>.fldset&lt;br /&gt;{&lt;br /&gt;  border: solid 1px #A8A8A8;&lt;br /&gt;  background-color:#FCFCFC; &lt;br /&gt;  display:inline; &lt;br /&gt;}&lt;br /&gt;.fldsetlegend&lt;br /&gt;{&lt;br /&gt; font-size:11px;&lt;br /&gt; background-color: #56458C;&lt;br /&gt; color:#FCFCFC;&lt;br /&gt; font-weight:bold;&lt;br /&gt; font-variant:small-caps;&lt;br /&gt; padding: 0px 8px 2px 8px;&lt;br /&gt; margin: 2px 0px 10px 0px; &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-581935614234375841?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/581935614234375841/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/css-for-fieldset-control-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/581935614234375841'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/581935614234375841'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/css-for-fieldset-control-in-aspnet.html' title='CSS For FieldSet control in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8835788057670810218</id><published>2010-08-23T05:47:00.001-07:00</published><updated>2010-08-30T01:05:04.852-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='CSS StyleSheet'/><title type='text'>CSS For AJAX Tab</title><content type='html'>.AJAXTab_Theme .tab_header &lt;br /&gt;{&lt;br /&gt;    font-family:"Helvetica Neue", Arial, Sans-Serif;&lt;br /&gt;    background:url(/PNG/Light-menu.png) repeat-x bottom;&lt;br /&gt;    height:20PX ;&lt;br /&gt;    font-size:12px; &lt;br /&gt;    display:block;&lt;br /&gt;    }&lt;br /&gt;    .AJAXTab_Theme .tab_header .tab_outer&lt;br /&gt;     {&lt;br /&gt;      background:url(/Images/Tab/tab.png) no-repeat left top;&lt;br /&gt;      border-color:#222;&lt;br /&gt;      color:#222;&lt;br /&gt;      padding-left:10px;&lt;br /&gt;      margin-right:3px;&lt;br /&gt;      }&lt;br /&gt;      .AJAXTab_Theme .tab_header .ajax__tab_inner &lt;br /&gt;      {&lt;br /&gt;       background:url(PNG/Dark-menu.png) no-repeat right top;&lt;br /&gt;       border-color:#666;&lt;br /&gt;       color:#0067CA;&lt;br /&gt;       font:bold 10pt verdana;&lt;br /&gt;       padding:3px 10px 2px 0px;&lt;br /&gt;      }&lt;br /&gt;      .AJAXTab_Theme .ajax__tab_hover .ajax__tab_inner &lt;br /&gt;      {&lt;br /&gt;       color:#B80200;&lt;br /&gt;       font:bold 10pt verdana;&lt;br /&gt;      }&lt;br /&gt;      .AJAXTab_Theme .ajax__tab_active .tab_outer &lt;br /&gt;      {&lt;br /&gt;       background:url(PNG/Dark-menu.png) no-repeat 0pt -40px;&lt;br /&gt;       border-bottom-color:#ffffff;&lt;br /&gt;      }&lt;br /&gt;      .AJAXTab_Theme .tab_active .tab_inner &lt;br /&gt;      {&lt;br /&gt;        background:url(PNG/Dark-menu.png) no-repeat right -40px;&lt;br /&gt;        color:#B80200;&lt;br /&gt;        font:bold 10pt verdana;&lt;br /&gt;        border-color:#333&lt;br /&gt;     }&lt;br /&gt;     .AJAXTab_Theme .tab_body &lt;br /&gt;     {&lt;br /&gt;      font-family:verdana,tahoma,helvetica;&lt;br /&gt;      font-size:10pt;&lt;br /&gt;      padding:8px;&lt;br /&gt;      background-color:#ffffff;&lt;br /&gt;      border:solid 1px #d7d7d7;&lt;br /&gt;      border-top-width:0;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thank &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8835788057670810218?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8835788057670810218/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/css-for-ajax-tab.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8835788057670810218'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8835788057670810218'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/css-for-ajax-tab.html' title='CSS For AJAX Tab'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3566353566244712339</id><published>2010-08-23T05:46:00.001-07:00</published><updated>2010-09-08T09:48:26.876-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Create pdf from datatable</title><content type='html'>How to create pdf from datatable in asp.net c#.&lt;br /&gt;Solution is given below.&lt;br /&gt;&lt;br /&gt;public void ExportToPdf(DataTable myDataTable)&lt;br /&gt;    {        &lt;br /&gt;        Document pdfDoc = new Document(PageSize.A4, 10, 10, 10, 10);&lt;br /&gt;        try&lt;br /&gt;        {&lt;br /&gt;            PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);&lt;br /&gt;            pdfDoc.Open();&lt;br /&gt;            Chunk c = new Chunk("" + System.Web.HttpContext.Current.Session["CompanyName"] + "", FontFactory.GetFont("Verdana", 11));&lt;br /&gt;            Paragraph p = new Paragraph();&lt;br /&gt;            p.Alignment = Element.ALIGN_CENTER;&lt;br /&gt;            p.Add(c);&lt;br /&gt;            pdfDoc.Add(p);&lt;br /&gt;&lt;br /&gt;            string clientLogo = System.Web.HttpContext.Current.Session["CompanyName"].ToString();&lt;br /&gt;            clientLogo = clientLogo.Replace(" ", "");&lt;br /&gt;            string clogo = clientLogo + ".jpg";&lt;br /&gt;&lt;br /&gt;            string imageFilePath = System.Web.HttpContext.Current.Server.MapPath("../ClientLogo/" + clogo + "");&lt;br /&gt;            iTextSharp.text.Image jpg = iTextSharp.text.Image.GetInstance(imageFilePath);&lt;br /&gt;            //Resize image depend upon your need  &lt;br /&gt;            jpg.ScaleToFit(80f, 60f);&lt;br /&gt;            //Give space before image &lt;br /&gt;            jpg.SpacingBefore = 0f;&lt;br /&gt;            //Give some space after the image  &lt;br /&gt;            jpg.SpacingAfter = 1f;&lt;br /&gt;            jpg.Alignment = Element.HEADER;&lt;br /&gt;            pdfDoc.Add(jpg);&lt;br /&gt;&lt;br /&gt;            Font font8 = FontFactory.GetFont("ARIAL", 7);&lt;br /&gt;            DataTable dt = myDataTable;&lt;br /&gt;           if (dt != null)&lt;br /&gt;            {&lt;br /&gt;                //Craete instance of the pdf table and set the number of column in that table&lt;br /&gt;                PdfPTable PdfTable = new PdfPTable(dt.Columns.Count);&lt;br /&gt;                PdfPCell PdfPCell = null;&lt;br /&gt;                &lt;br /&gt;                for (int rows = 0; rows &lt; dt.Rows.Count; rows++)&lt;br /&gt;                {&lt;br /&gt;                    for (int column = 0; column &lt; dt.Columns.Count; column++)&lt;br /&gt;                    {&lt;br /&gt;                        PdfPCell = new PdfPCell(new Phrase(new Chunk(dt.Rows[rows][column].ToString(), font8)));&lt;br /&gt;                        PdfTable.AddCell(PdfPCell);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;                //PdfTable.SpacingBefore = 15f; // Give some space after the text or it may overlap the table                    &lt;br /&gt;                pdfDoc.Add(PdfTable); // add pdf table to the document &lt;br /&gt;            }&lt;br /&gt;            pdfDoc.Close();&lt;br /&gt;            Response.ContentType = "application/pdf";&lt;br /&gt;            Response.AddHeader("content-disposition", "attachment; filename= SampleExport.pdf");&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(pdfDoc);&lt;br /&gt;          &lt;br /&gt;            Response.Flush();&lt;br /&gt;            Response.End();&lt;br /&gt;            //HttpContext.Current.ApplicationInstance.CompleteRequest();&lt;br /&gt;        }&lt;br /&gt;        catch (DocumentException de)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(de.Message);&lt;br /&gt;        }&lt;br /&gt;        catch (IOException ioEx)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(ioEx.Message);&lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            System.Web.HttpContext.Current.Response.Write(ex.Message);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3566353566244712339?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3566353566244712339/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/create-pdf-from-datatable.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3566353566244712339'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3566353566244712339'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/create-pdf-from-datatable.html' title='Create pdf from datatable'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6489865775944521791</id><published>2010-08-23T05:45:00.002-07:00</published><updated>2010-08-29T07:59:30.436-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Create autogenerate serial number in Gridview</title><content type='html'>Auto Generate Serial Number In Gridview&lt;br /&gt;&lt;br /&gt;The Given code auto generate serial number with page index changing.&lt;br /&gt;Generate Dynamic Serial Number in GridView is coommon task for many programmer&lt;br /&gt;&lt;br /&gt;Here i explain it in very simple way&lt;br /&gt;1: Drag GridView in you asp.net web page.&lt;br /&gt;2: Go to Gridview properties and Click on Columns than add Template Column.&lt;br /&gt;3:Code is given below&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:GridView ID="gv" runat="server" DataKeyNames="Id"&amp;gt;&lt;br /&gt;      &amp;lt;Columns&amp;gt;&lt;br /&gt;          &amp;lt;asp:TemplateField HeaderText="Sr. No"&amp;gt;&lt;br /&gt;               &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                   &amp;lt;asp:Label ID="lblSrNo" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;               &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;               &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;          &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;          &amp;lt;asp:TemplateField HeaderText="EmpName"&amp;gt;&lt;br /&gt;               &amp;lt;ItemTemplate&amp;gt;&lt;br /&gt;                   &amp;lt;asp:Label ID="lblEmpName" runat="server"&amp;gt;&amp;lt;/asp:Label&amp;gt;&lt;br /&gt;               &amp;lt;/ItemTemplate&amp;gt;&lt;br /&gt;               &amp;lt;ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;          &amp;lt;/asp:TemplateField&amp;gt;&lt;br /&gt;      &amp;lt;/Columns&amp;gt;&lt;br /&gt; &amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;.cs code&lt;br /&gt; protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;    {   &lt;br /&gt;        if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;        {&lt;br /&gt;            Label lblSrNo = (Label)e.Row.FindControl("lblSrNo");&lt;br /&gt;            lblSrNo.Text = SrNo.ToString();&lt;br /&gt;            SrNo++;&lt;br /&gt;            int pageNum = gv.PageIndex * gv.PageSize + Sr;&lt;br /&gt;                    e.Row.Cells[1].Text = pageNum.ToString();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6489865775944521791?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6489865775944521791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/create-autogenerate-serial-number-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6489865775944521791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6489865775944521791'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/create-autogenerate-serial-number-in.html' title='Create autogenerate serial number in Gridview'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8111843983350318312</id><published>2010-08-23T05:45:00.001-07:00</published><updated>2011-04-03T09:22:01.452-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>How to check Record Exist in table before insert</title><content type='html'>Here i am explain you check if record is not exist in database then insert otherwise update the table.&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE [dbo].[uspInst_Addupdate]&lt;br /&gt;( &lt;br /&gt; @InstId int,&lt;br /&gt; @Inst varchar(50),&lt;br /&gt;) &lt;br /&gt;AS&lt;br /&gt;BEGIN&lt;br /&gt;  IF @InstId=0&lt;br /&gt; BEGIN&lt;br /&gt;   IF NOT EXISTS(SELECT * FROM InstMaster WHERE Inst= @Inst)&lt;br /&gt;    INSERT INTO InstMaster(Inst) VALUES(@Inst)&lt;br /&gt; END        &lt;br /&gt;  ELSE &lt;br /&gt; BEGIN&lt;br /&gt;   UPDATE InstMaster&lt;br /&gt;   SET Inst= @Inst WHERE (Inst= @Inst)&lt;br /&gt; END&lt;br /&gt;END&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8111843983350318312?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8111843983350318312/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-check-record-exist-in-table-then.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8111843983350318312'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8111843983350318312'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-check-record-exist-in-table-then.html' title='How to check Record Exist in table before insert'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1138292509205326059</id><published>2010-08-23T05:44:00.001-07:00</published><updated>2010-08-27T21:44:09.880-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Change GridView RowColor</title><content type='html'>How to change gridview row color and use css class.&lt;br /&gt;Below code describe how to call css class at runtime for change the gridview row color.&lt;br /&gt;protected void gv_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;{&lt;br /&gt;  if (e.Row.RowType == DataControlRowType.DataRow)&lt;br /&gt;    {&lt;br /&gt;      string checkstatus= Convert.ToString(DataBinder.Eval(e.Row.DataItem,"checkstatus"));&lt;br /&gt;      if (checkstatus == "Pending")&lt;br /&gt; {&lt;br /&gt;  e.Row.Cells[0].BackColor="css class";&lt;br /&gt; }&lt;br /&gt; else&lt;br /&gt; {&lt;br /&gt; e.Row.Cells[0].BackColor="css class";&lt;br /&gt; }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1138292509205326059?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1138292509205326059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/change-gridview-rowcolor.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1138292509205326059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1138292509205326059'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/change-gridview-rowcolor.html' title='Change GridView RowColor'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-2415689601295799859</id><published>2010-08-23T05:31:00.001-07:00</published><updated>2010-08-27T21:48:20.705-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>How to change DateFormat</title><content type='html'>string[] str = txtIssuedOnVisa.Text.Trim().Split('/');&lt;br /&gt;string strIssuedOn = str[1].ToString() + "/" + str[0].ToString() + "/" + str[2].ToString();&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-2415689601295799859?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/2415689601295799859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-change-dateformat.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2415689601295799859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/2415689601295799859'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/how-to-change-dateformat.html' title='How to change DateFormat'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5283893528276720639</id><published>2010-08-23T05:30:00.001-07:00</published><updated>2010-08-23T09:43:18.419-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Cascading Dropdownlist</title><content type='html'>ASPX Page&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:DropDownList ID="ddlCountry" runat="server" AutoPostBack="True" DataTextField="CountryName"&lt;br /&gt;  DataValueField="CountryId"  OnSelectedIndexChanged="ddlCountry_SelectedIndexChanged";&amp;gt&lt;br /&gt;  &amp;lt;asp:ListItem Value="0" Text="&amp;lt;Select Country;&amp;gt";&amp;gt&amp;lt;/asp:ListItem;&amp;gt&lt;br /&gt;&amp;lt;/asp:DropDownList;&amp;gt&lt;br /&gt;&amp;lt;asp:DropDownList ID="ddlState" runat="server" AutoPostBack="True" DataTextField="StateName"&lt;br /&gt; DataValueField="StateId" OnSelectedIndexChanged="ddlState_SelectedIndexChanged";&amp;gt&lt;br /&gt;&amp;lt;/asp:DropDownList;&amp;gt&lt;br /&gt;&amp;lt;asp:DropDownList ID="ddlCity" runat="server" DataTextField="CityName" DataValueField="CityId";&amp;gt&lt;br /&gt;&amp;lt;/asp:DropDownList;&amp;gt&lt;br /&gt;&lt;br /&gt;CS Page&lt;br /&gt;&lt;br /&gt;if (!Page.IsPostBack)&lt;br /&gt;{&lt;br /&gt;            CountryBind();&lt;br /&gt;}&lt;br /&gt;protected void CountryBind()&lt;br /&gt;    {&lt;br /&gt;        string sqlQuery = "Select * from Country;&lt;br /&gt;&lt;br /&gt;        using (SqlConnection conn = new SqlConnection(conString))&lt;br /&gt;        {&lt;br /&gt;            conn.Open();&lt;br /&gt;            DataSet ds = new DataSet();&lt;br /&gt;            SqlDataAdapter da = new SqlDataAdapter(sqlQuery, conn);&lt;br /&gt;            da.Fill(ds);&lt;br /&gt;            ddlCountry.DataSource = ds;&lt;br /&gt;            ddlCountry.DataBind();&lt;br /&gt;            conn.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void StateBind()&lt;br /&gt;    {&lt;br /&gt;        string sqlQuery = "SELECT * FROM State " + " WHERE (CountryId = " + Convert.ToInt32(ddlCountry.SelectedValue) + " )";&lt;br /&gt;        using (SqlConnection conn = new SqlConnection(conString))&lt;br /&gt;        {&lt;br /&gt;            conn.Open();&lt;br /&gt;            DataSet ds = new DataSet();&lt;br /&gt;            SqlDataAdapter da = new SqlDataAdapter(sqlQuery, conn);&lt;br /&gt;            da.Fill(ds);&lt;br /&gt;            ddlState.DataSource = ds;&lt;br /&gt;            ddlState.DataBind();&lt;br /&gt;            conn.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;    protected void CityBind()&lt;br /&gt;    {&lt;br /&gt;        string sqlQuery = "SELECT * FROM City " + " WHERE (StateId = " + Convert.ToInt32(ddlState.SelectedValue) + " )";&lt;br /&gt;        using (SqlConnection conn = new SqlConnection(conString))&lt;br /&gt;        {&lt;br /&gt;            conn.Open();&lt;br /&gt;            DataSet ds = new DataSet();&lt;br /&gt;            SqlDataAdapter da = new SqlDataAdapter(sqlQuery, conn);&lt;br /&gt;            da.Fill(ds);&lt;br /&gt;            ddlCity.DataSource = ds;&lt;br /&gt;            ddlCity.DataBind();&lt;br /&gt;            conn.Close();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;protected void ddlCountry_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        StateBind();&lt;br /&gt;    }&lt;br /&gt;    protected void ddlState_SelectedIndexChanged(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        CityBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5283893528276720639?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5283893528276720639/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/cascading-dropdownlist.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5283893528276720639'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5283893528276720639'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/cascading-dropdownlist.html' title='Cascading Dropdownlist'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-7604684210815507086</id><published>2010-08-23T05:28:00.000-07:00</published><updated>2010-08-27T03:11:35.566-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Authentication And Authorization</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Authentication And Authorization&lt;/span&gt;&lt;br /&gt;Authentication is the process of identification and validation of a user's credentials. After the identity is authenticated,&lt;br /&gt;a process called authorization determines whether that identity has access to a particular resource.&lt;br /&gt;ASP.NET provides three ways to authenticate a user:&lt;br /&gt;Forms authentication&lt;br /&gt;Windows authentication&lt;br /&gt;Passport authentication&lt;br /&gt;&lt;br /&gt;Setting in web.config file given below&lt;br /&gt;&lt;br /&gt;Forms authentication&lt;br /&gt;&amp;lt;configuration&amp;gt; &lt;br /&gt;  &amp;lt;system.web&amp;gt; &lt;br /&gt;    &amp;lt;authentication mode="Forms"/&amp;gt; &lt;br /&gt;    &amp;lt;forms name="login"loginUrl="loginPage.aspx" /&amp;gt; &lt;br /&gt;    &amp;lt;authorization&amp;gt; &lt;br /&gt;        &amp;lt;deny users="?"/&amp;gt; &lt;br /&gt;    &amp;lt;/authorization&amp;gt; &lt;br /&gt;  &amp;lt;/system.web&amp;gt; &lt;br /&gt;&amp;lt;/configuration&amp;gt; &lt;br /&gt;&lt;br /&gt;Windows authentication&lt;br /&gt;&amp;lt;authentication mode="Windows"/&amp;gt; &lt;br /&gt;&amp;lt;authorization&amp;gt; &lt;br /&gt;&amp;lt;allow users ="*" /&amp;gt; &lt;br /&gt;&amp;lt;/authorization&amp;gt; &lt;br /&gt;&lt;br /&gt;Passport authentication &lt;br /&gt;&amp;lt;configuration&amp;gt; &lt;br /&gt;  &amp;lt;system.web&amp;gt; &lt;br /&gt;    &amp;lt;authenticationmode="Passport"&amp;gt; &lt;br /&gt;      &amp;lt;passportredirectUrl="loginPage.aspx" /&amp;gt; &lt;br /&gt;    &amp;lt;/authentication&amp;gt; &lt;br /&gt;    &amp;lt;authorization&amp;gt; &lt;br /&gt;      &amp;lt;deny users="?" /&amp;gt; &lt;br /&gt;    &amp;lt;/authorization&amp;gt; &lt;br /&gt;  &amp;lt;/system.web&amp;gt; &lt;br /&gt;&amp;lt;/configuration&amp;gt;&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-7604684210815507086?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/7604684210815507086/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/authentication-and-authorization.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7604684210815507086'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/7604684210815507086'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/authentication-and-authorization.html' title='Authentication And Authorization'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1932540399641136871</id><published>2010-08-14T03:55:00.000-07:00</published><updated>2010-08-27T03:14:58.827-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><title type='text'>Javascript date validation</title><content type='html'>function DateValid()&lt;br /&gt;{&lt;br /&gt;   var sDate = document.getElementById('').value;&lt;br /&gt;   var eDate = document.getElementById('').value;&lt;br /&gt;   var endDate = new Date(eDate );&lt;br /&gt;   var startDate= new Date(sDate );&lt;br /&gt;   if(sDate != '' &amp;amp;&amp;amp; eDate != '' &amp;amp;&amp;amp; startDate &gt; endDate )&lt;br /&gt;   {&lt;br /&gt;   alert("Start date should be greater than End  Date.");&lt;br /&gt;   return false;&lt;br /&gt;   }&lt;br /&gt;   if(sDate == eDate )&lt;br /&gt;   {&lt;br /&gt;   alert("Start date should be greater than End  Date.");&lt;br /&gt;   return false;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thanks &amp;amp; Regards&lt;br /&gt;&lt;span style="font-style: italic; color: rgb(51, 102, 255);"&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1932540399641136871?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1932540399641136871/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-date-validation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1932540399641136871'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1932540399641136871'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/javascript-date-validation.html' title='Javascript date validation'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5361341187177841615</id><published>2010-08-09T10:06:00.000-07:00</published><updated>2010-08-09T10:11:58.082-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>When Gridview has no record display empty grid at runtime</title><content type='html'>&lt;span id="ctl00_ContentPlaceHolder1_lblDescription"  style="color:DarkBlue;"&gt;&lt;span style="font-size:85%;"&gt;&lt;b&gt;When GridView(Add New Record) has no record display empty Grid at runtime.&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size:85%;"&gt;&lt;br /&gt;Some time when we adding new row in gridview footer column and there is no record in database,so what we can do?&lt;br /&gt;So we can disply message no record found and add new button show for adding new record.&lt;br /&gt;Here is solution display runtime empty gridview.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription"  style="color:DarkBlue;"&gt;&lt;pre&gt; private void ShowNoResultFound(DataSet ds,GridView gv)&lt;br /&gt;  {&lt;br /&gt;      DataTable dt = (DataTable)ds.Tables[0];&lt;br /&gt;      dt.Rows.Add(dt.NewRow());&lt;br /&gt;      gv.DataSource = dt;&lt;br /&gt;      gv.DataBind();&lt;br /&gt;      int TotalColumns = gv.Rows[0].Cells.Count;&lt;br /&gt;      gv.Rows[0].Cells.Clear();&lt;br /&gt;      gv.Rows[0].Cells.Add(new TableCell());&lt;br /&gt;      gv.Rows[0].Height = 0;&lt;br /&gt;      gv.Rows[0].Visible = false;&lt;br /&gt;  }&lt;/pre&gt;&lt;/span&gt;Thanks &amp;amp; Regards&lt;br /&gt;Santosh Singh&lt;br /&gt;&lt;span id="ctl00_ContentPlaceHolder1_lblDescription"  style="color:DarkBlue;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5361341187177841615?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5361341187177841615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/when-gridview-has-no-record-display.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5361341187177841615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5361341187177841615'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/when-gridview-has-no-record-display.html' title='When Gridview has no record display empty grid at runtime'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8716405441156064874</id><published>2010-08-04T09:29:00.000-07:00</published><updated>2010-08-09T10:04:17.342-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Session object in asp.net</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Session object:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Session object is used to store state specific information per client basis. It is specific to particular user.&lt;br /&gt;Session data persists for the duration of user session you can store session's data on web server in different ways.&lt;br /&gt;Session state can be configured using the &lt;session&gt; section in the application's web.config file.&lt;br /&gt;&lt;br /&gt;Session state in ASP.NET can be configured in different ways based on various parameters including scalability, maintainability and availability&lt;br /&gt;&lt;br /&gt;1.In process mode (in-memory)- State information is stored in memory of web server &lt;br /&gt;2.Out-of-process mode- session state is held in a process called aspnet_state.exe that runs as a windows service.  &lt;br /&gt;3.Database mode – session state is maintained on a SQL Server database.&lt;br /&gt;&lt;br /&gt;In process mode:&lt;br /&gt;This mode is useful for small applications which can be hosted on a single server. This model is most common and default method to store session specific information. Session data is stored in memory of local web server&lt;br /&gt;&lt;br /&gt;Configuration information:&lt;br /&gt;&lt;br /&gt;&lt;sessionstate mode="Inproc" sqlconnectionstring="data source=server;user id=freelance;password=freelance" cookieless="false" timeout="20"&gt;&lt;br /&gt;&lt;br /&gt;Advantages:&lt;br /&gt;     Fastest mode   &lt;br /&gt;     Simple configuration&lt;br /&gt;&lt;br /&gt;Disadvantages:&lt;br /&gt;     Session data will be lost if the worker process or application domain recycles &lt;br /&gt;     Not ideal for web gardens and web farms&lt;br /&gt;&lt;br /&gt;Out-of-process Session mode (state server mode):&lt;br /&gt;&lt;br /&gt;This mode is ideal for scalable and highly available applications. Session state is held in a process called aspnet_state.exe that runs as a windows service&lt;br /&gt;which listens on TCP port 42424 by default. You can invoke state service using services MMC snap-in or by running following net command from command line.&lt;br /&gt;&lt;br /&gt;Net start aspnet_state&lt;br /&gt;&lt;br /&gt;Configuration information:&lt;br /&gt;&lt;br /&gt;&lt;sessionstate mode="StateServer" stateconnectionstring="tcpip=127.0.0.1:42424" sqlconnectionstring="data source=127.0.0.1;user id=freelance; password=freelance" cookieless="false" timeout="20"&gt;                                                         &lt;br /&gt;&lt;br /&gt;Advantages:&lt;br /&gt;     Supports web farm and web garden configuration  &lt;br /&gt;     Session data is persisted across application domain recycles. This is achieved by using separate worker process for maintaining state&lt;br /&gt;Disadvantages:&lt;br /&gt;     Out-of-process mode provides slower access compared to In process &lt;br /&gt;     Requires serializing data&lt;br /&gt;&lt;br /&gt;SQL-Backed Session state:&lt;br /&gt;ASP.NET sessions can also be stored in a SQL Server database. Storing sessions in SQL Server offers resilience that can serve sessions to a large web farm that&lt;br /&gt;persists across IIS restarts.&lt;br /&gt;SQL based Session state is configured with aspnet_regsql.exe. This utility is located in .NET Framework's installed directory&lt;br /&gt;C:\&lt;windows&gt;\microsoft.net\framework\&lt;version&gt;. Running this utility will create a database which will manage the session state.&lt;br /&gt;&lt;br /&gt;Configuration Information:&lt;br /&gt;&lt;sessionstate mode="SQLServer" sqlconnectionstring="data source=server;user id=freelance;password=freelance" cookieless="false" timeout="20"&gt;&lt;br /&gt;&lt;br /&gt;Advantages:&lt;br /&gt;     Supports web farm and web garden configuration  &lt;br /&gt;     Session state is persisted across application domain recycles and even IIS restarts    when session is maintained on different server.&lt;br /&gt;&lt;br /&gt;Disadvantages:&lt;br /&gt;     Requires serialization of objects&lt;br /&gt;   &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Mode:&lt;br /&gt;This setting supports three options. They are InProc, SQLServer, and State Server&lt;br /&gt;&lt;br /&gt;Cookie less:&lt;br /&gt;This setting takes a Boolean value of either true or false to indicate whether the Session is a cookie less one.&lt;br /&gt;&lt;br /&gt;Timeout:&lt;br /&gt;This indicates the Session timeout vale in minutes.  This is the duration for which a user's session is active.  Note that the session timeout is a sliding value;&lt;br /&gt;Default session timeout value is 20 minutes&lt;br /&gt;&lt;br /&gt;SqlConnectionString:&lt;br /&gt;This identifies the database connection string that names the database used for mode SQLServer.&lt;br /&gt;&lt;br /&gt;Server:&lt;br /&gt;In the out-of-process mode State Server, it names the server that is running the required Windows NT service: aspnet_state.&lt;br /&gt;&lt;br /&gt;Port:&lt;br /&gt;This identifies the port number that corresponds to the server setting for mode State Server.  Note that a port is an unsigned integer that uniquely identifies&lt;br /&gt;a process running over a network.&lt;br /&gt;&lt;br /&gt;You can disable session for a page using EnableSessionState attribute. You can set off session for entire application by setting mode=off in web.config file&lt;br /&gt;to reduce overhead for the entire application.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(51, 153, 153);"&gt;Thanks &amp;amp; Regards&lt;/span&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 0, 153); font-weight: bold;"&gt;Santosh Singh&lt;/span&gt;&lt;/sessionstate&gt;&lt;/version&gt;&lt;/windows&gt;&lt;/sessionstate&gt;&lt;/sessionstate&gt;&lt;/session&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8716405441156064874?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8716405441156064874/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/session-object-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8716405441156064874'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8716405441156064874'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/session-object-in-aspnet.html' title='Session object in asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6705504755982163480</id><published>2010-08-03T08:33:00.000-07:00</published><updated>2010-09-08T09:41:36.386-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><title type='text'>AJAX</title><content type='html'>&lt;span style="font-weight:bold;"&gt;AJAX tab control&lt;/span&gt;&lt;br /&gt;Here i describing a simple example how to use tab control in asp.net&lt;br /&gt;&lt;br /&gt;.aspx code&lt;br /&gt;&lt;br /&gt;&amp;lt; ajaxToolkit:TabPanel ID="tabFirst" runat="server" Width="111px" &amp;gt;&lt;br /&gt;  &amp;lt; HeaderTemplate&amp;gt;&lt;br /&gt;  First Tab Header name&lt;br /&gt;  &amp;lt; /HeaderTemplate&amp;gt;&lt;br /&gt;  &amp;lt; ContentTemplate&amp;gt;&lt;br /&gt;  &amp;lt; br /&amp;gt;&lt;br /&gt;  &amp;lt; asp:GridView ID="gvEmpDetail" runat="server" DataKeyNames="EmpId" AllowPaging="True" PageSize="12"&lt;br /&gt;      AutoGenerateColumns="False" OnPageIndexChanging="gvEmpDetail_PageIndexChanging"&lt;br /&gt;      OnRowDataBound="gvEmpDetail_RowDataBound" TabIndex="2" Width="697px" OnRowCancelingEdit="gvEmpDetail_RowCancelingEdit"&lt;br /&gt;      OnRowEditing="gvEmpDetail_RowEditing" OnRowUpdating="gvEmpDetail_RowUpdating"&lt;br /&gt;      ShowFooter="True" OnRowCommand="gvEmpDetail_RowCommand" OnRowDeleting="gvEmpDetail_RowDeleting"&amp;gt;&lt;br /&gt;      &amp;lt; Columns&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="Sr. No"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:Label ID="lblSrNo" runat="server"&amp;gt;  &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="EmpId" Visible="False"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:Label ID="lblEmpId" runat="server" Text=' &amp;lt;%# Bind("EmpId") %&amp;gt;'&amp;gt; &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; FooterTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:Label ID="lblFooterEmpId" runat="server"&amp;gt; &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;          &amp;lt; /FooterTemplate&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="Emp"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:Label ID="lblEmp" runat="server" Text=' &amp;lt;%# Bind("Emp") %&amp;gt;'&amp;gt; &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; EditItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:TextBox ID="txtEmp" runat="server" Text=' &amp;lt;%# Bind("Emp") %&amp;gt; '&amp;gt; &amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;          &amp;lt; /EditItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; FooterTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:TextBox ID="txtNewEmp" runat="server" Visible="false"&amp;gt;  &amp;lt;/asp:TextBox&amp;gt;&lt;br /&gt;          &amp;lt; /FooterTemplate&amp;gt;&lt;br /&gt;          &amp;lt; FooterStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;          &amp;lt; ItemStyle HorizontalAlign="Left" /&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="Edit"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="ImgYes" runat="server" ImageUrl="~/Image/img_edit.png" CommandName="Edit" /&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; EditItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="Update"&lt;br /&gt;              ImageUrl="~/Image/update.png" Text="Update" /&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="LinkButton2" runat="server" CausesValidation="False" CommandName="Cancel"&lt;br /&gt;              ImageUrl="~/Image/cancel.png" Text="Cancel" /&amp;gt;&lt;br /&gt;          &amp;lt; /EditItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; FooterTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="ButtonAdd" runat="server" ImageUrl="~/Image/row_add.png" CommandName="AddNew"&lt;br /&gt;              ToolTip="Add New" /&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="lbtnAdd" runat="server" CausesValidation="True" CommandName="Add"&lt;br /&gt;              ImageUrl="~/Image/add.png" Visible="false" Text="Add" /&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="lbtnCancel" runat="server" CausesValidation="False" CommandName="Cancel"&lt;br /&gt;              ImageUrl="~/Image/cancel.png" Visible="false" Text="Cancel" /&amp;gt;&lt;br /&gt;          &amp;lt; /FooterTemplate&amp;gt;&lt;br /&gt;          &amp;lt; FooterStyle HorizontalAlign="Center" Width="120px" /&amp;gt;&lt;br /&gt;          &amp;lt; ItemStyle HorizontalAlign="Center" Width="120px" /&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="Delete"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:ImageButton ID="ImgDelete" runat="server" ImageUrl="~/Image/img_delete.png"&lt;br /&gt;              CommandName="Delete" OnClientClick="return ConfirmDelete();" /&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; ItemStyle HorizontalAlign="Center" Width="80px" /&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;      &lt;br /&gt;      &amp;lt; /Columns&amp;gt;&lt;br /&gt;  &amp;lt; /asp:GridView&amp;gt;&lt;br /&gt;  &amp;lt; asp:Label ID="exceptionMessage" runat="server" ForeColor="Red" Width="498px"&amp;gt;  &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;  &amp;lt; /ContentTemplate&amp;gt;&lt;br /&gt;&amp;lt; /ajaxToolkit:TabPanel&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt; ajaxToolkit:TabPanel ID="tabEmpInfo" runat="server" &amp;gt;&lt;br /&gt;  &amp;lt; HeaderTemplate&amp;gt;&lt;br /&gt;  Emp Information&lt;br /&gt;  &amp;lt; /HeaderTemplate&amp;gt;&lt;br /&gt;  &amp;lt; ContentTemplate&amp;gt;&lt;br /&gt;  &amp;lt; br /&amp;gt;&lt;br /&gt;  &amp;lt; asp:GridView ID="gvEmpInfo" runat="server" AllowPaging="True" AutoGenerateColumns="False" PageSize="12"&lt;br /&gt;      OnPageIndexChanging="gvEmpInfo_PageIndexChanging" OnRowDataBound="gvEmpInfo_RowDataBound"&lt;br /&gt;      TabIndex="2" Width="697px" OnRowCancelingEdit="gvEmpInfo_RowCancelingEdit" OnRowEditing="gvEmpInfo_RowEditing"&lt;br /&gt;      OnRowUpdating="gvEmpInfo_RowUpdating" ShowFooter="True" OnRowCommand="gvEmpInfo_RowCommand"&lt;br /&gt;      OnRowDeleting="gvEmpInfo_RowDeleting" DataKeyNames="EmpInfoId"&amp;gt;&lt;br /&gt;      &amp;lt; Columns&amp;gt;&lt;br /&gt;      &amp;lt; asp:TemplateField HeaderText="Sr. No"&amp;gt;&lt;br /&gt;          &amp;lt; ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; asp:Label ID="lblSrNo" runat="server"&amp;gt;  &amp;lt;/asp:Label&amp;gt;&lt;br /&gt;          &amp;lt; /ItemTemplate&amp;gt;&lt;br /&gt;          &amp;lt; ItemStyle HorizontalAlign="Center" Width="50px" /&amp;gt;&lt;br /&gt;      &amp;lt; /asp:TemplateField&amp;gt;      &lt;br /&gt;      &amp;lt; /Columns&amp;gt;&lt;br /&gt;  &amp;lt; /asp:GridView&amp;gt;&lt;br /&gt;  &amp;lt; asp:Label ID="exceptionEmpInfo" runat="server" ForeColor="Red" Width="498px"&amp;gt;  0)&lt;br /&gt;              {&lt;br /&gt;                  gvEmpDetail.DataSource = Ds;&lt;br /&gt;                  gvEmpDetail.DataBind();&lt;br /&gt;              }&lt;br /&gt;              else&lt;br /&gt;              {&lt;br /&gt;                  ShowNoResultFound(Ds.Tables[0], gvEmpDetail);&lt;br /&gt;              }&lt;br /&gt;          }&lt;br /&gt;          catch (Exception ex)&lt;br /&gt;          {&lt;br /&gt;              exceptionMessage.Text = ex.Message;&lt;br /&gt;          }&lt;br /&gt;  }&lt;br /&gt;  protected void GridViewEmpInfo()&lt;br /&gt;          {&lt;br /&gt;              try&lt;br /&gt;              {&lt;br /&gt;                  Ds = objEmpInfoBLL.GetEmpInfoData();&lt;br /&gt;                  if (Ds.Tables[0].Rows.Count &gt; 0)&lt;br /&gt;                  {&lt;br /&gt;                      gvEmpInfo.DataSource = Ds;&lt;br /&gt;                      gvEmpInfo.DataBind();&lt;br /&gt;                  }&lt;br /&gt;                  else&lt;br /&gt;                  {&lt;br /&gt;                      ShowNoResultFound(Ds.Tables[0], gvEmpInfo);&lt;br /&gt;                  }&lt;br /&gt;              }&lt;br /&gt;              catch (Exception ex)&lt;br /&gt;              {&lt;br /&gt;                  exceptionEmpInfo.Text = ex.Message;&lt;br /&gt;              }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;&lt;span style="color: rgb(0, 204, 204);"&gt;Thanks &amp;amp; Regards&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(0, 0, 153);"&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6705504755982163480?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6705504755982163480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6705504755982163480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6705504755982163480'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/ajax.html' title='AJAX'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-3847020447216935304</id><published>2010-08-02T05:28:00.000-07:00</published><updated>2010-09-01T09:02:30.230-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Gridview custom sorting using asp.net c#</title><content type='html'>public partial class _Default : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;   private const string ASCENDING = " ASC";&lt;br /&gt;   private const string DESCENDING = " DESC";&lt;br /&gt;   protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;   {               &lt;br /&gt;       if (!IsPostBack)&lt;br /&gt;       { &lt;br /&gt;          SortGridView(sortExpression, "");&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   public SortDirection GridViewSortDirection&lt;br /&gt;   {&lt;br /&gt;       get&lt;br /&gt;       {&lt;br /&gt;           if (ViewState["sortDirection"] == null)&lt;br /&gt;               ViewState["sortDirection"] = SortDirection.Ascending;&lt;br /&gt;&lt;br /&gt;           return (SortDirection)ViewState["sortDirection"];&lt;br /&gt;       }&lt;br /&gt;       set { ViewState["sortDirection"] = value; }&lt;br /&gt;   }&lt;br /&gt;   protected void gvCust_Sorting(object sender, GridViewSortEventArgs e)&lt;br /&gt;   {&lt;br /&gt;       string sortExpression = e.SortExpression;&lt;br /&gt;&lt;br /&gt;       if (GridViewSortDirection == SortDirection.Ascending)&lt;br /&gt;       {&lt;br /&gt;           GridViewSortDirection = SortDirection.Descending;&lt;br /&gt;           SortGridView(sortExpression, DESCENDING);&lt;br /&gt;       }&lt;br /&gt;       else&lt;br /&gt;       {&lt;br /&gt;           GridViewSortDirection = SortDirection.Ascending;&lt;br /&gt;           SortGridView(sortExpression, ASCENDING);&lt;br /&gt;       }&lt;br /&gt;   }&lt;br /&gt;   static string sortExpression;&lt;br /&gt;   private void SortGridView(string sortExpression, string direction)&lt;br /&gt;      {&lt;br /&gt;          SqlConnection con;     &lt;br /&gt;          con = new SqlConnection(ConfigurationManager.ConnectionStrings["StrConnect"].ToString());&lt;br /&gt;          con.Open();&lt;br /&gt;          SqlDataAdapter oAdapter = new SqlDataAdapter("usp_GetCustDetail", con);&lt;br /&gt;          oAdapter.SelectCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt;          DataSet oDataSet = new DataSet();&lt;br /&gt;          oAdapter.Fill(oDataSet);     &lt;br /&gt;          DataTable dt = oDataSet.Tables[0];&lt;br /&gt;          DataView dv = new DataView(dt);&lt;br /&gt;          dv.Sort = sortExpression + direction;&lt;br /&gt;          gvCust.DataSource = dv;&lt;br /&gt;          gvCust.DataBind();&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-3847020447216935304?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/3847020447216935304/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/santosh-singhs-technical-space-gridview_02.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3847020447216935304'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/3847020447216935304'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/08/santosh-singhs-technical-space-gridview_02.html' title='Gridview custom sorting using asp.net c#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-8033899195557926529</id><published>2010-04-30T10:19:00.000-07:00</published><updated>2011-04-30T10:26:50.115-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Display all related data in comma separated list sql server</title><content type='html'>Concetenate the two fields and display the records with comma separated string in one field.&lt;br /&gt;&lt;br /&gt;SELECT p_scrid,&lt;br /&gt;SUBSTRING(&lt;br /&gt;( &lt;br /&gt;  SELECT (' ,' + screen_name)&lt;br /&gt;     FROM tbl_SCRMst t2&lt;br /&gt;     WHERE t1.p_scrid = t2.p_scrid&lt;br /&gt;     ORDER BY&lt;br /&gt;     p_scrid,&lt;br /&gt;     screen_name&lt;br /&gt;     FOR XML PATH( '')&lt;br /&gt;                     ),3,1000)&lt;br /&gt;FROM tbl_SCRMst t1&lt;br /&gt;GROUP BY p_scrid&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-8033899195557926529?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/8033899195557926529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/04/display-all-related-data-in-comma.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8033899195557926529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/8033899195557926529'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/04/display-all-related-data-in-comma.html' title='Display all related data in comma separated list sql server'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-5307263853574939488</id><published>2010-04-03T09:28:00.000-07:00</published><updated>2011-04-03T09:29:33.891-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Validation Controls'/><title type='text'>Check record exist or not using asp.net and c#</title><content type='html'>This code show how to check record exist in database.Method get custid as a parameter and pass to stored procedure that will check record exist or not.&lt;br /&gt;&lt;br /&gt;public bool IsCustomerExist(string strCust)&lt;br /&gt;{&lt;br /&gt;    //SqlConnection objSqlConnection = null;&lt;br /&gt;    SqlCommand objSqlCommand = null;&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt; //objSqlConnection = new SqlConnection(ConfigurationManager.ConnectionStrings["StrConnect"].ToString());&lt;br /&gt; objSqlCommand = new SqlCommand("usp_CheckCustomerExists", con);&lt;br /&gt; objSqlCommand.CommandType = CommandType.StoredProcedure;&lt;br /&gt; objSqlCommand.Parameters.Add("CustomerID", SqlDbType.Int, 4).Value = Convert.ToInt32(strCust);&lt;br /&gt; con.Open();&lt;br /&gt; SqlDataReader objSqlDataReader = objSqlCommand.ExecuteReader();&lt;br /&gt; if (objSqlDataReader.HasRows)&lt;br /&gt;     return true;&lt;br /&gt; else&lt;br /&gt;     return false;&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt; throw new Exception(ex.Message);&lt;br /&gt;    }&lt;br /&gt;    finally&lt;br /&gt;    {&lt;br /&gt; con.Close();&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;&lt;br /&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-5307263853574939488?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/5307263853574939488/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/04/check-record-exist-or-not-using-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5307263853574939488'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/5307263853574939488'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/04/check-record-exist-or-not-using-aspnet.html' title='Check record exist or not using asp.net and c#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6881604980379520461</id><published>2010-03-30T10:41:00.000-07:00</published><updated>2011-03-30T10:43:48.140-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='GridView'/><title type='text'>Find Gridview TextBox in client side using javascript</title><content type='html'>Here this article show show how we can find gridview textbox which is in Template Field.This code validate the Gridview textbox in edit mode.&lt;br /&gt;&lt;br /&gt;function ValidateGridEditMode()&lt;br /&gt;        {&lt;br /&gt;            var n = document.getElementById('ctl00_ContentPlaceHolder1_tbcLocation_tpnlCountry_gvEmp').rows.length;&lt;br /&gt;            var i;&lt;br /&gt;            for(i=2; i &lt;=n; i++)&lt;br /&gt;            {              &lt;br /&gt;                if(i&lt;10)&lt;br /&gt;                {&lt;br /&gt;                    txtEmpName=document.getElementById('ctl00_ContentPlaceHolder1_tbcLocation_tpnlCountry_gvEmp_ctl0'+i+'_txtEmpName'); &lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    txtEmpName=document.getElementById('ctl00_ContentPlaceHolder1_tbcLocation_tpnlCountry_gvEmp_ctl'+i+'_txtEmpName'); &lt;br /&gt;                }&lt;br /&gt;                if(txtEmpName !=null)&lt;br /&gt;                {&lt;br /&gt;                    if(txtEmpName.value == "")&lt;br /&gt;                    {&lt;br /&gt;                        alert("Enter Emp Name...!");  &lt;br /&gt;                        txtEmpName.focus(); &lt;br /&gt;                        return false;&lt;br /&gt;                    }    &lt;br /&gt;                }        &lt;br /&gt;            }&lt;br /&gt;            return true;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6881604980379520461?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6881604980379520461/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/03/find-gridview-textbox-in-client-side.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6881604980379520461'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6881604980379520461'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/03/find-gridview-textbox-in-client-side.html' title='Find Gridview TextBox in client side using javascript'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6923330134939131791</id><published>2010-03-27T03:30:00.000-07:00</published><updated>2011-03-30T08:48:50.349-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Single Stored Procedure for Insert and update record</title><content type='html'>It good idea to use a single stored proceude instead of write two stored procedure for insert and update.So i am here explainig how to do this.&lt;br /&gt;&lt;br /&gt;here we can check if EnquiryId ==0 then insert otherwise update.&lt;br /&gt;&lt;br /&gt;Create PROCEDURE [dbo].[uspEnquiry_AddEdit]&lt;br /&gt;(&lt;br /&gt;      @EnquiryId bigint&lt;br /&gt;    , @EnquiryNo varchar(20) output&lt;br /&gt;    , @ClientId bigint&lt;br /&gt;    , @ContactPerson varchar(50)&lt;br /&gt;    , @Desig varchar(50)&lt;br /&gt;    , @Mobile varchar(15)&lt;br /&gt;    , @Phone varchar(50)     &lt;br /&gt;    , @EmailId varchar(100)&lt;br /&gt;&lt;br /&gt;)&lt;br /&gt;AS&lt;br /&gt;DECLARE @Message varchar(100)&lt;br /&gt;IF(@EnquiryId=0)&lt;br /&gt; BEGIN&lt;br /&gt; IF EXISTS(SELECT * FROM Enquiry WHERE EnquiryNo=@EnquiryNo)&lt;br /&gt;  SET @Message='Record Exists In Database...!'&lt;br /&gt;&lt;br /&gt; ELSE  &lt;br /&gt;  BEGIN&lt;br /&gt;    INSERT INTO Enquiry&lt;br /&gt;    (&lt;br /&gt;      [EnquiryNo]&lt;br /&gt;     ,[ClientId]&lt;br /&gt;     ,[ContactPerson]&lt;br /&gt;     ,[Desig]&lt;br /&gt;     ,[Mobile]&lt;br /&gt;     ,[Phone]        &lt;br /&gt;     ,[EmailId]              &lt;br /&gt;  )&lt;br /&gt;  VALUES&lt;br /&gt;  (&lt;br /&gt;      @EnquiryNo&lt;br /&gt;     ,@ClientId&lt;br /&gt;     ,@ContactPerson&lt;br /&gt;     ,@Desig&lt;br /&gt;     ,@Mobile&lt;br /&gt;     ,@Phone         &lt;br /&gt;     ,@EmailId        &lt;br /&gt;  )   &lt;br /&gt;  SELECT @EnquiryId = @@IDENTITY;&lt;br /&gt;  END&lt;br /&gt;END&lt;br /&gt;ELSE&lt;br /&gt;  BEGIN&lt;br /&gt;    UPDATE Enquiry&lt;br /&gt;    SET     [EnquiryNo] = @EnquiryNo&lt;br /&gt;    ,[ClientId] = @ClientId&lt;br /&gt;    ,[ContactPerson] = @ContactPerson&lt;br /&gt;    ,[Desig] = @Desig&lt;br /&gt;    ,[Mobile] = @Mobile&lt;br /&gt;    ,[Phone] = @Phone     &lt;br /&gt;    ,[EmailId] = @EmailId &lt;br /&gt;   WHERE EnquiryId = @EnquiryId&lt;br /&gt;&lt;br /&gt;END&lt;br /&gt;SELECT @EnquiryId&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6923330134939131791?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6923330134939131791/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/03/single-stored-procedure-for-insert-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6923330134939131791'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6923330134939131791'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/03/single-stored-procedure-for-insert-and.html' title='Single Stored Procedure for Insert and update record'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1147622042515328923</id><published>2010-01-17T02:53:00.000-08:00</published><updated>2011-01-17T02:56:33.887-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript'/><title type='text'>Calculate two textbox value using javascript</title><content type='html'>Calculate two textbox value using javascript in ASP.NET&lt;br /&gt;function Calculate()&lt;br /&gt;{            &lt;br /&gt;    var txtProposalValue = document.getElementById('&lt;%=txtProposalValue.ClientID %&gt;');&lt;br /&gt;    var txtProfit = document.getElementById('&lt;%=txtProfit.ClientID %&gt;');&lt;br /&gt;    var txtLikelyValue = document.getElementById('&lt;%=txtLikelyValue.ClientID %&gt;');&lt;br /&gt;    var LikelyValue =(parseFloat(txtProposalValue.value) + parseFloat(txtProfit.value));   &lt;br /&gt;    if(txtProfit.value =="")&lt;br /&gt;    {&lt;br /&gt;      txtLikelyValue.value = "0";&lt;br /&gt;    }&lt;br /&gt;    else&lt;br /&gt;    {&lt;br /&gt;      txtLikelyValue.value = LikelyValue;&lt;br /&gt;    }            &lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1147622042515328923?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1147622042515328923/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/01/calculate-two-textbox-value-using.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1147622042515328923'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1147622042515328923'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2010/01/calculate-two-textbox-value-using.html' title='Calculate two textbox value using javascript'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-1591515685969251601</id><published>2009-04-24T09:35:00.000-07:00</published><updated>2011-04-24T09:38:57.146-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Insert record in database using 3-Tier Architecture asp.net</title><content type='html'>&lt;span style="font-weight:bold;"&gt;Insert data in database using 3 Tier Architecture .&lt;/span&gt;&lt;br /&gt;In this article i am explaining you how to insert record in database using 3-Tier Architecture.You can create separate project for Business and data access layer or also can keep in App_code folder.&lt;br /&gt;&lt;br /&gt;This is aspx.cs code.Here code communicate through Business Layer.&lt;br /&gt;&lt;br /&gt;protected void btnSubmit_Click(object sender, EventArgs e)&lt;br /&gt;    {  &lt;br /&gt;        objClientCls.ClName = txtCoName.Text;&lt;br /&gt;        objClientCls.AddLine1 = txtAddLine1.Text;&lt;br /&gt;        objClientCls.AddLine2 = txtAddLine2.Text;        &lt;br /&gt;        try&lt;br /&gt;        {            &lt;br /&gt;            if (objClientCls.ClId == 0)&lt;br /&gt;            {                            &lt;br /&gt;                string Msg = objClBLL.InsertClMaster(objClientCls);&lt;br /&gt;                lblMessage.Text = Msg;&lt;br /&gt;                Clear();&lt;br /&gt;            }            &lt;br /&gt;        }&lt;br /&gt;        catch (Exception ex)&lt;br /&gt;        {&lt;br /&gt;            lblMessage.Text = ex.Message;&lt;br /&gt;        }&lt;br /&gt;        finally&lt;br /&gt;        {&lt;br /&gt;            objClBLL = null;&lt;br /&gt;        }        &lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    Business Layer Code&lt;br /&gt;    &lt;br /&gt;    public string InsertClMaster(ClMasterCls objClMasterCls)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                return objClMasterDAL.Insert(objClMasterCls);&lt;br /&gt;            }&lt;br /&gt;            catch&lt;br /&gt;            {&lt;br /&gt;                throw;&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                objClMasterDAL = null;&lt;br /&gt;            }&lt;br /&gt;    }&lt;br /&gt;    &lt;br /&gt;    Data Acess layer code&lt;br /&gt;    public string Insert(ClMasterCls objClMasterCls)&lt;br /&gt;        {            &lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                conn.Open();&lt;br /&gt;                string CreateMsg = Convert.ToString(SqlHelper.ExecuteScalar(conn, "usp_InsertClMaster", objClMasterCls.ClId, objClMasterCls.ClName, objClMasterCls.AddLine1&lt;br /&gt;                    , objClMasterCls.AddLine2));&lt;br /&gt;                return Msg;&lt;br /&gt;            }&lt;br /&gt;            catch&lt;br /&gt;            {&lt;br /&gt;                throw;&lt;br /&gt;            }&lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                conn.Close();&lt;br /&gt;            }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh Singh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-1591515685969251601?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/1591515685969251601/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/insert-record-in-database-using-3-tier.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1591515685969251601'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/1591515685969251601'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/insert-record-in-database-using-3-tier.html' title='Insert record in database using 3-Tier Architecture asp.net'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-4731413498664620719</id><published>2009-04-16T01:18:00.000-07:00</published><updated>2011-04-16T01:54:24.578-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><title type='text'>Export Gridview to Excel and PDF file using asp.net and c#</title><content type='html'>In this article i am explaining you how to display report using aspx page.Exporting Gridview to excel and PDF report is one of the most common requirement in real world.So i have written this code,you can customize ConvertDataInPdf method according to your requirement.&lt;br /&gt;&lt;br /&gt;aspx code.&lt;br /&gt;&amp;lt;asp:GridView ID="GridView1" runat="server" EnableTheming="False" OnRowDataBound="GridView1_RowDataBound"&lt;br /&gt;Width="100%"&amp;gt;&lt;br /&gt; &amp;lt;HeaderStyle CssClass="ReportHeader" Width="80px" /&lt;br /&gt; &amp;lt;RowStyle CssClass="ReportText" /&amp;gt;&lt;br /&gt; &amp;lt;PagerStyle CssClass="ReportHeader" /&amp;gt;&lt;br /&gt; &amp;lt;AlternatingRowStyle CssClass="ReportText" /&amp;gt;&lt;br /&gt; &amp;lt;EmptyDataRowStyle CssClass="ReportText" /&amp;gt;&lt;br /&gt; &amp;lt;EmptyDataTemplate&amp;gt;&lt;br /&gt;     &amp;lt;span style="font-size: 11pt; color: #ff0033"&amp;gt;&amp;lt;strong&amp;gt;No Records ........!!&amp;lt;/strong&amp;gt;&amp;lt;/span&amp;gt;&lt;br /&gt; &amp;lt;/EmptyDataTemplate&amp;gt;&lt;br /&gt;&amp;lt;Columns&amp;gt;&lt;br /&gt;    &amp;lt;asp:BoundField HeaderText="Sr. No." /&amp;gt;&lt;br /&gt;&amp;lt;/Columns&amp;gt;&lt;br /&gt;&amp;lt;/asp:GridView&amp;gt;&lt;br /&gt;  &lt;br /&gt;  .cs code&lt;br /&gt;string conStr = FetchConnection.FetchConnectionString().ToString();&lt;br /&gt;void GridViewEmp()&lt;br /&gt;{&lt;br /&gt; DataSet Ds = new DataSet();&lt;br /&gt; SqlDataAdapter mySqlDataAdapter = new SqlDataAdapter();&lt;br /&gt; string str = "SELECT * from EmployeeTbl"&lt;br /&gt; Ds = SqlHelper.ExecuteDataset(conStr, CommandType.Text, str);&lt;br /&gt; GridView1.DataSource = Ds;&lt;br /&gt; GridView1.DataBind();&lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;protected void lbExportInExcel_Click1(object sender, ImageClickEventArgs e)&lt;br /&gt;    {      &lt;br /&gt; string attachment = "attachment; filename=" + "Emp Report" + ".xls";&lt;br /&gt; Response.Clear();&lt;br /&gt; HttpContext.Current.Response.AddHeader("content-disposition", attachment);&lt;br /&gt; Response.Charset = "";&lt;br /&gt; Response.ContentType = "application/vnd.xls";&lt;br /&gt; System.IO.StringWriter stringWrite = new System.IO.StringWriter();&lt;br /&gt; System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);&lt;br /&gt; reportName.RenderControl(htmlWrite);       &lt;br /&gt; rowInfo.RenderControl(htmlWrite);&lt;br /&gt; rowGridView.RenderControl(htmlWrite);       &lt;br /&gt; Response.Write(stringWrite.ToString());&lt;br /&gt; Response.End();     &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void btnPdf_Click(object sender, ImageClickEventArgs e)&lt;br /&gt;{&lt;br /&gt; PrintAndExport exportDataInPdf = new PrintAndExport();&lt;br /&gt; string reportName = "Employee Loan Report" + " ( " +lbl.Text+ " ) ";&lt;br /&gt; string OtherInfo = "Company Name: " + ddlCompany.SelectedItem.Text + "\t\t\t" + "Emp Status: " + ddlStatus.SelectedItem.Text;        &lt;br /&gt; DataTable dt = ExportData();&lt;br /&gt; exportDataInPdf.ConvertDataInPdf(dt, reportName, OtherInfo);&lt;br /&gt;}  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public void ConvertDataInPdf(DataTable dtExportInPdf, string reportName, string OtherInfo)&lt;br /&gt;{&lt;br /&gt;    try&lt;br /&gt;    {&lt;br /&gt; float CompanyNameSize = 11;&lt;br /&gt; float ReportNameSize = 9;&lt;br /&gt; float HeaderTextSize = 7;&lt;br /&gt; float ReportTextSize = 6;&lt;br /&gt;&lt;br /&gt; int totalWidth = 0;&lt;br /&gt; int tableWidthPercent = 100;&lt;br /&gt; int[] widths = new int[dtExportInPdf.Columns.Count];&lt;br /&gt;&lt;br /&gt; for (int h = 0; h &lt; dtExportInPdf.Columns.Count; h++)   //Data table header column width&lt;br /&gt; {&lt;br /&gt;     string strWidth = dtExportInPdf.Columns[h].ToString();&lt;br /&gt;     widths[h] = strWidth.Length;&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; foreach (DataRow dr in dtExportInPdf.Rows) //Data table column width&lt;br /&gt; {&lt;br /&gt;     int[] colItemWidth = new int[dtExportInPdf.Columns.Count];&lt;br /&gt;     for (int i = 0; i &lt; dtExportInPdf.Columns.Count; i++) //Data table max item width&lt;br /&gt;     {&lt;br /&gt;  if (dr[i].ToString().Length &gt; 20)&lt;br /&gt;  {&lt;br /&gt;      colItemWidth[i] = 20;&lt;br /&gt;  }&lt;br /&gt;  else if (dr[i].ToString().Length &lt; 3)&lt;br /&gt;  {&lt;br /&gt;      colItemWidth[i] = 3;&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;      colItemWidth[i] = dr[i].ToString().Length;&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  if (colItemWidth[i] &gt; widths[i])&lt;br /&gt;  {&lt;br /&gt;      widths[i] = colItemWidth[i];&lt;br /&gt;  }&lt;br /&gt;     }&lt;br /&gt; }&lt;br /&gt; for (int h = 0; h &lt; dtExportInPdf.Columns.Count; h++)&lt;br /&gt; {&lt;br /&gt;     totalWidth += widths[h];&lt;br /&gt; }&lt;br /&gt; Document pdfDoc = null;&lt;br /&gt; if (totalWidth &gt; 0 &amp;&amp; totalWidth &lt;= 110)&lt;br /&gt; {&lt;br /&gt;     pdfDoc = new Document(PageSize.A4, 20, 20, 20, 20);&lt;br /&gt; }&lt;br /&gt; else if (totalWidth &gt; 110 &amp;&amp; totalWidth &lt;= 160)&lt;br /&gt; {&lt;br /&gt;     pdfDoc = new Document(PageSize.A4.Rotate(), 20, 20, 20, 20);&lt;br /&gt; }&lt;br /&gt; else if (totalWidth &gt; 160 &amp;&amp; totalWidth &lt;= 250)&lt;br /&gt; {&lt;br /&gt;     HeaderTextSize = 6;&lt;br /&gt;     ReportTextSize = 5;&lt;br /&gt;     pdfDoc = new Document(PageSize.LEGAL.Rotate(), 20, 20, 20, 20);&lt;br /&gt;&lt;br /&gt; }&lt;br /&gt; else if (totalWidth &gt; 250 &amp;&amp; totalWidth &lt;= 300)&lt;br /&gt; {&lt;br /&gt;     CompanyNameSize = 9;&lt;br /&gt;     ReportNameSize = 7;&lt;br /&gt;     HeaderTextSize = 6;&lt;br /&gt;     ReportTextSize = 5;&lt;br /&gt;     pdfDoc = new Document(PageSize.B1, 20, 20, 20, 20);&lt;br /&gt; }&lt;br /&gt; else if (totalWidth &gt; 300)&lt;br /&gt; {&lt;br /&gt;     CompanyNameSize = 9;&lt;br /&gt;     ReportNameSize = 7;&lt;br /&gt;     HeaderTextSize = 6;&lt;br /&gt;     ReportTextSize = 5;&lt;br /&gt;     pdfDoc = new Document(PageSize.B1.Rotate(), 20, 20, 20, 20);&lt;br /&gt; }&lt;br /&gt;&lt;br /&gt; // Creates a PdfPTable with column count of the table equal to no of columns of the datatable or gridview or gridview datasource.&lt;br /&gt; PdfPTable pdfTable = new PdfPTable(dtExportInPdf.Columns.Count);&lt;br /&gt; pdfTable.WidthPercentage = tableWidthPercent;&lt;br /&gt; pdfTable.HeaderRows = 4; // Sets the first 4 rows of the table as the header rows which will be repeated in all the pages.&lt;br /&gt;&lt;br /&gt; #region PDFHeader&lt;br /&gt; PdfPTable headerTable = new PdfPTable(3); // Creates a PdfPTable with 3 columns to hold the header in the exported PDF.&lt;br /&gt; byte[] logo = (byte[])System.Web.HttpContext.Current.Session["Logo"];&lt;br /&gt; iTextSharp.text.Image imgLogo = iTextSharp.text.Image.GetInstance(logo);&lt;br /&gt; imgLogo.ScaleToFit(80f, 40f);//Resize image depend upon your need  &lt;br /&gt; imgLogo.SpacingBefore = 0f;//Give space before image            &lt;br /&gt; imgLogo.SpacingAfter = 1f;//Give some space after the image             &lt;br /&gt; PdfPCell clLogo = new PdfPCell(imgLogo);// Creates a PdfPCell which accepts a phrase as a parameter.&lt;br /&gt; clLogo.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt; clLogo.HorizontalAlignment = Element.ALIGN_LEFT;// Sets the Horizontal Alignment of the PdfPCell to left.&lt;br /&gt; clLogo.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt; // Creates a phrase to hold the application name at the left hand side of the header.&lt;br /&gt; Phrase phApplicationName = new Phrase("" + System.Web.HttpContext.Current.Session["CompanyName"] + "", FontFactory.GetFont("Arial", CompanyNameSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt; PdfPCell clApplicationName = new PdfPCell(phApplicationName);// Creates a PdfPCell which accepts a phrase as a parameter.&lt;br /&gt; clApplicationName.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt; clApplicationName.HorizontalAlignment = Element.ALIGN_CENTER;// Sets the Horizontal Alignment of the PdfPCell to left.&lt;br /&gt; clApplicationName.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt; // Creates a phrase to show the current date at the right hand side of the header.&lt;br /&gt; Phrase phDate = new Phrase(DateTime.Now.Date.ToString("dd/MM/yyyy"), FontFactory.GetFont("Arial", 7, iTextSharp.text.Font.NORMAL));&lt;br /&gt; PdfPCell clDate = new PdfPCell(phDate);// Creates a PdfPCell which accepts the date phrase as a parameter.&lt;br /&gt; clDate.HorizontalAlignment = Element.ALIGN_RIGHT;// Sets the Horizontal Alignment of the PdfPCell to right.&lt;br /&gt; clDate.Border = PdfPCell.NO_BORDER;// Sets the border of the cell to zero.&lt;br /&gt; clDate.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt;&lt;br /&gt; headerTable.AddCell(clLogo);&lt;br /&gt; headerTable.AddCell(clApplicationName);// Adds the cell which holds the application name to the headerTable.&lt;br /&gt; headerTable.AddCell(clDate);// Adds the cell which holds the date to the headerTable.&lt;br /&gt; headerTable.DefaultCell.Border = PdfPCell.NO_BORDER;// Sets the border of the headerTable to zero.  &lt;br /&gt;&lt;br /&gt; // Creates a PdfPCell that accepts the headerTable as a parameter and then adds that cell to the main PdfPTable.&lt;br /&gt; PdfPCell cellHeader = new PdfPCell(headerTable);&lt;br /&gt; cellHeader.VerticalAlignment = Element.ALIGN_TOP;&lt;br /&gt; cellHeader.Border = PdfPCell.NO_BORDER;&lt;br /&gt; cellHeader.Colspan = dtExportInPdf.Columns.Count;// Sets the column span of the header cell to noOfColumns.&lt;br /&gt; pdfTable.AddCell(cellHeader);// Adds the above header cell to the table.&lt;br /&gt; #endregion PDFHeader&lt;br /&gt;&lt;br /&gt; //Creates a phrase for a new line.&lt;br /&gt; Phrase phSpace1 = new Phrase("\n");&lt;br /&gt; PdfPCell clSpace1 = new PdfPCell(phSpace1);&lt;br /&gt; clSpace1.Border = PdfPCell.BOTTOM_BORDER;&lt;br /&gt; clSpace1.BorderWidth = 1;&lt;br /&gt; clSpace1.BorderColor = iTextSharp.text.Color.DARK_GRAY;&lt;br /&gt; clSpace1.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt; pdfTable.AddCell(clSpace1);&lt;br /&gt;&lt;br /&gt; // Creates a phrase to hold the report name.&lt;br /&gt; Phrase phHeader = new Phrase("" + reportName + "", FontFactory.GetFont("Arial", ReportNameSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt; PdfPCell clHeader = new PdfPCell(phHeader);&lt;br /&gt; clHeader.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt; clHeader.Border = PdfPCell.NO_BORDER;&lt;br /&gt; clHeader.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt; clHeader.VerticalAlignment = Element.ALIGN_MIDDLE;&lt;br /&gt; clHeader.PaddingTop = 5;&lt;br /&gt; clHeader.PaddingBottom = 2;&lt;br /&gt; pdfTable.AddCell(clHeader);&lt;br /&gt;&lt;br /&gt; //Create Phrage to hold other informations&lt;br /&gt; Phrase phOtherInfo = new Phrase(OtherInfo, FontFactory.GetFont("Arial", ReportTextSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt; PdfPCell cellOtherInfo = new PdfPCell(phOtherInfo);&lt;br /&gt; cellOtherInfo.Colspan = dtExportInPdf.Columns.Count;&lt;br /&gt; cellOtherInfo.Border = Element.ALIGN_LEFT;&lt;br /&gt; cellOtherInfo.PaddingBottom = 10;&lt;br /&gt; pdfTable.AddCell(cellOtherInfo);&lt;br /&gt;&lt;br /&gt; PdfWriter.GetInstance(pdfDoc, System.Web.HttpContext.Current.Response.OutputStream);&lt;br /&gt; string strFooter = "Copyright © 2010 By Cnergee. Page:";&lt;br /&gt; Phrase phCopyright = new Phrase(strFooter, FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));&lt;br /&gt; Phrase phPageNo = new Phrase("", FontFactory.GetFont(FontFactory.TIMES_ROMAN, 8, iTextSharp.text.Font.NORMAL));&lt;br /&gt; HeaderFooter footer = new HeaderFooter(phCopyright, phPageNo);&lt;br /&gt; //footer.Alignment = Element.ALIGN_LEFT;&lt;br /&gt; footer.Alignment = Element.ALIGN_RIGHT;&lt;br /&gt; footer.Border = iTextSharp.text.Rectangle.TOP_BORDER;&lt;br /&gt; footer.GrayFill = 10;&lt;br /&gt; pdfDoc.Footer = footer;&lt;br /&gt;&lt;br /&gt; pdfDoc.Open();&lt;br /&gt; Font font8 = FontFactory.GetFont("ARIAL Narrow", 7);&lt;br /&gt; if (dtExportInPdf != null)&lt;br /&gt; {&lt;br /&gt;     pdfDoc.Header = null;&lt;br /&gt;     //Create header for pdf table&lt;br /&gt;     string cloName = null;&lt;br /&gt;     Phrase ph = null;&lt;br /&gt;     for (int i = 0; i &lt; dtExportInPdf.Columns.Count; i++)&lt;br /&gt;     {&lt;br /&gt;  cloName = dtExportInPdf.Columns[i].ColumnName;&lt;br /&gt;  if (dtExportInPdf.Columns.Count &gt; 0)&lt;br /&gt;  {&lt;br /&gt;      ph = new Phrase(cloName, FontFactory.GetFont("Arial", HeaderTextSize, iTextSharp.text.Font.BOLD));&lt;br /&gt;  }&lt;br /&gt;  else&lt;br /&gt;  {&lt;br /&gt;      ph = new Phrase(cloName, FontFactory.GetFont("Arial", HeaderTextSize, iTextSharp.text.Font.BOLD));&lt;br /&gt;  }&lt;br /&gt;  pdfTable.AddCell(ph);&lt;br /&gt;     }&lt;br /&gt;&lt;br /&gt;     //Add data into the pdf table               &lt;br /&gt;     for (int rows = 0; rows &lt; dtExportInPdf.Rows.Count; rows++)&lt;br /&gt;     {&lt;br /&gt;  ph = null;&lt;br /&gt;  PdfPCell pCell = null;&lt;br /&gt;  for (int column = 0; column &lt; dtExportInPdf.Columns.Count; column++)&lt;br /&gt;  {&lt;br /&gt;      ph = new Phrase(dtExportInPdf.Rows[rows][column].ToString(), FontFactory.GetFont("Arial", ReportTextSize, iTextSharp.text.Font.NORMAL));&lt;br /&gt;      pCell = new PdfPCell(ph);&lt;br /&gt;      if (dtExportInPdf.Columns[column].ColumnName == "SrNo" || dtExportInPdf.Columns[column].ColumnName == "Sr.No." || dtExportInPdf.Columns[column].ColumnName == "Sr. No." || dtExportInPdf.Columns[column].ColumnName == "Code" || dtExportInPdf.Columns[column].ColumnName == "EmpCode" || dtExportInPdf.Columns[column].ColumnName == "EmployeeCode")&lt;br /&gt;      {&lt;br /&gt;   pCell.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt;      }&lt;br /&gt;      else if (dtExportInPdf.Columns[column].ColumnName == "Amount")&lt;br /&gt;      {&lt;br /&gt;   pCell.HorizontalAlignment = Element.ALIGN_RIGHT;&lt;br /&gt;      }&lt;br /&gt;      else if (dtExportInPdf.Columns[column].ColumnName == "Date" || dtExportInPdf.Columns[column].ColumnName == "From" || dtExportInPdf.Columns[column].ColumnName == "To")&lt;br /&gt;      {&lt;br /&gt;   pCell.HorizontalAlignment = Element.ALIGN_CENTER;&lt;br /&gt;      }&lt;br /&gt;      else&lt;br /&gt;      {&lt;br /&gt;   pCell.HorizontalAlignment = Element.ALIGN_LEFT;&lt;br /&gt;      }&lt;br /&gt;      pdfTable.AddCell(pCell);&lt;br /&gt;  }&lt;br /&gt;  pdfTable.SetWidths(widths);&lt;br /&gt;     }&lt;br /&gt;     pdfTable.SpacingBefore = 15f; // Give some space after the text or it may overlap the table   &lt;br /&gt;     pdfDoc.Add(pdfTable); // add pdf table to the document                 &lt;br /&gt; }&lt;br /&gt; pdfDoc.Close();&lt;br /&gt;&lt;br /&gt; string pdfFileName = reportName;&lt;br /&gt; reportName = reportName.Replace(" ", "");&lt;br /&gt; System.Web.HttpContext.Current.Response.ContentType = "application/pdf";&lt;br /&gt; System.Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename= " + pdfFileName + ".pdf");&lt;br /&gt; System.Web.HttpContext.Current.Response.Write(pdfDoc);&lt;br /&gt;&lt;br /&gt; System.Web.HttpContext.Current.Response.Flush();&lt;br /&gt; System.Web.HttpContext.Current.Response.End();&lt;br /&gt;    }&lt;br /&gt;    catch (DocumentException de)&lt;br /&gt;    {&lt;br /&gt; System.Web.HttpContext.Current.Response.Write(de.Message);&lt;br /&gt;    }&lt;br /&gt;    catch (IOException ioEx)&lt;br /&gt;    {&lt;br /&gt; System.Web.HttpContext.Current.Response.Write(ioEx.Message);&lt;br /&gt;    }&lt;br /&gt;    catch (Exception ex)&lt;br /&gt;    {&lt;br /&gt; System.Web.HttpContext.Current.Response.Write(ex.Message);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public override void VerifyRenderingInServerForm(Control control)&lt;br /&gt;{&lt;br /&gt;// Confirms that an HtmlForm control is rendered for the&lt;br /&gt;//specified ASP.NET server control at run time.&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-4731413498664620719?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/4731413498664620719/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/export-gridview-to-excel-and-pdf-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4731413498664620719'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/4731413498664620719'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/export-gridview-to-excel-and-pdf-file.html' title='Export Gridview to Excel and PDF file using asp.net and c#'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-8996795397710165839.post-6671089832263973542</id><published>2009-04-16T00:46:00.000-07:00</published><updated>2011-04-16T00:53:15.712-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SqlServer'/><title type='text'>Find tables that contain a certain field in database</title><content type='html'>Some times user need to get information about a table field,means how many table contains this field. A table field  eg 'xyz' have relationship with many table and you want to see all table.Write below query.&lt;br /&gt;&lt;br /&gt;select * from information_schema.columns where column_name = 'xyz'&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight:bold;"&gt;Thanks &amp; Regards&lt;br /&gt;Santosh&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;Santosh Singh&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/8996795397710165839-6671089832263973542?l=aspdotnetcode.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://aspdotnetcode.blogspot.com/feeds/6671089832263973542/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/find-tables-that-contain-certain-field.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6671089832263973542'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/8996795397710165839/posts/default/6671089832263973542'/><link rel='alternate' type='text/html' href='http://aspdotnetcode.blogspot.com/2009/04/find-tables-that-contain-certain-field.html' title='Find tables that contain a certain field in database'/><author><name>Santosh</name><uri>http://www.blogger.com/profile/03685536929317064669</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='27' height='32' src='http://3.bp.blogspot.com/_cmAraM6UKYk/TLLGIvOM3SI/AAAAAAAABZ4/PyoH2dTHiuU/S220/san1.JPG'/></author><thr:total>0</thr:total></entry></feed>
