<?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-1903188344093543539</id><updated>2012-02-15T23:35:31.174-08:00</updated><category term='File Uploading in .NET'/><category term='JavaScript to select one checkbox at a time inside a gridview'/><category term='Fetch the data from other website'/><category term='Silverlight DataGrid Paging'/><title type='text'>Prateek's Tips</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>52</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6390729127812635498</id><published>2010-07-07T03:25:00.000-07:00</published><updated>2010-07-07T03:27:57.600-07:00</updated><title type='text'>Create a key in the registry using C#</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;Microsoft.win32 Namespace is containing register class; Register class is used to manipulate the system registry. It represents a Key level node in the windows registry. &lt;br /&gt;&lt;br /&gt;The registry acts as information for the operating system and application on a computer. Register keys are the base unit of registry. Each key have multiple values alone with it.    &lt;br /&gt;&lt;br /&gt;C# Code for creates a key in the register.&lt;br /&gt;&lt;br /&gt;CreateSubKey method to creates a new subkey or opens an existing subkey for write access&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example:  &lt;br /&gt;Microsoft.Win32.RegistryKey mykey;&lt;br /&gt;mykey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(“Muhil Software”);&lt;br /&gt;&lt;br /&gt;To set a value for the particular key is setValue method &lt;br /&gt;&lt;br /&gt;Example: &lt;br /&gt;&lt;br /&gt;mykey.SetValue(“Muhil”, “12345789”);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Some time exceptions will occur due to the name of the key is null or the user does not have permissions to create registry key or they key name exceeds the limit or if the key is closed or the register key is read only.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;More secure to write data into register use Microsoft.Win32.Registry.CurrentUser instead of  Microsoft.Win32.Registry.LocalMachine. &lt;br /&gt;Complete listing for create a key.&lt;br /&gt;&lt;br /&gt;Microsoft.Win32.RegistryKey mykey;&lt;br /&gt;mykey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(“Muhil Software”);&lt;br /&gt;mykey.SetValue(“Muhil”, “12345789”);&lt;br /&gt;mykey.close();&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Retrieve Registry key information.&lt;br /&gt;&lt;br /&gt;RegistryKey.GetValue Method retrieves the value in a specified name. If returns null the name does not exist in the registry and it will return as a object.&lt;br /&gt;Example: &lt;br /&gt;&lt;br /&gt;key.GetValue(“Muhil”);&lt;br /&gt;&lt;br /&gt;Complete listing to retrieve the registry key&lt;br /&gt;&lt;br /&gt;Microsoft.Win32.RegistryKey key;&lt;br /&gt;key = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("Muhil Software");&lt;br /&gt;String s = (String)key.GetValue("Muhil");&lt;br /&gt;&lt;br /&gt;OpenSubKey method is used to open the register under {HKEY_CURRENT_USER\Muhil Software}. GetValue method return the object associated with name.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6390729127812635498?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6390729127812635498/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/07/create-key-in-registry-using-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6390729127812635498'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6390729127812635498'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/07/create-key-in-registry-using-c.html' title='Create a key in the registry using C#'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-1259979674355006877</id><published>2010-07-07T03:24:00.000-07:00</published><updated>2010-07-07T03:25:28.856-07:00</updated><title type='text'>Hash Algorithm</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;Hash Algorithm is one of cryptographic hash functions introduced by the national institute of standards and technology. There are few of secure hash algorithm are SAH1, MD5, SHA256, SHA384 and SHA512.&lt;br /&gt;&lt;br /&gt;The hash is used, as a unique value of fixed size representing a large amount of data and the hashes of two sets of data should match if the corresponding data also matches. Small changes to the data result in large.&lt;br /&gt;&lt;br /&gt;.Net &lt;br /&gt;In .Net System.Security.Cryptography name-space provides the cryptographic services for secure encoding and decoding of data. It will provide the hashing, random number generation and message authentication. &lt;br /&gt;&lt;br /&gt;.Net Framework supports the following hash algorithms.&lt;br /&gt;&lt;br /&gt;· SHA1 is the secure hash algorithm (SHA). SHA! Uses 160 bits to encrypt the data &lt;br /&gt;· MD5 is an algorithm gets an input of length and output digested. MD5 uses 128 bits to encrypt the data&lt;br /&gt;· SHA256 is the SHA that uses 256 bits to encrypt the data &lt;br /&gt;· SHA384 is the SHA that uses 384 bits to encrypt the data.&lt;br /&gt;· SHA512 is the SHA that uses 512 bits to encrypt the data&lt;br /&gt;&lt;br /&gt;Sha1 is the most widely used for the existing SHA hash functions and widely used for security applications and protocols&lt;br /&gt;SHA1 Hashing Algorithm &lt;br /&gt;&lt;br /&gt;System.Security.Cryptography namespace to write in top of using block and SHA1CryptoServiceProvider class is to assign with SHA1 Algorithm to be used &lt;br /&gt;&lt;br /&gt;        Example &lt;br /&gt;Using System.Secuity.Cryptography;&lt;br /&gt;SHA1 sha; &lt;br /&gt;&lt;br /&gt;sha=new SHA1CryptoServiceProvider &lt;br /&gt;&lt;br /&gt;ComputeHash method compute the hash value for the specified bytes &lt;br /&gt;ComputeHash(System.Text.Encoding.UTF8.GetBytes("GivenString")&lt;br /&gt;&lt;br /&gt;Complete Listing of SHA1 Algorithm             &lt;br /&gt;byte[] result = new byte[100];&lt;br /&gt;SHA1 sha;&lt;br /&gt;          &lt;br /&gt;string FinalStr = "180066666password",sSignature;&lt;br /&gt;sha = new SHA1CryptoServiceProvider();&lt;br /&gt;&lt;br /&gt;result = sha.ComputeHash(System.Text.Encoding.UTF8.GetBytes(FinalStr));&lt;br /&gt;  &lt;br /&gt;sSignature = Convert.ToBase64String(result);&lt;br /&gt;&lt;br /&gt;Create instance of the SHA1CryptoServiceProvider and use Compute Hash to computes the hash value for the specified byte array. Again result converts into base64string method. &lt;br /&gt;&lt;br /&gt;Output: K6DLPjiaIvN5JLQFQHaYLcUBAug=&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-1259979674355006877?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/1259979674355006877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/07/hash-algorithm.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1259979674355006877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1259979674355006877'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/07/hash-algorithm.html' title='Hash Algorithm'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5397535767026749355</id><published>2010-07-04T02:03:00.000-07:00</published><updated>2010-07-04T02:04:12.243-07:00</updated><title type='text'>Bill Gates’ 10 advices to young people</title><content type='html'>Before retiring in July 2008, Bill Gates gave the following advices to high school students. Who knows you will become a second Bill Gates after learning from these valuable advices? &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;1. “Life is not fair - get used to it.” &lt;br /&gt;-&gt; The world is never fair. You know this? You can never change the whole world. Injustice still exists in the current society, so you should try to adapt. &lt;br /&gt;&lt;br /&gt;2. “The world won't care about your self-esteem. The world will expect you to accomplish something BEFORE you feel good about yourself.” &lt;br /&gt;-&gt; Your extreme self-esteem may make your job inconvenient. Don't attach too much significance on your self-esteem as people care about your achievements rather than it. &lt;br /&gt;&lt;br /&gt;3. “You will NOT make 40 thousand dollars a year right out of high school. You won't be a vice president with car phone, until you earn both.” &lt;br /&gt;-&gt; Normally you can't be rich if you have just finished high school. However to become an executive, you need to obtain both: a high school certificate and the money. &lt;br /&gt;&lt;br /&gt;4. “If you think your teacher is tough, wait till you get a boss. He doesn't have tenure.” &lt;br /&gt;-&gt; Don’t complain that your boss is tough. When you are at school, your teachers always stand by you whenever you meet problems. However if you have thought that all your problems really come from the hard requirements of your teachers, you shouldn't look for a job. Simply if there aren't strict demands from your company, you will do nothing and quickly become unemployed. Then nobody will give you a hand. &lt;br /&gt;&lt;br /&gt;5. “If you mess up, it's not your parents' fault, so don't whine about your mistakes, learn from them.” &lt;br /&gt;-&gt; Don't blame your failure on your destiny. All you need now is to stay calm and start from scratch. &lt;br /&gt;&lt;br /&gt;6. “Before you were born, your parents weren't as boring as they are now. They got that way from paying your bills, cleaning your clothes and listening to you talk about how cool you are. So before you save the rain forest from the parasites of your parent's generation, try delousing the closet in your own room.” &lt;br /&gt;-&gt; You should show your gratefulness to your parents for spending most of their lives for your living and growth. All the “outdated” of your parents today is the price they have to pay for your growth. &lt;br /&gt;&lt;br /&gt;7. “Your school may have done away with winners and losers, but life may not. In some schools they have abolished failing grades and they'll give you as many times as you want to get the right answer. This doesn't bear the slightest resemblance to ANYTHING in real life.” &lt;br /&gt;-&gt; Keep in mind that you can always become a leader, so that you will have more motivation to strive for your career. &lt;br /&gt;&lt;br /&gt;8. “Life is not divided into semesters. You don't get summers off and very few employers are interested in helping you find yourself. Do that on your own time.” &lt;br /&gt;-&gt; Don’t always wait for holidays or you will be left behind your colleagues. That backwardness means elimination and unemployment. &lt;br /&gt;&lt;br /&gt;9. “Television is NOT real life. In real life people actually have to leave the coffee shop and go to jobs.” &lt;br /&gt;-&gt; Everybody likes watching TV, but you shouldn't watch it too much. As that actually isn't your life and your thinking will be influenced. You yourself have to determine your own life. &lt;br /&gt;&lt;br /&gt;10. “Be nice to nerds. Chances are you'll end up working for one.” &lt;br /&gt;-&gt; You should be nice to everyone. Life has happenings you could never expect. Be open to your boss, don’t say bad things behind his back as it will bring you nowhere.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5397535767026749355?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5397535767026749355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/07/bill-gates-10-advices-to-young-people.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5397535767026749355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5397535767026749355'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/07/bill-gates-10-advices-to-young-people.html' title='Bill Gates’ 10 advices to young people'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-2990969241173973886</id><published>2010-06-25T22:04:00.000-07:00</published><updated>2010-06-25T22:14:33.509-07:00</updated><title type='text'>Embed a True Type Font on your web page.</title><content type='html'>How to embed a True Type Font on your web page.&lt;br /&gt;&lt;br /&gt;You may have an interesting or weird font type that you want on your web page, but in order for other people to be able to see this font you will need to embed it on your web page. Why? Because when a visitor views a web site, the only fonts that will display are those installed on the visitors system!&lt;br /&gt;&lt;br /&gt;So if you want either a weird gothic font or an old Celtic font such as in the main logo of my site (which is actually an image) you will need to either display the font in an image or embed the font in your web page.&lt;br /&gt;&lt;br /&gt;NOTE:: Although this guide is new it is based on old information. I will try to update it as soon as I have time.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Embedding the font:&lt;br /&gt;&lt;br /&gt;To embed a font type on a Web page first select the font you want to embed, either from your hard drive or download it from the Internet.&lt;br /&gt;Then create an embedded font file. And lastly attach the font to your style sheet.&lt;br /&gt;Creating the Embedded File&lt;br /&gt;&lt;br /&gt;You need to download software to create an embedded font file which can be in two formats .pfr or .eot.&lt;br /&gt;Portable Font Resources (.pfr):&lt;br /&gt;TrueDoc for Nav 4.0+ and IE 4.0+ on Windows, Mac, and Unix platforms.&lt;br /&gt;Download from http://Bitstream.com&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Embeddable Open Type[/b] (.eot):&lt;br /&gt;Compatible only with Explorer 4.0+ on the Windows platform.&lt;br /&gt;Download from http://www.microsoft.com/typography/web/embedding/weft3/default.htm&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Next we need to embed the file using CSS.&lt;br /&gt;&lt;br /&gt;Into the HEAD section of your document insert:&lt;br /&gt;&lt;br /&gt;Example with True Type&lt;br /&gt;&lt;br /&gt;&lt;link rel = "fontdef" src="cool-font.pfr"&gt;&lt;br /&gt;&lt;br /&gt;To work in IE4 and above, you need to add a pointer to an ActiveX control immediately after the LINK tag OR ELSE create an OpenType file for Explorer and refer to both on your page.&lt;br /&gt;&lt;br /&gt;TrueDoc fonts stay within the browser: you can't download them to your system&lt;br /&gt;&lt;br /&gt;Example with Open Type&lt;br /&gt;&lt;br /&gt;&lt;STYLE TYPE="text/css"&gt;&lt;br /&gt;&lt;--!&lt;br /&gt;@font-face {&lt;br /&gt;src:url(fonts/cool-font.eot);&lt;br /&gt;}&lt;br /&gt;--&gt;&lt;br /&gt;&lt;/STYLE&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This method works in IE5 &amp; IE6 but is not supported by Firefox/Opera.&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-2990969241173973886?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/2990969241173973886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/06/embed-true-type-font-on-your-web-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2990969241173973886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2990969241173973886'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/06/embed-true-type-font-on-your-web-page.html' title='Embed a True Type Font on your web page.'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3262794704080755692</id><published>2010-03-03T07:28:00.000-08:00</published><updated>2010-03-03T07:34:10.929-08:00</updated><title type='text'>Windows Workflow Foundation</title><content type='html'>&lt;strong&gt;Windows Workflow Foundation&lt;br /&gt;&lt;/strong&gt;Workflow is one of the new core capabilities (along with WPF aka Avalon and WCF aka Indigo) being added in the .NET Framework 3.0 release later this year.  It provides an in-process workflow engine to process rules, a designer for VS 2005 to enable both developers and non-developers to define custom workflow processes graphically, and a new Workflow namespace to integrate these within code&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;ASP.NET and Workflows&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;A workflow built on Windows Workflow Foundation is a component that requires an ad hoc runtime environment to function. The workflow runtime environment is represented by the Workflow Runtime class. To host a workflow library, you create and configure an instance of the Workflow Runtime class to operate on a particular workflow type. For performance reasons, you normally create the runtime environment only once in the application lifetime and make it serves all incoming requests. In a Windows Forms application, you initialize the workflow runtime in the form's constructor and destroy it with the form when the application shuts down. So how does this work if you're using ASP.NET?&lt;br /&gt;Once you have a workflow component up and running, calling it from within a Web app or Windows Forms shouldn't be an issue. As far as Windows Workflow Foundation-based workflows are concerned, ASP.NET developers have only a few small issues to face that are mostly related to the nature of Web applications.&lt;br /&gt;Just like in Windows Forms, with ASP.NET you need to have just one instance of the workflow runtime created when the application starts. Unlike Windows Forms applications, though, a Web application works by accepting and processing requests. Requests are treated individually and don't know anything about each other. That leads to issues related to workflow persistence and threading.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;WF (Windows Workflow Foundation) Features:-&lt;br /&gt;&lt;/strong&gt;&lt;br /&gt;· WF (Windows Workflow Foundation) supports sequential or state machine workflows. Sequential workflows usually co-ordinate activities that have a well-defined order and particular business rules and decision-making logic controls the flow between activities. Sequential workflows can contain purely automated processing, or can wait for external input from humans or external system events. State machine workflows allow the workflow to respond to external events that trigger further processing and transitions to other states.&lt;br /&gt;&lt;br /&gt;· Developers / programmers use the Workflow Designer mixed with their associated Visual Studio environment to organize activities into a workflow definition that meets business requirements. Business users can review the resulting workflow design to see the implementation and verify that it meets their requirements.&lt;br /&gt;&lt;br /&gt;· With use of workflow, complex business rules can be decoupled from application code making them easily to create, change &amp;amp; maintain. The WF (Windows Workflow Foundation) designer offers a way to specify business rules separate from other workflow logic.&lt;br /&gt;&lt;br /&gt;· Workflows (WF) can encapsulate details for a complex business process including decision-making logic and business rules that can impact flow of communication, error handling, and compensating activities.&lt;br /&gt;&lt;br /&gt;· Developers can easily encapsulate common workflow logic for the business domain into custom activities that can be reused across workflows and hide the complexity of a particular subset of logically related activities. Higher level, domain specific activities can also become building blocks for business analysts to design workflow definitions.&lt;br /&gt;&lt;br /&gt;· The state of a long running workflow can be managed and traced with built-in services WF (Windows Workflow Foundation) offers for persistence and tracking.&lt;br /&gt;&lt;br /&gt;· Human workflow can be integrated such that different applications and users can act with a particular workflow illustrate at different stages of execution.&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;Prateek Bhatnagar&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3262794704080755692?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3262794704080755692/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/03/windows-workflow-foundation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3262794704080755692'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3262794704080755692'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/03/windows-workflow-foundation.html' title='&lt;strong&gt;Windows Workflow Foundation&lt;/strong&gt;'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6094827978056365240</id><published>2010-02-19T23:45:00.000-08:00</published><updated>2010-02-19T23:51:09.241-08:00</updated><title type='text'>Microsoft .NET Framework 4.0</title><content type='html'>&lt;div class="Section1"&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight:normal"&gt;&lt;span style="font-size: 16.0pt; mso-bidi-font-size: 11.0pt; line-height: 115%;"&gt;Microsoft .NET Framework&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;The Microsoft .NET Framework is a software framework that can be installed on computers running Microsoft Windows operating systems. It includes a large library of coded solutions to common programming problems and a virtual machine that manages the execution of programs written specifically for the framework. The .NET Framework is a Microsoft offering and is intended to be used by most new applications created for the Windows platform.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;In this articles we talk about Microsoft .NET Framework 4.0&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight:normal"&gt;&lt;span style="font-size: 16.0pt; mso-bidi-font-size: 11.0pt; line-height: 115%;"&gt;What’s new in .NET Framework 4.0?&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;1. Next versions of Windows Communication Foundation (WCF) and Windows Workflow Foundation (WF) will provide better support for Web 2.0 technologies like REST, POX, and ATOM.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;2. Performance and Scalability of WCF and WF are expected to increase by minimum 10X.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;3. New workflow models.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;4. Seamless integration between WCF and WF including a new Visual Designer.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;5. &lt;strong style="mso-bidi-font-weight:normal"&gt;Parallel Programming&lt;/strong&gt; framework using PLINQ, Task Parallel Library and Coordination Data Structures to better utilize power of multi-processor and multi-core machines.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;6. Build declarative applications with WF, WCF and WPF using XAML. So, XAML is no more only for WPF and WF.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;7. WCF enhancements:&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in"&gt;1. RESTful enhancements&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;&lt;span style="mso-spacerun: yes;"&gt; &lt;/span&gt;1. Simplifying the building of REST Singleton &amp;amp; Collection Services, ATOM Feed and Publishing &lt;span style="mso-spacerun: yes;"&gt; &lt;/span&gt;Protocol Services, and HTTP Plain XML Services using WCF&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;2. WCF REST Starter Kit to be released on Codeplex to get early feedback&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;2. Messaging enhancements&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;1. Transports - UDP, MQ, Local in-process&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;2. Protocols - SOAP over UDP, WS-Discovery, WS-Business Activity, WS-I BP 1.2&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;3. Duplex durable messaging&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;3. Correlation enhancements&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;1. Content and context driven, One-way support&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;4. Declarative Workflow Services&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;1. Seamless integration between WF and WCF and unified XAML model&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;2. Build entire application in XAML, from presentation to data to services to workflow&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;8. WF enhancements:&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;1. Significant improvements in performance and scalability&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;1. Ten-fold improvement in performance&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;2. New workflow flow-control models and pre-built activities&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;1. Flowcharts, rules&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:.5in;text-indent:.5in"&gt;2. Expanded built-in activities – Power Shell, database, messaging, etc.&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;3. Enhancements in workflow modeling&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;1. Persistence control, transaction flow, compensation support, data binding and scoping&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;2. Rules &lt;span class="SpellE"&gt;composable&lt;/span&gt; and seamlessly integrated with workflow engine&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="text-indent:.5in"&gt;4. Updated visual designer&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;1. Easier to use by end-users&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;2. Easier to &lt;span class="SpellE"&gt;rehost&lt;/span&gt; by ISVs&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt;3. Ability to debug XAML&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal" style="margin-left:1.0in"&gt; &lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;strong style="mso-bidi-font-weight:normal"&gt;Regard &lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;p class="MsoNormal"&gt;&lt;span class="SpellE"&gt;&lt;strong style="mso-bidi-font-weight:normal"&gt;Prateek&lt;/strong&gt;&lt;/span&gt;&lt;strong style="mso-bidi-font-weight: normal;"&gt; &lt;span class="SpellE"&gt;Bhatnagar&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6094827978056365240?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6094827978056365240/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/02/microsoft-net-framework-40.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6094827978056365240'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6094827978056365240'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/02/microsoft-net-framework-40.html' title='Microsoft .NET Framework 4.0'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3630535135777828232</id><published>2010-02-03T23:46:00.000-08:00</published><updated>2010-02-04T00:03:16.867-08:00</updated><title type='text'>Upload Image in Database and Display Image</title><content type='html'>&lt;strong&gt;upload images&lt;/strong&gt;.. first i created a database table with the following columns...&lt;br /&gt;&lt;br /&gt;Id --&gt; int (identity column, and primary key)&lt;br /&gt;&lt;br /&gt;firstname --&gt;varchar(50)&lt;br /&gt;&lt;br /&gt;lastname --&gt;varchar(50)&lt;br /&gt;&lt;br /&gt;image --&gt;varchar(50)&lt;br /&gt;&lt;br /&gt;and under my web site root directory i have created a folder with name..(images)&lt;br /&gt;&lt;br /&gt;here is the code.. to upload the image....&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;using System.IO;&lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Web.Configuration;&lt;br /&gt; &lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (FileUpload1.HasFile)&lt;br /&gt;        {&lt;br /&gt;            string fileExt = Path.GetExtension(FileUpload1.FileName).ToLower();&lt;br /&gt;            string fileName = Path.GetFileName(FileUpload1.FileName);&lt;br /&gt;            string dbfilePath = @"~/images/" + fileName;&lt;br /&gt;            if (fileName != string.Empty)&lt;br /&gt;            {&lt;br /&gt;                try&lt;br /&gt;                {&lt;br /&gt;                    if (fileExt == ".jpg" || fileExt == ".gif")&lt;br /&gt;                    {&lt;br /&gt;                        FileUpload1.SaveAs(Server.MapPath(@"~/images/") + fileName);&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        Response.Write("You can upload only JPG or GIF files...");&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;            SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["myConnection"].ConnectionString);            &lt;br /&gt;            SqlCommand cmd = new SqlCommand("insert into images values(@firstname,@lastname,@image)",con);&lt;br /&gt;            cmd.Parameters.AddWithValue("@firstname",TextBox1.Text);&lt;br /&gt;            cmd.Parameters.AddWithValue("@lastname",TextBox2.Text);&lt;br /&gt;            cmd.Parameters.AddWithValue("@image",dbfilePath);&lt;br /&gt;            con.Open();&lt;br /&gt;            int i = cmd.ExecuteNonQuery();&lt;br /&gt;            con.Close();&lt;br /&gt;            if (i &gt; 0)&lt;br /&gt;            {&lt;br /&gt;                Response.Write("Uploaded");&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Display Image in Repeater&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;his is how you can display the images in Repeater control....&lt;br /&gt;&lt;br /&gt;Html...&lt;br /&gt;&lt;asp:Repeater ID="Repeater1" runat="server"&gt;&lt;br /&gt;        &lt;ItemTemplate&gt;&lt;br /&gt;            &lt;asp:Label ID="Label1" runat="server" Text='&lt;%#Eval("Id") %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt;            &lt;asp:Label ID="Label2" runat="server" Text='&lt;%#Eval("firstname") %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt;            &lt;asp:Label ID="Label3" runat="server" Text='&lt;%#Eval("lastname") %&gt;'&gt;&lt;/asp:Label&gt;&lt;br /&gt;            &lt;asp:Image ID="Image1" runat="server" Height="100" Width="100" ImageUrl='&lt;%#Eval("image") %&gt;' /&gt;&lt;br/&gt;&lt;br /&gt;        &lt;/ItemTemplate&gt;&lt;br /&gt;        &lt;/asp:Repeater&gt;&lt;br /&gt; CodeBehind... &lt;br /&gt;using System.Data.SqlClient;&lt;br /&gt;using System.Web.Configuration;&lt;br /&gt;&lt;br /&gt; protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        SqlConnection con = new SqlConnection(WebConfigurationManager.ConnectionStrings["myConnection"].ConnectionString);&lt;br /&gt;        SqlCommand cmd = new SqlCommand("select * from images",con);&lt;br /&gt;        SqlDataAdapter da = new SqlDataAdapter(cmd);&lt;br /&gt;        DataTable dt = new DataTable();&lt;br /&gt;        da.Fill(dt);&lt;br /&gt;        Repeater1.DataSource = dt;&lt;br /&gt;        Repeater1.DataBind();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;Regard &lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3630535135777828232?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3630535135777828232/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/02/upload-image-in-database-and-display.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3630535135777828232'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3630535135777828232'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/02/upload-image-in-database-and-display.html' title='Upload Image in Database and Display Image'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3203672633615469898</id><published>2010-02-03T23:41:00.000-08:00</published><updated>2010-02-03T23:43:32.477-08:00</updated><title type='text'>Install Silver Light</title><content type='html'>Hi,&lt;br /&gt;&lt;br /&gt;Mostly many person not know how to install silverlight so,follow this steps: &lt;br /&gt;1 Microsoft visual studio 2008 (SP1) &lt;br /&gt;2 Silverlight tool.exe &lt;br /&gt;3 Microsoft Expression Blend 2.0 &lt;br /&gt;4 Microsoft Expression Blend 2.0 (SP1) &lt;br /&gt;5 Silverlight tool kit 2 March &lt;br /&gt;&lt;br /&gt;Regard &lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3203672633615469898?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3203672633615469898/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2010/02/install-silver-light.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3203672633615469898'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3203672633615469898'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2010/02/install-silver-light.html' title='Install Silver Light'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3993413280163406943</id><published>2009-12-30T23:53:00.000-08:00</published><updated>2009-12-30T23:56:28.050-08:00</updated><title type='text'>Delete Type URL from AddressBar</title><content type='html'>using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Security.Permissions;&lt;br /&gt;using Microsoft.Win32;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]&lt;br /&gt;[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]&lt;br /&gt;&lt;br /&gt;then declare below static constant string varible:&lt;br /&gt;&lt;br /&gt;   public static SortedList&lt;int, histlink&gt; historylinks = new SortedList&lt;int, histlink&gt;();&lt;br /&gt;    public const string REG_URL = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS";&lt;br /&gt;    public const string REG_URL_SHORT = "SOFTWARE\\MICROSOFT\\INTERNET EXPLORER"; &lt;br /&gt;&lt;br /&gt;then here is the code for:&lt;br /&gt;&lt;br /&gt;GetHistory();&lt;br /&gt;        int deletedhist = 0;&lt;br /&gt;        using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL, true))&lt;br /&gt;        {&lt;br /&gt;            if (tempKey == null)&lt;br /&gt;            {&lt;br /&gt;                System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",&lt;br /&gt;                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;br /&gt;            } // if&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                foreach (histlink hl in historylinks.Values)&lt;br /&gt;                {&lt;br /&gt;                    tempKey.DeleteValue(hl.URL);&lt;br /&gt;                    deletedhist++;&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        GetHistory();&lt;br /&gt;        lbl_message.Text = "Typed URL's cleared";&lt;br /&gt;&lt;br /&gt;and here is the code for gethistory function:&lt;br /&gt;&lt;br /&gt;  public void GetHistory()&lt;br /&gt;    {&lt;br /&gt;        historylinks.Clear();&lt;br /&gt;        using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))&lt;br /&gt;        {&lt;br /&gt;            if (tempKey == null)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))&lt;br /&gt;                {&lt;br /&gt;                    if (tempKeyShort == null)&lt;br /&gt;                    {&lt;br /&gt;                        MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",&lt;br /&gt;                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;br /&gt;                        return;&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))&lt;br /&gt;        {&lt;br /&gt;            if (tempKey == null)&lt;br /&gt;            {&lt;br /&gt;                System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",&lt;br /&gt;                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;br /&gt;                return;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            string[] vals = tempKey.GetValueNames();&lt;br /&gt;            int itemcounter = 0;&lt;br /&gt;            foreach (string url in vals)&lt;br /&gt;            {&lt;br /&gt;                object keyValue = tempKey.GetValue(url);&lt;br /&gt;                if (keyValue != null)&lt;br /&gt;                {&lt;br /&gt;                    histlink hl = new histlink();&lt;br /&gt;                    string entry = keyValue.ToString();&lt;br /&gt;                    if (entry.Length != 0)&lt;br /&gt;                    {&lt;br /&gt;                        itemcounter++;&lt;br /&gt;                        hl.Entry = entry;&lt;br /&gt;                        hl.URL = url;&lt;br /&gt;                        historylinks.Add(itemcounter, hl);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3993413280163406943?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3993413280163406943/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-type-url-from-addressbar.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3993413280163406943'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3993413280163406943'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-type-url-from-addressbar.html' title='Delete Type URL from AddressBar'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-9140346485720751301</id><published>2009-12-30T23:48:00.000-08:00</published><updated>2009-12-30T23:52:17.764-08:00</updated><title type='text'>Deleting historyfile</title><content type='html'>In this code the header files and assembly files are same as Delete Cache which i post early&lt;br /&gt;&lt;br /&gt;and the code is:&lt;br /&gt;&lt;br /&gt;//textBox is used for deleting particular history file&lt;br /&gt;&lt;br /&gt;  string enteredtext = txt_url.Text.Trim();&lt;br /&gt;        string lowertext = txt_url.Text.ToLower();&lt;br /&gt;        string uppertext = txt_url.Text.ToUpper();&lt;br /&gt;&lt;br /&gt;        string[] historyfile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.History), "*", SearchOption.AllDirectories);&lt;br /&gt;        for (int i = 0; i &lt; historyfile.Count(); i++)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                    File.Delete(historyfile.ElementAt(i));&lt;br /&gt;                    lbl_message.Text = historyfile.ElementAt(i)+ " cleared";&lt;br /&gt;                &lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(ex.Message);&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//this is the function which I used :&lt;br /&gt;&lt;br /&gt;  public void GetHistory()&lt;br /&gt;    {&lt;br /&gt;        historylinks.Clear();&lt;br /&gt;        using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))&lt;br /&gt;        {&lt;br /&gt;            if (tempKey == null)&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                using (RegistryKey tempKeyShort = Registry.CurrentUser.OpenSubKey(REG_URL_SHORT, true))&lt;br /&gt;                {&lt;br /&gt;                    if (tempKeyShort == null)&lt;br /&gt;                    {&lt;br /&gt;                        MessageBox.Show("The registry entry for " + REG_URL_SHORT + " does not exist!",&lt;br /&gt;                        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;br /&gt;                        return;&lt;br /&gt;                    }&lt;br /&gt;                    else&lt;br /&gt;                    {&lt;br /&gt;                        tempKeyShort.CreateSubKey("TypedURLs", RegistryKeyPermissionCheck.ReadWriteSubTree);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        using (RegistryKey tempKey = Registry.CurrentUser.OpenSubKey(REG_URL))&lt;br /&gt;        {&lt;br /&gt;            if (tempKey == null)&lt;br /&gt;            {&lt;br /&gt;                System.Windows.Forms.MessageBox.Show("The registry entry for " + REG_URL + " does not exist!",&lt;br /&gt;                "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);&lt;br /&gt;                return;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            string[] vals = tempKey.GetValueNames();&lt;br /&gt;            int itemcounter = 0;&lt;br /&gt;            foreach (string url in vals)&lt;br /&gt;            {&lt;br /&gt;                object keyValue = tempKey.GetValue(url);&lt;br /&gt;                if (keyValue != null)&lt;br /&gt;                {&lt;br /&gt;                    histlink hl = new histlink();&lt;br /&gt;                    string entry = keyValue.ToString();&lt;br /&gt;                    if (entry.Length != 0)&lt;br /&gt;                    {&lt;br /&gt;                        itemcounter++;&lt;br /&gt;                        hl.Entry = entry;&lt;br /&gt;                        hl.URL = url;&lt;br /&gt;                        historylinks.Add(itemcounter, hl);&lt;br /&gt;                    }&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-9140346485720751301?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/9140346485720751301/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/deleting-historyfile.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/9140346485720751301'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/9140346485720751301'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/deleting-historyfile.html' title='Deleting historyfile'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7217170819749264031</id><published>2009-12-30T23:45:00.000-08:00</published><updated>2009-12-30T23:48:25.666-08:00</updated><title type='text'>Delete Temp File from Browser</title><content type='html'>In this code the header files and assembly files are same as Delete Cache which i post early&lt;br /&gt;&lt;br /&gt;and the code is:&lt;br /&gt;&lt;br /&gt;//textBox is used for deleting particular Temp Files&lt;br /&gt;&lt;br /&gt;string enteredtext = txt_url.Text.Trim();&lt;br /&gt;        string lowertext = txt_url.Text.ToLower();&lt;br /&gt;        string uppertext = txt_url.Text.ToUpper();&lt;br /&gt;&lt;br /&gt;        string[] tempfiles = Directory.GetFiles(Environment.GetEnvironmentVariable("TEMP"), "*", SearchOption.AllDirectories);&lt;br /&gt;        for (int i = 0; i &lt; tempfiles.Count(); i++)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (tempfiles.ElementAt(i).Contains(enteredtext) || tempfiles.ElementAt(i).Contains(lowertext) || tempfiles.ElementAt(i).Contains(uppertext))&lt;br /&gt;                {&lt;br /&gt;                    File.Delete(tempfiles.ElementAt(i));&lt;br /&gt;                    lbl_message.Text = "TEMP file cleared";&lt;br /&gt;                }&lt;br /&gt;               &lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(ex.Message);&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7217170819749264031?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7217170819749264031/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-temp-file-from-browser.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7217170819749264031'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7217170819749264031'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-temp-file-from-browser.html' title='Delete Temp File from Browser'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7948941595562494714</id><published>2009-12-30T23:41:00.000-08:00</published><updated>2009-12-30T23:45:30.834-08:00</updated><title type='text'>Delete Cookies</title><content type='html'>In this code the header files and assembly files are same as Delete Cache which i post early &lt;br /&gt;&lt;br /&gt;and the code is:&lt;br /&gt;&lt;br /&gt;//textBox is used for deleting particular Cookies&lt;br /&gt;&lt;br /&gt; string enteredtext = txt_url.Text.Trim();&lt;br /&gt;        string lowertext = txt_url.Text.ToLower();&lt;br /&gt;        string uppertext = txt_url.Text.ToUpper();&lt;br /&gt;&lt;br /&gt;        string[] cookiefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.Cookies), "*", SearchOption.AllDirectories);&lt;br /&gt;        for (int i = 0; i &lt; cookiefile.Count(); i++)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (cookiefile.ElementAt(i).Contains(enteredtext) || cookiefile.ElementAt(i).Contains(lowertext) || cookiefile.ElementAt(i).Contains(uppertext))&lt;br /&gt;                {&lt;br /&gt;                    File.Delete(cookiefile.ElementAt(i));&lt;br /&gt;                    lbl_message.Text = "Cookie cleared";&lt;br /&gt;                }&lt;br /&gt;               &lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(ex.Message);&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7948941595562494714?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7948941595562494714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7948941595562494714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7948941595562494714'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-cookies.html' title='Delete Cookies'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5062490263734867845</id><published>2009-12-30T23:31:00.000-08:00</published><updated>2009-12-30T23:41:03.430-08:00</updated><title type='text'>Delete Internet Cache</title><content type='html'>First Include Heder files and assembly files to your Web page:&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Collections.Generic;&lt;br /&gt;using System.Linq;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.Web.UI;&lt;br /&gt;using System.Web.UI.WebControls;&lt;br /&gt;using System.Security.Permissions;&lt;br /&gt;using Microsoft.Win32;&lt;br /&gt;using System.Windows.Forms;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER\\TYPEDURLS")]&lt;br /&gt;[assembly: RegistryPermission(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_CURRENT_USER\\SOFTWARE\\MICROSOFT\\INTERNET EXPLORER")]&lt;br /&gt;&lt;br /&gt;Then use this code:&lt;br /&gt;&lt;br /&gt;//below is the textBox for deleting particular Cache from your Browser&lt;br /&gt;&lt;br /&gt; string enteredtext = txt_url.Text.Trim();&lt;br /&gt;        string lowertext = txt_url.Text.ToLower();&lt;br /&gt;        string uppertext = txt_url.Text.ToUpper(); &lt;br /&gt;&lt;br /&gt;string[] internetcachefile = Directory.GetFiles(Environment.GetFolderPath(Environment.SpecialFolder.InternetCache), "*", SearchOption.AllDirectories);&lt;br /&gt;        for (int i = 0; i &lt; internetcachefile.Count(); i++)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                if (internetcachefile.ElementAt(i).Contains(enteredtext) || internetcachefile.ElementAt(i).Contains(lowertext) || internetcachefile.ElementAt(i).Contains(uppertext))&lt;br /&gt;                {&lt;br /&gt;                    File.Delete(internetcachefile.ElementAt(i));&lt;br /&gt;                    lbl_message.Text = "Cache cleared";&lt;br /&gt;                }&lt;br /&gt;                &lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(ex.Message);&lt;br /&gt;            }&lt;br /&gt;        }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5062490263734867845?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5062490263734867845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-internet-cache.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5062490263734867845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5062490263734867845'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/delete-internet-cache.html' title='Delete Internet Cache'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-4652523693745827064</id><published>2009-12-30T23:16:00.000-08:00</published><updated>2009-12-30T23:18:49.761-08:00</updated><title type='text'>Get Sensex Stock data From Yahoo Finace</title><content type='html'>StockData stockData = new StockData();&lt;br /&gt;             List&lt;StockData&gt; StockDatalist = new List&lt;StockData&gt;();&lt;br /&gt;            string serverUrl = @"http://in.finance.yahoo.com/d/quotes.csv?s=" + stockCode +"&amp;f=sl1d1t1c1ohgvj1pp2owern&amp;e=.csv";&lt;br /&gt;&lt;br /&gt;            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serverUrl);&lt;br /&gt;&lt;br /&gt;            HttpWebResponse response = (HttpWebResponse)request.GetResponse();&lt;br /&gt;&lt;br /&gt;            StreamReader reader = new StreamReader(response.GetResponseStream(),&lt;br /&gt;                Encoding.ASCII);&lt;br /&gt;&lt;br /&gt;            stockDataString = reader.ReadLine();&lt;br /&gt;            string[] stockDataContents = stockDataString.Split(',');&lt;br /&gt;&lt;br /&gt;            stockData.Code = stockCode;&lt;br /&gt;            stockData.Last = stockDataContents[1];&lt;br /&gt;            stockData.Date = stockDataContents[2];&lt;br /&gt;            stockData.Time = stockDataContents[3];&lt;br /&gt;            stockData.Change = stockDataContents[4];&lt;br /&gt;            stockData.Open = stockDataContents[5];&lt;br /&gt;            stockData.High = stockDataContents[6];&lt;br /&gt;            stockData.Low = stockDataContents[7];&lt;br /&gt;            stockData.Volume = stockDataContents[8];&lt;br /&gt;            stockData.MarketCapital = stockDataContents[9];&lt;br /&gt;            stockData.PreviousClose = stockDataContents[10];&lt;br /&gt;            stockData.PctChange = stockDataContents[11];&lt;br /&gt;            stockData.AnnRange = stockDataContents[12];&lt;br /&gt;            stockData.Earnings = stockDataContents[13];&lt;br /&gt;            stockData.PERatio = stockDataContents[14];&lt;br /&gt;            StockDatalist.Add(stockData);&lt;br /&gt;&lt;br /&gt;            response.Close();&lt;br /&gt;&lt;br /&gt;            return stockDataString;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-4652523693745827064?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/4652523693745827064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/get-sensex-stock-data-from-yahoo-finace.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4652523693745827064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4652523693745827064'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/get-sensex-stock-data-from-yahoo-finace.html' title='Get Sensex Stock data From Yahoo Finace'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5554925738562028824</id><published>2009-12-30T23:11:00.000-08:00</published><updated>2009-12-30T23:13:34.195-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Fetch the data from other website'/><title type='text'>Fetch the data from other website</title><content type='html'>// used to build entire input&lt;br /&gt;        StringBuilder sb = new StringBuilder();&lt;br /&gt;&lt;br /&gt;        // used on each read operation&lt;br /&gt;        byte[] buf = new byte[8192];&lt;br /&gt;&lt;br /&gt;        // prepare the web page we will be asking for&lt;br /&gt;        HttpWebRequest request = (HttpWebRequest)&lt;br /&gt;            WebRequest.Create("http://www.bseindia.com/mktlive/groupgain.asp");&lt;br /&gt;&lt;br /&gt;        // execute the request&lt;br /&gt;        HttpWebResponse response = (HttpWebResponse)&lt;br /&gt;            request.GetResponse();&lt;br /&gt;&lt;br /&gt;        // we will read data via the response stream&lt;br /&gt;        Stream resStream = response.GetResponseStream();&lt;br /&gt;&lt;br /&gt;        string tempString = null;&lt;br /&gt;        int count = 0;&lt;br /&gt;&lt;br /&gt;        do&lt;br /&gt;        {&lt;br /&gt;            // fill the buffer with data&lt;br /&gt;            count = resStream.Read(buf, 0, buf.Length);&lt;br /&gt;&lt;br /&gt;            // make sure we read some data&lt;br /&gt;            if (count != 0)&lt;br /&gt;            {&lt;br /&gt;                // translate from bytes to ASCII text&lt;br /&gt;                tempString = Encoding.ASCII.GetString(buf, 0, count);&lt;br /&gt;&lt;br /&gt;                // continue building the string&lt;br /&gt;                sb.Append(tempString);&lt;br /&gt;             &lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;        while (count &gt; 0); // any more data to read?&lt;br /&gt;&lt;br /&gt;       &lt;br /&gt;        &lt;br /&gt;        Response.Write(sb.ToString());&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5554925738562028824?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5554925738562028824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/12/fetch-data-from-other-website.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5554925738562028824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5554925738562028824'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/12/fetch-data-from-other-website.html' title='Fetch the data from other website'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>4</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5693411661727670924</id><published>2009-08-25T10:03:00.000-07:00</published><updated>2009-08-25T10:07:13.407-07:00</updated><title type='text'>Home  » ASP.NET &amp; Web Forms  » Uploading Multiple Files in ASP.NET 2.0: Part II</title><content type='html'>In ASP.NET 2.0, the FileUpload control enables users to upload file from your web pages. The FileUpload control consists of a text box and a browse button. Clicking on the button allow users to select a file on the client and upload it to the server. Here in this article I give the right to user to upload any number of images.&lt;br /&gt;&lt;br /&gt;Let us start how to upload multiple file on a single button click.  Follow these 2 steps&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %&amp;gt; &lt;br /&gt;  &lt;br /&gt;&amp;lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;gt; &lt;br /&gt;&amp;lt;html xmlns="http://www.w3.org/1999/xhtml"&amp;gt; &lt;br /&gt;&amp;lt;head runat="server"&amp;gt; &lt;br /&gt;    &amp;lt;title&amp;gt;Make Multiple Upload Images&amp;lt;/title&amp;gt; &lt;br /&gt;  &lt;br /&gt;    &amp;lt;script type="text/javascript" language="javascript"&amp;gt;                &lt;br /&gt;         function DecreaseRow(rowNo) &lt;br /&gt;        { &lt;br /&gt;            var hid = document.getElementById('&amp;lt;%= hidCurRow.ClientID %&amp;gt;'); &lt;br /&gt;            hid.value = rowNo; &lt;br /&gt;        } &lt;br /&gt;        function IncreseRows() &lt;br /&gt;        { &lt;br /&gt;            var hid = document.getElementById('&amp;lt;%= hidCurRow.ClientID %&amp;gt;'); &lt;br /&gt;            hid.value = ""; &lt;br /&gt;        } &lt;br /&gt;        function SetZero() &lt;br /&gt;        { &lt;br /&gt;            var hid = document.getElementById('&amp;lt;%= hidCurRow.ClientID %&amp;gt;'); &lt;br /&gt;            hid.value = "0"; &lt;br /&gt;        } &lt;br /&gt;    &amp;lt;/script&amp;gt; &lt;br /&gt;  &lt;br /&gt;&amp;lt;/head&amp;gt; &lt;br /&gt;&amp;lt;body&amp;gt; &lt;br /&gt;    &amp;lt;form id="form1" runat="server"&amp;gt; &lt;br /&gt;        &amp;lt;table cellpadding="0" cellspacing="0" width="80%" align="center"&amp;gt; &lt;br /&gt;            &amp;lt;tr&amp;gt; &lt;br /&gt;                &amp;lt;td&amp;gt; &lt;br /&gt;                    &amp;lt;asp:Table ID="tblMin" runat="server"&amp;gt; &lt;br /&gt;                        &amp;lt;asp:TableHeaderRow&amp;gt; &lt;br /&gt;                            &amp;lt;asp:TableHeaderCell&amp;gt; &lt;br /&gt;                        File &lt;br /&gt;                            &amp;lt;/asp:TableHeaderCell&amp;gt; &lt;br /&gt;                            &amp;lt;asp:TableHeaderCell&amp;gt; &lt;br /&gt;                        Remove &lt;br /&gt;                            &amp;lt;/asp:TableHeaderCell&amp;gt; &lt;br /&gt;                        &amp;lt;/asp:TableHeaderRow&amp;gt; &lt;br /&gt;                        &amp;lt;asp:TableRow&amp;gt; &lt;br /&gt;                            &amp;lt;asp:TableCell&amp;gt; &lt;br /&gt;                                &amp;lt;asp:FileUpload ID="fu1" runat="server" /&amp;gt; &lt;br /&gt;                            &amp;lt;/asp:TableCell&amp;gt; &lt;br /&gt;                            &amp;lt;asp:TableHeaderCell&amp;gt; &lt;br /&gt;                                &amp;lt;asp:Button ID="btn1" runat="server" Text="Remove" OnClientClick="return DecreaseRow('1');" /&amp;gt; &lt;br /&gt;                            &amp;lt;/asp:TableHeaderCell&amp;gt; &lt;br /&gt;                        &amp;lt;/asp:TableRow&amp;gt; &lt;br /&gt;                    &amp;lt;/asp:Table&amp;gt; &lt;br /&gt;                    &amp;lt;asp:Button ID="btnAdd" runat="server" OnClick="btnAdd_Click" Text="Add" OnClientClick="return IncreseRows();" /&amp;gt; &lt;br /&gt;                    &amp;lt;asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" &lt;br /&gt;                        OnClientClick="SetZero();" /&amp;gt;&amp;lt;br /&amp;gt; &lt;br /&gt;                    &amp;lt;asp:HiddenField ID="hidMax" runat="server" Value="1" /&amp;gt; &lt;br /&gt;                    &amp;lt;asp:HiddenField ID="hidRow" runat="server" Value="1" /&amp;gt; &lt;br /&gt;                    &amp;lt;asp:HiddenField ID="hidCurRow" runat="server" /&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;/form&amp;gt; &lt;br /&gt;&amp;lt;/body&amp;gt; &lt;br /&gt;&amp;lt;/html&amp;gt;&lt;br /&gt;&lt;br /&gt;This is the cs code&lt;br /&gt;using System; &lt;br /&gt;using System.Data; &lt;br /&gt;using System.Configuration; &lt;br /&gt;using System.Web; &lt;br /&gt;using System.Web.Security; &lt;br /&gt;using System.Web.UI; &lt;br /&gt;using System.Web.UI.WebControls; &lt;br /&gt;using System.Web.UI.WebControls.WebParts; &lt;br /&gt;using System.Web.UI.HtmlControls; &lt;br /&gt;using System.IO; &lt;br /&gt;  &lt;br /&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;        if (Page.IsPostBack == true) &lt;br /&gt;        { &lt;br /&gt;            AddRows(); &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;    private void AddRows() &lt;br /&gt;    { &lt;br /&gt;        try &lt;br /&gt;        { &lt;br /&gt;            if (hidCurRow.Value != "" &amp;&amp; hidCurRow.Value != "0") &lt;br /&gt;            { &lt;br /&gt;                DecreaseCount(); &lt;br /&gt;            } &lt;br /&gt;            else if (hidCurRow.Value == "") &lt;br /&gt;            { &lt;br /&gt;                IncreaseCount(); &lt;br /&gt;            } &lt;br /&gt;  &lt;br /&gt;            for (int count = 1; count &amp;lt; tblMin.Rows.Count; count++) &lt;br /&gt;            { &lt;br /&gt;                tblMin.Rows.RemoveAt(1); &lt;br /&gt;            } &lt;br /&gt;  &lt;br /&gt;            int maxRows = Convert.ToInt32(hidMax.Value); &lt;br /&gt;            string[] arrRows = hidRow.Value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); &lt;br /&gt;            for (int count = 1; count &amp;lt;= maxRows; count++) &lt;br /&gt;            { &lt;br /&gt;                Boolean isAdd = false; &lt;br /&gt;                for (int incount = 0; incount &amp;lt; arrRows.Length; incount++) &lt;br /&gt;                { &lt;br /&gt;                    if (arrRows[incount] == count.ToString()) &lt;br /&gt;                    { &lt;br /&gt;                        isAdd = true; &lt;br /&gt;                        break; &lt;br /&gt;                    } &lt;br /&gt;                } &lt;br /&gt;  &lt;br /&gt;                if (isAdd == true) &lt;br /&gt;                { &lt;br /&gt;                    TableRow tr = new TableRow(); &lt;br /&gt;  &lt;br /&gt;                    TableCell tcfu = new TableCell(); &lt;br /&gt;                    FileUpload fup = new FileUpload(); &lt;br /&gt;                    fup.ID = "fu" + count.ToString(); &lt;br /&gt;                    tcfu.Controls.Add(fup); &lt;br /&gt;  &lt;br /&gt;                    TableCell tcbtn = new TableCell(); &lt;br /&gt;                    Button bt = new Button(); &lt;br /&gt;                    bt.ID = "btn" + count.ToString(); &lt;br /&gt;                    bt.Text = "Remove"; &lt;br /&gt;                    bt.Attributes.Add("onclick", "DecreaseRow('" + count.ToString() + "');"); &lt;br /&gt;                    tcbtn.Controls.Add(bt); &lt;br /&gt;                    tr.Cells.Add(tcfu); &lt;br /&gt;                    tr.Cells.Add(tcbtn); &lt;br /&gt;                    tblMin.Rows.Add(tr); &lt;br /&gt;                } &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;        catch &lt;br /&gt;        { &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;  &lt;br /&gt;    private void IncreaseCount() &lt;br /&gt;    { &lt;br /&gt;        string strVal = hidMax.Value; &lt;br /&gt;        if (strVal != "") &lt;br /&gt;        { &lt;br /&gt;            int iMax = Convert.ToInt32(strVal); &lt;br /&gt;            iMax = iMax + 1; &lt;br /&gt;            hidMax.Value = iMax.ToString(); &lt;br /&gt;  &lt;br /&gt;            if (hidRow.Value != "") &lt;br /&gt;            { &lt;br /&gt;                hidRow.Value = hidRow.Value + "," + iMax.ToString(); &lt;br /&gt;            } &lt;br /&gt;            else &lt;br /&gt;            { &lt;br /&gt;                hidRow.Value = iMax.ToString(); &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;  &lt;br /&gt;    private void DecreaseCount() &lt;br /&gt;    { &lt;br /&gt;        string strCurRow = hidCurRow.Value; &lt;br /&gt;        string[] arrRows = hidRow.Value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); &lt;br /&gt;        hidRow.Value = ""; &lt;br /&gt;        for (int count = 0; count &amp;lt; arrRows.Length; count++) &lt;br /&gt;        { &lt;br /&gt;            if (arrRows[count] != strCurRow) &lt;br /&gt;            { &lt;br /&gt;                if (hidRow.Value == "") &lt;br /&gt;                { &lt;br /&gt;                    hidRow.Value = arrRows[count]; &lt;br /&gt;                } &lt;br /&gt;                else &lt;br /&gt;                { &lt;br /&gt;                    hidRow.Value = hidRow.Value + "," + arrRows[count]; &lt;br /&gt;                } &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;  &lt;br /&gt;    protected void btnAdd_Click(object sender, EventArgs e) &lt;br /&gt;    { &lt;br /&gt;  &lt;br /&gt;    } &lt;br /&gt;  &lt;br /&gt;    protected void btnSubmit_Click(object sender, EventArgs e) &lt;br /&gt;    { &lt;br /&gt;        if (hidRow.Value != "") &lt;br /&gt;        { &lt;br /&gt;            string[] strVal = hidRow.Value.Split(",".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); &lt;br /&gt;            for (int count = 0; count &amp;lt; strVal.Length; count++) &lt;br /&gt;            { &lt;br /&gt;                FileUpload fup = new FileUpload(); &lt;br /&gt;                fup = (FileUpload)tblMin.FindControl("fu" + strVal[count]); &lt;br /&gt;                if (fup != null) &lt;br /&gt;                { &lt;br /&gt;                    if (fup.PostedFile != null &amp;&amp; fup.FileName != "") &lt;br /&gt;                    { &lt;br /&gt;                        fup.SaveAs(Server.MapPath("MyFiles") + "\\" + Path.GetFileName(fup.FileName)); &lt;br /&gt;                    } &lt;br /&gt;                } &lt;br /&gt;            } &lt;br /&gt;        } &lt;br /&gt;    } &lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5693411661727670924?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5693411661727670924/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/home-aspnet-web-forms-uploading.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5693411661727670924'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5693411661727670924'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/home-aspnet-web-forms-uploading.html' title='Home  » ASP.NET &amp; Web Forms  » Uploading Multiple Files in ASP.NET 2.0: Part II'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5958046484334142776</id><published>2009-08-25T09:48:00.000-07:00</published><updated>2009-08-25T09:59:26.522-07:00</updated><title type='text'>Tree View Control in Silverlight 3</title><content type='html'>Crating Silverlight Project&lt;br /&gt;&lt;br /&gt;Fire up Visual Studio 2008 and create a Silverlight Application. Name it as TreeViewSL3.&lt;br /&gt;&lt;br /&gt;The TreeView control displays data in a hierarchical manner.&lt;br /&gt;&lt;br /&gt;Open the solution in Expression Blend 3.&lt;br /&gt;&lt;br /&gt;Go ahead and a Tree View control to your application.&lt;br /&gt;&lt;br /&gt;I have changed the Background to Linear Brush.&lt;br /&gt;&lt;br /&gt;To add TreeView Item to the Tree View, just right click on it and add TreeViewItem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Add several, and if you want to add children of any parent then select the particular TreeViewItem and add another Treeview Item.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Here is the XAML code behind for the TreeView:&lt;br /&gt;&lt;br /&gt;&amp;lt;controls:TreeView x:Name="MyTreeView" HorizontalAlignment="Left" Width="197" Margin="0,0,0,202"&amp;gt&lt;br /&gt;                        &amp;lt;controls:TreeView.Background&amp;gt&lt;br /&gt;                                    &amp;lt;LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0"&amp;gt&lt;br /&gt;                                                &amp;lt;GradientStop Color="Gray" Offset="0"/&amp;gt&lt;br /&gt;                                                &amp;lt;GradientStop Color="White" Offset="1"/&amp;gt&lt;br /&gt;                                    &amp;lt;/LinearGradientBrush&amp;gt&lt;br /&gt;                        &amp;lt;/controls:TreeView.Background&amp;gt&lt;br /&gt;                        &amp;lt;controls:TreeViewItem Margin="0" Header="Item 1"&amp;gt&lt;br /&gt;                                    &amp;lt;controls:TreeViewItem Margin="0" Header="Sub Item 1"/&amp;gt&lt;br /&gt;                        &amp;lt;/controls:TreeViewItem&amp;gt&lt;br /&gt;                        &amp;lt;controls:TreeViewItem Margin="0" Header="Item 2"&amp;gt&lt;br /&gt;                                    &amp;lt;controls:TreeViewItem Margin="0" Header="Sub Item 1"/&amp;gt&lt;br /&gt;                                    &amp;lt;controls:TreeViewItem Margin="0" Header="Sub Item 2"/&amp;gt&lt;br /&gt;                        &amp;lt;/controls:TreeViewItem&amp;gt&lt;br /&gt;                        &amp;lt;controls:TreeViewItem Margin="0" Header="Item 3"&amp;gt&lt;br /&gt;                                    &amp;lt;controls:TreeViewItem Margin="0" Header="Sub Item 1"&amp;gt&lt;br /&gt;                                                &amp;lt;controls:TreeViewItem Margin="0" Header="Sub Item 1"/&amp;gt&lt;br /&gt;                                    &amp;lt;/controls:TreeViewItem&amp;gt&lt;br /&gt;                        &amp;lt;/controls:TreeViewItem&amp;gt&lt;br /&gt;  &amp;lt;/controls:TreeView&amp;gt&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Now if you run the application you can expand or collapse a particular TreeViewItem.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard &lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5958046484334142776?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5958046484334142776/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/tree-view-control-in-silverlight-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5958046484334142776'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5958046484334142776'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/tree-view-control-in-silverlight-3.html' title='Tree View Control in Silverlight 3'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-934625416365539645</id><published>2009-08-25T09:44:00.000-07:00</published><updated>2009-08-25T09:48:44.190-07:00</updated><title type='text'>File Upload in Silverlight</title><content type='html'>Step 1: First, create a Silverlight Web application in Visual Studio 2008. You will see your default Page.xaml.&lt;br /&gt;&lt;br /&gt;Step 2: On Create Page.xaml, change your code by adding following Panel, Button, and TextBlock controls.&lt;br /&gt;&lt;br /&gt;On buttin click event handler, I write code to call the OpenFileDialog that allows us to browse files and gives us the selected file name. &lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Here is the code. &lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;public void Button_Click(object sender, RoutedEventArgs e)&lt;br /&gt;        {&lt;br /&gt;            OpenFileDialog dlg = new OpenFileDialog();          &lt;br /&gt;            dlg.Multiselect = false;&lt;br /&gt;            dlg.Filter = "All files (*.*)|*.*|PNG Images (*.png)|*.png";&lt;br /&gt;&lt;br /&gt;            bool? retval = dlg.ShowDialog();&lt;br /&gt;&lt;br /&gt;            if (retval != null &amp;&amp; retval == true)&lt;br /&gt;            {&lt;br /&gt;                UploadFile(dlg.File.Name, dlg.File.OpenRead());&lt;br /&gt;                StatusText.Text = dlg.File.Name;&lt;br /&gt;            }&lt;br /&gt;            else&lt;br /&gt;            {&lt;br /&gt;                StatusText.Text = "No file selected...";&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;As you can see from the above code, I call a method UploadFile by passing the selected file name from the OpenFileDialog.&lt;br /&gt;&lt;br /&gt;The UploadFile method looks like following. In this code, I use a WebClient class and a PushData method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private void UploadFile(string fileName, Stream data)&lt;br /&gt;        {&lt;br /&gt;            UriBuilder ub = new UriBuilder("http://localhost:3840/receiver.ashx");&lt;br /&gt;            ub.Query = string.Format("filename={0}", fileName);&lt;br /&gt;&lt;br /&gt;            WebClient c = new WebClient();&lt;br /&gt;            c.OpenWriteCompleted += (sender, e) =&gt;&lt;br /&gt;            {&lt;br /&gt;                PushData(data, e.Result);&lt;br /&gt;                e.Result.Close();&lt;br /&gt;                data.Close();&lt;br /&gt;            };&lt;br /&gt;            c.OpenWriteAsync(ub.Uri);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        private void PushData(Stream input, Stream output)&lt;br /&gt;        {&lt;br /&gt;            byte[] buffer = new byte[4096];&lt;br /&gt;            int bytesRead;&lt;br /&gt;&lt;br /&gt;            while ((bytesRead = input.Read(buffer, 0, buffer.Length)) != 0)&lt;br /&gt;            {&lt;br /&gt;                output.Write(buffer, 0, bytesRead);&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;Step 3: Add a new Generic Handler receiver.ashx.&lt;br /&gt;&lt;br /&gt;Now let's add a class. Right click on the project and Add a new item by selecting Generic Handler in the right side templates as &lt;br /&gt;&lt;br /&gt;And add the following code on the coe behind:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ WebHandler Language="C#" Class="receiver" %&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Web;&lt;br /&gt;using System.IO;&lt;br /&gt;&lt;br /&gt;public class receiver : IHttpHandler {&lt;br /&gt;&lt;br /&gt;       public void ProcessRequest (HttpContext context) {&lt;br /&gt;        string filename = context.Request.QueryString["filename"].ToString();&lt;br /&gt;&lt;br /&gt;        using (FileStream fs = File.Create(context.Server.MapPath("~/App_Data/" + filename)))&lt;br /&gt;        {&lt;br /&gt;            SaveFile(context.Request.InputStream, fs);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void SaveFile(Stream stream, FileStream fs)&lt;br /&gt;    {&lt;br /&gt;        byte[] buffer = new byte[4096];&lt;br /&gt;        int bytesRead;&lt;br /&gt;        while ((bytesRead = stream.Read(buffer, 0, buffer.Length)) != 0)&lt;br /&gt;        {&lt;br /&gt;            fs.Write(buffer, 0, bytesRead);&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt; &lt;br /&gt;    public bool IsReusable {&lt;br /&gt;        get {&lt;br /&gt;            return false;&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 4: Build and Run&lt;br /&gt;&lt;br /&gt;That's all. You are done. Now just build and run your project. &lt;br /&gt;&lt;br /&gt;When you click the Select File button, you will see Browse files dialog that lets you browse the files. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Note: You need to make sure your folder on the Web has write permissions to upload files.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-934625416365539645?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/934625416365539645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/file-upload-in-silverlight.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/934625416365539645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/934625416365539645'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/file-upload-in-silverlight.html' title='File Upload in Silverlight'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7987724113452113271</id><published>2009-08-19T10:07:00.000-07:00</published><updated>2009-08-19T10:08:31.965-07:00</updated><title type='text'>What is SQL Injection</title><content type='html'>SQL Injection is an attack of non-valid inputs passed through web application for execution by a backend database , simply It is a trick to inject data to SQL query/command as an input possibly via web pages.&lt;br /&gt;&lt;br /&gt;Best example for this, when a user login the web page that user name and password and make SQL query to the database to check if a user has valid name and password. With SQL Injection, it is possible for us to send crafted user name and/or password field that will change the SQL query and grant us.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL Query :&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;sqlquery = “ SELECT USERNAME FROM USERLOGINTABLE WHERE USERNAME = ‘ “ + strusername + “ ’ AND PASSWORD = ‘“ + strpwd + “ ’ ”;&lt;br /&gt;&lt;br /&gt;sqlqueryresult = GetQueryresult(sqlquery);&lt;br /&gt;&lt;br /&gt;if (sqlqueryresult = string.empty)&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;Response.write(“User login failed”);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Else&lt;br /&gt;&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;Response.redirect(“home.aspx”);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;User passes ‘VIJI’ and ‘PASS’  as username and password respectively. If the user is a valid by executing the above SQL command, web page redirect to home page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Look here, if user passes the below inputs Strusername as ‘ OR ‘ ‘ = ‘ and Strpwd as ‘ OR ‘ ‘ = ‘ then dynamic query will be&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;“ SELECT USERNAME FROM USERLOGINTABLE WHERE USERNAME = ‘ OR ‘ ‘ = ‘ AND PASSWORD = ‘ OR ‘ ‘ = ‘ “&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Few judgment of this query:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    * There is no syntax error&lt;br /&gt;&lt;br /&gt;    * There is no conflict between the operators.&lt;br /&gt;&lt;br /&gt;    * Inputs are not valid. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Web application will redirect the home page even input are invalid because result of the query will be true. The query compares the first single quotation and another quotation (means nothing) then OR is an operator. When comparing nothing to =, it returns true. Same execution is applied for password. These kind inputs are called vulnerable inputs to SQL commands.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Disadvantages&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;SQL injection provides a facility to the net hackers to pull the data from the backend database by supplying the vulnerable inputs.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Will Continue writing on the&lt;br /&gt;&lt;br /&gt;Attacks of the SQL Injection&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    * Select Command.&lt;br /&gt;&lt;br /&gt;    * Insert Command.&lt;br /&gt;&lt;br /&gt;    * Using SQL Stored Procedures. &lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7987724113452113271?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7987724113452113271/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/what-is-sql-injection.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7987724113452113271'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7987724113452113271'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/what-is-sql-injection.html' title='What is SQL Injection'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6316677059399243375</id><published>2009-08-19T10:02:00.000-07:00</published><updated>2009-08-19T10:03:23.679-07:00</updated><title type='text'>.Net Shortcuts</title><content type='html'>.Net Keyboard Shortcuts&lt;br /&gt;&lt;br /&gt;Key board shortcut keys always help to increase your speed. So i am giving below some of the Keyboard Shortcuts which will be very useful.&lt;br /&gt;Ctrl + N :- Opens the New Project Dialogue Box&lt;br /&gt;Ctrl + Shift + O :- Opens the Open File Dialog Box&lt;br /&gt;Ctrl + Shift + A :- Opens Add New Item window&lt;br /&gt;Ctrl + D :- Opens Add Existing Item window&lt;br /&gt;Ctrl + F :- Opens Find window&lt;br /&gt;Ctrl + H :- Opens Find and Replace window&lt;br /&gt;Ctrl + Shift + H :- Opens Replace in Files window&lt;br /&gt;Ctrl + Alt + Shift + F12 :- Opens Find Symbol window&lt;br /&gt;F7 :- Opens Code Designer window&lt;br /&gt;Shift + F7 :- Gets you back to Design View&lt;br /&gt;Ctrl + R :- Opens the Solution Explorer window&lt;br /&gt;Ctrl + Alt + S :- Opens the Server Explorer window&lt;br /&gt;Ctrl + Shift + C :- Opens the Class View window&lt;br /&gt;F4 :- Opens the Properties window&lt;br /&gt;Ctrl + Shift + E :- Opens the Resource view window&lt;br /&gt;Ctrl + Alt + X :- Opens the Toolbar window&lt;br /&gt;Shift + Alt + Enter :- Takes you to Full Screen View&lt;br /&gt;Alt+F8 :- Opens Macro Explorer window&lt;br /&gt;F2 :- Opens Object Browser window&lt;br /&gt;Ctrl + Alt + T :- Opens Document Outline window&lt;br /&gt;Ctrl + Alt + K :- Opens Task List window&lt;br /&gt;Ctrl + Alt + A :- Opens Command window&lt;br /&gt;Ctrl + Alt + O :- Opens Output window&lt;br /&gt;Ctrl + Alt + Y :- Opens Find Symbol Results window&lt;br /&gt;Ctrl + Alt + F :- Lists Items under the Favorites Menu in your&lt;br /&gt;Ctrl + Shift + B :- Builds your project&lt;br /&gt;Ctrl + Shift + F9 :- Clears All Breakpoints&lt;br /&gt;Ctrl + Alt + P :- Opens the Processes Dialog box&lt;br /&gt;Ctrl + T :- Opens Customize Toolbox window&lt;br /&gt;Ctrl + Shift + P :- Runs Temporary Macro&lt;br /&gt;Ctrl + Shift + R :- Records Temporary Macro&lt;br /&gt;Alt + F11 :- Opens Macros IDE&lt;br /&gt;F5 :- Runs your Application&lt;br /&gt;Ctrl + F5 :- Runs your Application without Debugging&lt;br /&gt;Ctrl + Alt + E :- Opens the Exceptions Dialog Box&lt;br /&gt;F8 :- Used while Debugging Applications&lt;br /&gt;Shift + F8 :- Used While Debugging Applications&lt;br /&gt;Ctrl + B :- Inserts a New Breakpoint&lt;br /&gt;F10:-Line By Line execution&lt;br /&gt;Ctrl+Tab:-To Shift B/W .net Editor Pages&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6316677059399243375?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6316677059399243375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/net-shortcuts.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6316677059399243375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6316677059399243375'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/net-shortcuts.html' title='.Net Shortcuts'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-2400033558600139953</id><published>2009-08-19T09:57:00.000-07:00</published><updated>2009-08-19T09:58:06.591-07:00</updated><title type='text'>Randomly selecting row from database</title><content type='html'>Selecting a Random Row From Databse:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Description:&lt;br /&gt;&lt;br /&gt;If you want to select row randomly from the databse, you can use this.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Stored Procedure:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;CREATE PROCEDURE PS_GetRandomProduct&lt;br /&gt;AS&lt;br /&gt;DECLARE @NoOfRows int&lt;br /&gt;Begin&lt;br /&gt;  SELECT @NoOfRows = max(ProductId) FROM Products&lt;br /&gt;&lt;br /&gt;  SELECT QuantityPerUnit, ProductName FROM Products&lt;br /&gt;    WHERE ProductId = (SELECT CAST((RAND()* @NoOfRows) AS int) + 1)&lt;br /&gt;End&lt;br /&gt;GO&lt;br /&gt;&lt;br /&gt;Explanation:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;ProductId  is the primary key of the table (Products). It is the identity field&lt;br /&gt;&lt;br /&gt;(auto-incrementing).we are taking maximum value of identity field and assigning&lt;br /&gt;&lt;br /&gt;this value into the variable @NoOfRows.A random number is then generated with a br&gt;&lt;br /&gt;maximum possible value of @NoOfRows.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;&lt;br /&gt;&lt;br /&gt;The rand() function generates a random number between 0 and 1, which is multiplied &lt;br /&gt;&lt;br /&gt;to the @NoOfRows variable.You may be wondering why 1 is added to the result. The &lt;br /&gt;&lt;br /&gt;reason is that the rand() function may return 0 while the ProductId column starts at 1.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-2400033558600139953?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/2400033558600139953/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/randomly-selecting-row-from-database.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2400033558600139953'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2400033558600139953'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/randomly-selecting-row-from-database.html' title='Randomly selecting row from database'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-1977232179705115027</id><published>2009-08-19T09:50:00.001-07:00</published><updated>2009-08-19T09:52:11.745-07:00</updated><title type='text'>Stored procedure and Trigger</title><content type='html'>Stored Procedure&lt;br /&gt;&lt;br /&gt;A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database data dictionary.&lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create procedure Empp @eusername nvarchar(20),@epassword nvarchar(20),@EEmpid nvarchar(20)&lt;br /&gt;as &lt;br /&gt;begin &lt;br /&gt;insert into Emp (UserName,PassWord,EmpID) values(@eusername,@epassword,@EEmpid)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can insert the values like this: empp 'Rengan','Nathan','1050'&lt;br /&gt;&lt;br /&gt;Trigger&lt;br /&gt;&lt;br /&gt;A database trigger is procedural code that is automatically executed in response to certain events on a particular table in a database. Triggers can restrict access to specific data, perform logging, or audit data modifications.&lt;br /&gt;&lt;br /&gt;Trigger Example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create trigger tri_update on Emp&lt;br /&gt;for update&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;if update(EmpID)&lt;br /&gt;begin&lt;br /&gt;print'not update here'&lt;br /&gt;rollback transaction&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-1977232179705115027?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/1977232179705115027/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/stored-procedure-and-trigger.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1977232179705115027'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1977232179705115027'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/stored-procedure-and-trigger.html' title='Stored procedure and Trigger'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7263478558113564505</id><published>2009-08-19T09:50:00.000-07:00</published><updated>2009-08-19T09:52:27.393-07:00</updated><title type='text'>Stored procedure and Trigger</title><content type='html'>Stored Procedure&lt;br /&gt;&lt;br /&gt;A stored procedure is a subroutine available to applications accessing a relational database system. Stored procedures (sometimes called a sproc or SP) are actually stored in the database data dictionary.&lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create procedure Empp @eusername nvarchar(20),@epassword nvarchar(20),@EEmpid nvarchar(20)&lt;br /&gt;as &lt;br /&gt;begin &lt;br /&gt;insert into Emp (UserName,PassWord,EmpID) values(@eusername,@epassword,@EEmpid)&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;You can insert the values like this: empp 'Rengan','Nathan','1050'&lt;br /&gt;&lt;br /&gt;Trigger&lt;br /&gt;&lt;br /&gt;A database trigger is procedural code that is automatically executed in response to certain events on a particular table in a database. Triggers can restrict access to specific data, perform logging, or audit data modifications.&lt;br /&gt;&lt;br /&gt;Trigger Example&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;create trigger tri_update on Emp&lt;br /&gt;for update&lt;br /&gt;as&lt;br /&gt;begin&lt;br /&gt;if update(EmpID)&lt;br /&gt;begin&lt;br /&gt;print'not update here'&lt;br /&gt;rollback transaction&lt;br /&gt;end&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7263478558113564505?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7263478558113564505/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/stored-procedure-and-trigger_19.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7263478558113564505'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7263478558113564505'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/stored-procedure-and-trigger_19.html' title='Stored procedure and Trigger'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-8461699659647897660</id><published>2009-08-19T09:48:00.000-07:00</published><updated>2009-08-19T09:49:05.195-07:00</updated><title type='text'>Sending Emails from Google Server</title><content type='html'>Some time we need to send mails to others from our application, and fro this we need to use some free email server like GMAIL. here is the code using that we can use the gmail mail server to send the mails. I am simply specifying the g mail SMTP server name and the Port number in the code.. take a look…&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;MailMessage mailMessage = new MailMessage();&lt;br /&gt;&lt;br /&gt;mailMessage.To.Add(”test@test.com”);&lt;br /&gt;&lt;br /&gt;mailMessage.Subject = “Test”;&lt;br /&gt;&lt;br /&gt;mailMessage.Body = “This is a test mail”;&lt;br /&gt;&lt;br /&gt;mailMessage.IsBodyHtml = true;&lt;br /&gt;&lt;br /&gt;// Create the credentials to login to the gmail account associated with my custom domain&lt;br /&gt;&lt;br /&gt;string sendEmailsFrom = “abc@xyz.com”;&lt;br /&gt;&lt;br /&gt;string sendEmailsFromPassword = “password”;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;NetworkCredential cred = new NetworkCredential(sendEmailsFrom, sendEmailsFromPassword);&lt;br /&gt;&lt;br /&gt;SmtpClient mailClient = new SmtpClient(”smtp.gmail.com”, 587);&lt;br /&gt;&lt;br /&gt;mailClient.EnableSsl = true;&lt;br /&gt;&lt;br /&gt;mailClient.DeliveryMethod = SmtpDeliveryMethod.Network;&lt;br /&gt;&lt;br /&gt;mailClient.UseDefaultCredentials = false;&lt;br /&gt;&lt;br /&gt;mailClient.Timeout = 30000;&lt;br /&gt;&lt;br /&gt;mailClient.Credentials = cred;&lt;br /&gt;&lt;br /&gt;mailClient.Send(mailMessage);&lt;br /&gt;&lt;br /&gt;Regard &lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-8461699659647897660?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/8461699659647897660/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/sending-emails-from-google-server.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/8461699659647897660'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/8461699659647897660'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/sending-emails-from-google-server.html' title='Sending Emails from Google Server'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6947740902990249879</id><published>2009-08-11T09:36:00.000-07:00</published><updated>2009-08-11T09:41:00.391-07:00</updated><title type='text'>Credit Card CVV Code Validation</title><content type='html'>Credit Card CVV Code Validation in ASP.NET&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;What is CVV?&lt;br /&gt;&lt;br /&gt;The Card Verification Value (CVV) is an extra code printed on your debit or credit card. It sometimes called Card Verification Value (CVV or CV2), Card Verification Value Code (CVVC), Card Verification Code (CVC), Verification Code (V-Code or V Code), or Card Code Verification (CCV).&lt;br /&gt;&lt;br /&gt;CVV is a new authentication procedure established by credit card companies to further efforts towards reducing fraud for internet transactions. It consists of requiring a card holder to enter the CVV number in at transaction time to verify that the card is on hand.&lt;br /&gt;&lt;br /&gt;CVV Code in Credit Cards&lt;br /&gt;&lt;br /&gt;CVV for Visa, MasterCard, BankCard and Diners is the final three digits of the number printed on the signature strip on the back of your card. CVV for American Express appears as a separate 4-digit code printed on the front of your card.&lt;br /&gt;&lt;br /&gt;CVV Code Validation&lt;br /&gt;&lt;br /&gt;We will see how to validate a CVV number using JavaScript as well as C# in this article. I have written methods/functions in C# and JavasScript respectively for this validation.&lt;br /&gt;&lt;br /&gt;The JavaScript function validateCvvCode() is used to validate a CVV code at client side. The ValidateCVVCode() written in C# is used to check the CVV code at server side. These functions determines number of digits required for the given card type and then checks if the CVV Code have the required count of digits and have only numeric digits 0 to 9 using a regular expression. The regular expression is formed dynamically based on the card type.&lt;br /&gt;&lt;br /&gt;Validation Using JavaScript&lt;br /&gt;&lt;br /&gt;The following code contains the javascript function to validation CVV code with HTML markup of the demo application.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;l;%@ Page Language="C#" AutoEventWireup="true" CodeFile="CVVValidationDemo.aspx.cs"&lt;br /&gt; Inherits="CVVValidationDemo" %&amp;g;&lt;br /&gt;&lt;br /&gt;&amp;l;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&amp;g;&lt;br /&gt;&amp;l;html xmlns="http://www.w3.org/1999/xhtml"&amp;g;&lt;br /&gt;&amp;l;head runat="server"&amp;g;&lt;br /&gt; &amp;l;title&amp;g;CVV Credit Card Number Validation &amp;l;/title&amp;g;&lt;br /&gt;&lt;br /&gt; &amp;l;script type="text/javascript" language="javascript"&amp;g;&lt;br /&gt;&lt;br /&gt;  function validateCvvCode() {&lt;br /&gt;&lt;br /&gt;   //Get the text of the selected card type&lt;br /&gt;   var cardType = document.getElementById('ddlCardType').options[document.getElementById('ddlCardType').selectedIndex].text;&lt;br /&gt;   // Get the value of the CVV code&lt;br /&gt;   var cvvCode = document.getElementById('txtCVVCode').value;&lt;br /&gt;&lt;br /&gt;   var digits = 0;&lt;br /&gt;   switch (cardType.toUpperCase()) {&lt;br /&gt;    case 'MASTERCARD':&lt;br /&gt;    case 'EUROCARD':&lt;br /&gt;    case 'EUROCARD/MASTERCARD':&lt;br /&gt;    case 'VISA':&lt;br /&gt;    case 'DISCOVER':&lt;br /&gt;     digits = 3;&lt;br /&gt;     break;&lt;br /&gt;    case 'AMEX':&lt;br /&gt;    case 'AMERICANEXPRESS':&lt;br /&gt;    case 'AMERICAN EXPRESS':&lt;br /&gt;     digits = 4;&lt;br /&gt;     break;&lt;br /&gt;    default:&lt;br /&gt;     return false;&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;   var regExp = new RegExp('[0-9]{' + digits + '}');&lt;br /&gt;   return (cvvCode.length == digits &amp;&amp; regExp.test(cvvCode))&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt;  function checkCvvCode() {&lt;br /&gt;&lt;br /&gt;   var result = validateCvvCode();&lt;br /&gt;   if (result)&lt;br /&gt;    alert('Valid CVV Code');&lt;br /&gt;   else&lt;br /&gt;    alert('Invalid CVV Code');&lt;br /&gt;  }  &lt;br /&gt;&lt;br /&gt; &amp;l;/script&amp;g;&lt;br /&gt;&lt;br /&gt; &amp;l;style type="text/css"&amp;g;&lt;br /&gt;  .style1&lt;br /&gt;  {&lt;br /&gt;   font-size: large;&lt;br /&gt;   font-weight: bold;&lt;br /&gt;   font-family: Arial;&lt;br /&gt;  }&lt;br /&gt; &amp;l;/style&amp;g;&lt;br /&gt;&amp;l;/head&amp;g;&lt;br /&gt;&amp;l;body&amp;g;&lt;br /&gt; &amp;l;form id="form1" runat="server"&amp;g;&lt;br /&gt; &amp;l;div&amp;g;&lt;br /&gt;  &amp;l;table width="100%" cellspacing="0" cellpadding="0"&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td class="style1"&amp;g;&lt;br /&gt;     CVV Code Validation&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;     &amp;l;asp:ValidationSummary ID="vsCVVValidationSummary" runat="server" /&amp;g;&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;     Card Type&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;     &amp;l;asp:DropDownList ID="ddlCardType" runat="server" Width="250px"&amp;g;&lt;br /&gt;     &amp;l;/asp:DropDownList&amp;g;&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;     CVV Code&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;     &amp;l;asp:TextBox ID="txtCVVCode" runat="server"&amp;g;&amp;l;/asp:TextBox&amp;g;&lt;br /&gt;     &amp;l;asp:CustomValidator ID="custValidCVV" runat="server" ErrorMessage="Invalid CVV Code"&amp;g;*&amp;l;/asp:CustomValidator&amp;g;&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;   &amp;l;tr&amp;g;&lt;br /&gt;    &amp;l;td width="200px"&amp;g;&lt;br /&gt;      &lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;    &amp;l;td&amp;g;&lt;br /&gt;     &amp;l;asp:Button ID="btnCvvServerValidate" runat="server" Text="Server Side Validation"&lt;br /&gt;      OnClick="btnCvvServerValidate_Click" /&amp;g;&lt;br /&gt;         &lt;br /&gt;     &amp;l;input id="hbtnCvvClientValidate" type="button" value="Client Side Validation" onclick="checkCvvCode()" /&amp;g;&lt;br /&gt;    &amp;l;/td&amp;g;&lt;br /&gt;   &amp;l;/tr&amp;g;&lt;br /&gt;  &amp;l;/table&amp;g;&lt;br /&gt; &amp;l;/div&amp;g;&lt;br /&gt; &amp;l;/form&amp;g;&lt;br /&gt;&amp;l;/body&amp;g;&lt;br /&gt;&amp;l;/html&amp;g;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Validation Using C#&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following code snippet has server side written in C# to demonstrate the CVV code validation. I have loaded and checked the following card types in a dropdown list for demonstration purpose: MASTERCARD, EUROCARD, EUROCARD/MASTERCARD, VISA, DISCOVER and AMERICAN EXPRESS.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System;&lt;br /&gt;using System.Data;&lt;br /&gt;using System.Text.RegularExpressions;&lt;br /&gt;&lt;br /&gt;public partial class CVVValidationDemo : System.Web.UI.Page&lt;br /&gt;{&lt;br /&gt;    protected void Page_Load(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        if (!IsPostBack)&lt;br /&gt;            BindCardType();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private void BindCardType()&lt;br /&gt;    {&lt;br /&gt;        System.Data.DataTable dtCardType = new System.Data.DataTable();&lt;br /&gt;        dtCardType.Columns.Add(new DataColumn("Card_Type_Id", typeof(int)));&lt;br /&gt;        dtCardType.Columns.Add(new DataColumn("Card_Type_Name", typeof(string)));&lt;br /&gt;&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 1, "MASTERCARD" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 2, "EUROCARD" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 3, "EUROCARD/MASTERCARD" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 4, "VISA" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 5, "DISCOVER" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 6, "AMEX" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 7, "AMERICANEXPRESS" });&lt;br /&gt;        dtCardType.Rows.Add(new object[] { 8, "AMERICAN EXPRESS" });&lt;br /&gt;&lt;br /&gt;        ddlCardType.DataSource = dtCardType;&lt;br /&gt;        ddlCardType.DataValueField = "Card_Type_Id";&lt;br /&gt;        ddlCardType.DataTextField = "Card_Type_Name";&lt;br /&gt;        ddlCardType.DataBind();&lt;br /&gt;&lt;br /&gt;    }&lt;br /&gt;    protected void btnCvvServerValidate_Click(object sender, EventArgs e)&lt;br /&gt;    {&lt;br /&gt;        custValidCVV.ErrorMessage = "Invalid CVV Code";&lt;br /&gt;        custValidCVV.IsValid = ValidateCVVCode();&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    private bool ValidateCVVCode()&lt;br /&gt;    {&lt;br /&gt;        var cardType = ddlCardType.SelectedItem.Text;&lt;br /&gt;        var cvvCode = txtCVVCode.Text;&lt;br /&gt;&lt;br /&gt;        var digits = 0;&lt;br /&gt;        switch (cardType.ToUpper())&lt;br /&gt;        {&lt;br /&gt;            case "MASTERCARD":&lt;br /&gt;            case "EUROCARD":&lt;br /&gt;            case "EUROCARD/MASTERCARD":&lt;br /&gt;            case "VISA":&lt;br /&gt;            case "DISCOVER":&lt;br /&gt;                digits = 3;&lt;br /&gt;                break;&lt;br /&gt;            case "AMEX":&lt;br /&gt;            case "AMERICANEXPRESS":&lt;br /&gt;            case "AMERICAN EXPRESS":&lt;br /&gt;                digits = 4;&lt;br /&gt;                break;&lt;br /&gt;            default:&lt;br /&gt;                return false;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        Regex regEx = new Regex("[0-9]{" + digits + "}");&lt;br /&gt;        return (cvvCode.Length == digits &amp;&amp; regEx.Match(cvvCode).Success);&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6947740902990249879?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6947740902990249879/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/credit-card-cvv-code-validation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6947740902990249879'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6947740902990249879'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/credit-card-cvv-code-validation.html' title='Credit Card CVV Code Validation'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-4076057940434372448</id><published>2009-08-11T09:34:00.000-07:00</published><updated>2009-08-11T09:35:27.886-07:00</updated><title type='text'>Lock Statement in C#.net</title><content type='html'>Lock Statement in C#.net (much usefull for bank transaction)&lt;br /&gt;&lt;br /&gt;In .NET we can lock some object while threading once execution over and then releasing the lock.Its very usefull for bank transaction&lt;br /&gt;the following example guide you to learn about Lock Statement&lt;br /&gt;&lt;br /&gt;Syntax:&lt;br /&gt;&lt;br /&gt;Object myLock = new Object();&lt;br /&gt;lock (myLock)&lt;br /&gt;{&lt;br /&gt;// code section like any bank transaction&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Explanation&lt;br /&gt;Lock statement ensures that one thread does not enter a code section while another thread is in the code section. If another thread attempts to enter&lt;br /&gt;&lt;br /&gt;a locked code, it will wait, block, until the object is released.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;namespace Lock&lt;br /&gt;{&lt;br /&gt;    class Program&lt;br /&gt;    {&lt;br /&gt;        static void Main(string[] args)&lt;br /&gt;        {&lt;br /&gt;            Thread[] threads = new Thread[10];&lt;br /&gt;            Account acc = new Account(1000);&lt;br /&gt;            for (int i = 0; i &lt; 10; i++)&lt;br /&gt;            {&lt;br /&gt;                Thread t = new Thread(new ThreadStart(acc.MyTransactions));&lt;br /&gt;                threads[i] = t;&lt;br /&gt;            }&lt;br /&gt;            for (int i = 0; i &lt; 10; i++)&lt;br /&gt;            {&lt;br /&gt;                threads[i].Start();&lt;br /&gt;            }&lt;br /&gt;            Console.Read();&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    class Account&lt;br /&gt;    {&lt;br /&gt;        private Object myLock = new Object();&lt;br /&gt;        int Bal;&lt;br /&gt;&lt;br /&gt;        Random rnd = new Random();&lt;br /&gt;&lt;br /&gt;        public Account(int iniAmount)&lt;br /&gt;        {&lt;br /&gt;            Bal = iniAmount;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        int Withdraw(int amt)&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            // This condition will never be true unless the lock statement&lt;br /&gt;            // is commented out:&lt;br /&gt;            if (Bal &lt; 0)&lt;br /&gt;            {&lt;br /&gt;                throw new Exception("Negative Balance");&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            // Comment out the next line to see the effect of leaving out &lt;br /&gt;            // the lock keyword:&lt;br /&gt;            lock (myLock)&lt;br /&gt;            {&lt;br /&gt;                if (Bal &gt;= amt)&lt;br /&gt;                {&lt;br /&gt;                    Console.WriteLine("Balance before Withdrawal :  " + Bal);&lt;br /&gt;                    Console.WriteLine("Amount to Withdraw        : -" + amt);&lt;br /&gt;                    Bal = Bal - amt;&lt;br /&gt;                    Console.WriteLine("Balance after Withdrawal  :  " + Bal);&lt;br /&gt;                    return amt;&lt;br /&gt;                }&lt;br /&gt;                else&lt;br /&gt;                {&lt;br /&gt;                    return 0; // transaction rejected&lt;br /&gt;                }&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        public void MyTransactions()&lt;br /&gt;        {&lt;br /&gt;            for (int i = 0; i &lt; 100; i++)&lt;br /&gt;            {&lt;br /&gt;                Withdraw(rnd.Next(1, 100));&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-4076057940434372448?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/4076057940434372448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/lock-statement-in-cnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4076057940434372448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4076057940434372448'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/lock-statement-in-cnet.html' title='Lock Statement in C#.net'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6608259779480267177</id><published>2009-08-11T09:32:00.000-07:00</published><updated>2009-08-11T09:33:32.911-07:00</updated><title type='text'>Empty recycle bin</title><content type='html'>Description :&lt;br /&gt;&lt;br /&gt;We can empty the recycle bin by using the bellow coding&lt;br /&gt;&lt;br /&gt;Step 1&lt;br /&gt;&lt;br /&gt;Following Namespace used&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;using System.Runtime.InteropServices;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 2&lt;br /&gt;&lt;br /&gt;Create the enum&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;enum RecycleFlags : uint&lt;br /&gt;{&lt;br /&gt;   SHERB_NOCONFIRMATION = 0x00000001,&lt;br /&gt;   SHERB_NOPROGRESSUI   = 0x00000002,&lt;br /&gt;   SHERB_NOSOUND        = 0x00000004&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 3&lt;br /&gt;&lt;br /&gt;Dll import&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;[DllImport("Shell32.dll", CharSet = CharSet.Unicode)]&lt;br /&gt;static extern uint SHEmptyRecycleBin &lt;br /&gt; (IntPtr hwnd, &lt;br /&gt; string pszRootPath,&lt;br /&gt; RecycleFlags dwFlags);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Step 4&lt;br /&gt;&lt;br /&gt;Following is the code for empty the recyclebin&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;public static void Main()&lt;br /&gt;{&lt;br /&gt;    uint MyResult = SHEmptyRecycleBin (IntPtr.Zero, null, 0);&lt;br /&gt;    Console.WriteLine ("Out put: {0}", MyResult);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6608259779480267177?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6608259779480267177/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/empty-recycle-bin.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6608259779480267177'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6608259779480267177'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/empty-recycle-bin.html' title='Empty recycle bin'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-2307770671493458821</id><published>2009-08-11T09:31:00.000-07:00</published><updated>2009-08-11T09:32:51.210-07:00</updated><title type='text'>Create your own Web Browser</title><content type='html'>Description :&lt;br /&gt;&lt;br /&gt;We can know about the browsers IE,Firefox..etc.&lt;br /&gt;We can also create our own browser. It is very easy one.&lt;br /&gt;&lt;br /&gt;We need the add following reference&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; AxInterop.SHDocVw&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The name space used for creating your own browser&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; using AxSHDocVw;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following is the sample code for creating the browser&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;    public partial class Form1 : Form&lt;br /&gt;    {&lt;br /&gt;        private AxWebBrowser Mybrowser;&lt;br /&gt;        private Button MygoButton;&lt;br /&gt;        private TextBox SearhaddressBox;&lt;br /&gt;        private Panel Mypanel1;&lt;br /&gt;        private Panel Mypanel2;&lt;br /&gt;&lt;br /&gt;        public Form1()&lt;br /&gt;        {&lt;br /&gt;            InitializeComponent();&lt;br /&gt;            Mypanel1 = new Panel();&lt;br /&gt;            Mypanel2 = new Panel();&lt;br /&gt;            Mybrowser = new AxWebBrowser();&lt;br /&gt;            Mybrowser.BeginInit();&lt;br /&gt;&lt;br /&gt;            this.SuspendLayout();&lt;br /&gt;            Mypanel1.SuspendLayout();&lt;br /&gt;            Mypanel2.SuspendLayout();&lt;br /&gt;&lt;br /&gt;            this.Text = "My own Web Browser";&lt;br /&gt;            Mypanel1.Size = new Size(300, 30);&lt;br /&gt;            Mypanel1.Dock = DockStyle.Top;&lt;br /&gt;&lt;br /&gt;            Mypanel2.Size = new Size(285, 240);&lt;br /&gt;            Mypanel2.Location = new Point(5, 31);&lt;br /&gt;            Mypanel2.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;&lt;br /&gt;&lt;br /&gt;            Mybrowser.Dock = DockStyle.Fill;&lt;br /&gt;&lt;br /&gt;            SearhaddressBox = new TextBox();&lt;br /&gt;            SearhaddressBox.Size = new Size(260, 20);&lt;br /&gt;            SearhaddressBox.Location = new Point(5, 5);&lt;br /&gt;            SearhaddressBox.Anchor = AnchorStyles.Top | AnchorStyles.Right | AnchorStyles.Left;&lt;br /&gt;&lt;br /&gt;            MygoButton = new Button();&lt;br /&gt;            MygoButton.Location = new Point(270, 5);&lt;br /&gt;            MygoButton.Size = new Size(20, 20);&lt;br /&gt;            MygoButton.Anchor = AnchorStyles.Top | AnchorStyles.Right;&lt;br /&gt;&lt;br /&gt;            Mypanel1.Controls.AddRange(new Control[] { SearhaddressBox, MygoButton });&lt;br /&gt;            Mypanel2.Controls.Add(Mybrowser);&lt;br /&gt;            this.Controls.AddRange(new Control[] { Mypanel1, Mypanel2 });&lt;br /&gt;&lt;br /&gt;            Mybrowser.EndInit();&lt;br /&gt;            Mypanel1.ResumeLayout();&lt;br /&gt;            Mypanel2.ResumeLayout();&lt;br /&gt;            this.ResumeLayout();&lt;br /&gt;&lt;br /&gt;            MygoButton.Click += new EventHandler(goButton_Click);&lt;br /&gt;            Mybrowser.GoHome();&lt;br /&gt;   &lt;br /&gt;        }&lt;br /&gt;        private void goButton_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            object o = null;&lt;br /&gt;            Mybrowser.Navigate(SearhaddressBox.Text, ref o, ref o, ref o, ref o);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Code Explanation&lt;br /&gt;1. Create instance of AxWebBrowser.&lt;br /&gt;2. Assign the controls in it.&lt;br /&gt;3. On the button click navicate the browser.&lt;br /&gt;&lt;br /&gt;Regard &lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-2307770671493458821?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/2307770671493458821/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/create-your-own-web-browser.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2307770671493458821'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2307770671493458821'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/create-your-own-web-browser.html' title='Create your own Web Browser'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5634666746000718009</id><published>2009-08-03T00:59:00.000-07:00</published><updated>2009-08-03T01:00:21.170-07:00</updated><title type='text'>Mobile Web Development in ASP.NET - Part 5</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Part5 of the series on Mobile Web Development deals with the text-based, output-only controls like PhoneCall, Link and TextView.&lt;br /&gt;&lt;br /&gt;PhoneCall Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The PhoneCall control is an easy, text-based, output-only control that is used to represent a phone number to call. &lt;br /&gt;&lt;br /&gt;Properties&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;AlternateFormat - Formatting string for the text value of the PhoneNumber property. This is used only for devices that are unable to initiate phone calls from Web content. The default value is {0} {1}, where {0} is the value of the Text property, and {1} is the value of the PhoneNumber property. &lt;br /&gt;AlternateURL - This is used for devices that are unable to initiate phone calls from Web content. The default value is null. &lt;br /&gt;PhoneNumber - Sets or returns a string that represents a phone number (required).&lt;br /&gt;SoftKeylabel - Sets or returns the label used for the command when it is displayed on a soft key. The default value is an empty string. &lt;br /&gt;Text (inherited from TextControl class) Specifies the text for a control to be rendered for devices that can initiate phone calls. The default value is Phone Number. The Text property can be specified through the Text attribute, or as inner text. &lt;br /&gt;&lt;br /&gt;The following controls can contain one or more ObjectList controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Form&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Panel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Device-Specific Behavior&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Devices with telephony capability&lt;br /&gt;On devices that support programmatically placing phone calls, the control's text is displayed as a command. Invoking that command dials the phone number or presents the user with a number of options for dialing the phone number (some cell phones automatically do the latter). If the text field is not defined, the PhoneNumber property is used. &lt;br /&gt;The rendering behavior in this case is identical to that of a Link control for the specified device.&lt;br /&gt;&lt;br /&gt;Devices without telephony capability&lt;br /&gt;The AlternateFormat property is treated as a formatting string that generates the text for displaying the phone number based on the value of the AlternateURL property. When the AlternateURL property contains null, the PhoneCall control renders the number in as the Label control for the specified device. When the AlternateURL property contains a value other than null it renders the number in the same way as the Link control for the specified device.&lt;br /&gt;&lt;br /&gt;Example7&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following example shows a phonecall control in a mobile form control.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form runat="server"&gt;&lt;br /&gt;   &lt;mobile:PhoneCall runat="server" &lt;br /&gt;      AlternateFormat="{0} at {1}"&lt;br /&gt;      AlternateURL="http://www.xyz.com"&lt;br /&gt;      phoneNumber="123-456-7890"&gt;XYZ Company&lt;br /&gt;   &lt;/mobile:PhoneCall&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Link Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It represents a hyperlink to another Form control on a mobile page or an arbitrary URL displaying the value in the Text property.&lt;br /&gt;&lt;br /&gt;When the link is clicked, control immediately changes to the page in the specified NavigateURL property. If the Text property is not defined, the default of the link is the AlternateURL property.&lt;br /&gt;&lt;br /&gt;Device Specific Behavior - HTML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;At run time, the Link control renders a link as a standard HTML tag (anchor)&lt;br /&gt;&lt;br /&gt;Device Specific Behavior - WML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A link generates markup similar to the following. &lt;br /&gt;&lt;a href="postbackinfo"&gt;TextProperty&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In both the cases, if the value of the link starts with a number symbol (#), it is rendered as a postback event. A &lt;br /&gt;tag (line break) follows the link.&lt;br /&gt;&lt;br /&gt;Example8&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form runat="server"&gt;&lt;br /&gt;  &lt;mobile:Link runat="server" &lt;br /&gt;   NavigateURL="http://mobile.msn.com"&gt;Microsoft Mobile Site&lt;/mobile:Link&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;TextView Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The TextView control sets and displays arbitrary amounts of text, with optional markup tags. It alos supports internal pagination.&lt;br /&gt;The text is rendered in the same way in both HTML and WML forms.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example9&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form id="Form1" runat="server"&gt;&lt;br /&gt;   &lt;mobile:TextView id="TextView1" StyleReference="title"&lt;br /&gt;      ForeColor="Blue" runat="server"&gt;&lt;br /&gt;      My TextView control Text.&lt;br /&gt;   &lt;/mobile:TextView&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is the last of the series of articles published on mobile web development. There are plenty of other standard controls which the users have already aware of. Most of them are similar in feature and behavior as the other controls discussed in this article.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5634666746000718009?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5634666746000718009/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-5.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5634666746000718009'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5634666746000718009'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-5.html' title='Mobile Web Development in ASP.NET - Part 5'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5471498205189124557</id><published>2009-08-03T00:58:00.000-07:00</published><updated>2009-08-03T00:59:33.736-07:00</updated><title type='text'>Mobile Web Development in ASP.NET - Part 4</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Part4 of the series on Mobile Web Development deals with the ObjectList control that offers you ways of listing data objects from data source or any other collection of items from an array or arraylist.&lt;br /&gt;&lt;br /&gt;ObjectList Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It provides a feature-rich view of a list of data objects. The ObjectList control inherits much of its behavior, including support for templated rendering by using device template sets, and internal pagination, from the List control. Although they are both lists, a ObjectList control differs in capabilities and scope from a List control. &lt;br /&gt;&lt;br /&gt;Features of ObjectList control &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Data bound&lt;br /&gt;&lt;br /&gt;ObjectList control is strictly data bound. The only way to add items to an object list in a control is by binding the list to a data source. &lt;br /&gt;Multiple-property view&lt;br /&gt;It allows you to view multiple properties, or fields, associated with each item. Depending on device characteristics, the control can be rendered as a table that displays more than one property of each object, or UI can be provided to allow the user to view additional properties of an object. &lt;br /&gt;Multiple item commands&lt;br /&gt;It allows you to associate multiple commands with each item. The set of commands for an item can be either shared among all items or unique to the item. &lt;br /&gt;Internal pagination and templating&lt;br /&gt;is supported.&lt;br /&gt;&lt;br /&gt;The following controls can contain one or more ObjectList controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Form&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Panel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ObjectList control can contain one or more of the following control.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.ObjectList.Field&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.ObjectList.Command&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Device Templates&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ObjectList control support the following device templates.&lt;br /&gt;&lt;br /&gt;AlternatingItemTemplate&lt;br /&gt;This template renders even-numbered items in a list view of an ObjectList object. &lt;br /&gt;HeaderTemplate&lt;br /&gt;The header template is rendered at the beginning of the list. In paginated mode, the header is rendered on each page. &lt;br /&gt;FooterTemplate&lt;br /&gt;The footer template is rendered at the end of the list. In paginated mode, the footer is rendered on each page. &lt;br /&gt;ItemDetailsTemplate&lt;br /&gt;This template replaces the rendering of the commands/details view for an ObjectList object. &lt;br /&gt;ItemTemplate&lt;br /&gt;The item template is rendered for each list item. &lt;br /&gt;SeparatorTemplate&lt;br /&gt;The separator template separates items from each other.&lt;br /&gt;&lt;br /&gt;Device-Specific Behavior – HTML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On HTML devices, the object list is initially rendered as a table, with each list item (object) represented by a link. The default value for the link is a value associated with the first column in the dataset. You can set any column as a LabelField Property.&lt;br /&gt;&lt;br /&gt;Device-Specific Behavior – WML&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;On WML devices, the object list is initially rendered as a select list, with each item represented by its label. By selecting the item, the user can view a menu of commands for the item, including a link labeled "Details". By clicking "Details", the user can view title and value of all fields.&lt;br /&gt;&lt;br /&gt;Example6&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following example shows how to use Object list for viewing titles by author. It is bound to the dataset “dsAuthors”. The page has three mobile form controls and on the mobile form 1, ObjectList shows a list of all authors. On selecting a command to view the titles by author, mobile form 2 is activated where in user could see the list of titles. On selecting the Sales Trend Link, mobile form 3 is activated that displays a message.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;body Xmlns:mobile="http://schemas.microsoft.com/Mobile/WebForm"&gt;&lt;br /&gt;	&lt;mobile:Form id="Form1" runat="server"&gt;&lt;br /&gt;		&lt;mobile:ObjectList id=ObjectList1 runat="server" OnItemCommand="List1_Click" LabelField="Au_Lname" DataMember="authors" DataSource="&lt;%# dsAuthors1 %&gt;" LabelStyle-StyleReference="title" CommandStyle-StyleReference="subcommand" BackColor="Turquoise"&gt;&lt;br /&gt;			&lt;Command Name="Titles" Text="View Titles by this Author"&gt;&lt;/Command&gt;&lt;br /&gt;			&lt;Command Name="Sales" Text="Current Sales Trend in Stores"&gt;&lt;/Command&gt;&lt;br /&gt;		&lt;/mobile:ObjectList&gt;&lt;br /&gt;	&lt;/mobile:Form&gt;&lt;br /&gt;	&lt;mobile:Form id="Form2" runat="server"&gt;&lt;br /&gt;		&lt;mobile:ObjectList id="ObjectList2" runat="server" LabelStyle-StyleReference="title" CommandStyle-StyleReference="subcommand"&lt;br /&gt;			BackColor="Turquoise"&gt;&lt;/mobile:ObjectList&gt;&lt;br /&gt;	&lt;/mobile:Form&gt;&lt;br /&gt;	&lt;mobile:Form id="Form3" runat="server" BackColor="Turquoise"&gt;&lt;br /&gt;		&lt;mobile:Label id="Label1" runat="server" Font-Bold="True" ForeColor="Blue"&gt;Currently, this feature is not available for users!&lt;/mobile:Label&gt;&lt;br /&gt;	&lt;/mobile:Form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;br /&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;	if (Page.IsPostBack == false)&lt;br /&gt;	{&lt;br /&gt;		oleDbDataAdapter1.Fill(dsAuthors1);&lt;br /&gt;		ObjectList1.DataBind();&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;string authorid;&lt;br /&gt;public void List1_Click(Object sender, ObjectListCommandEventArgs e)&lt;br /&gt;{&lt;br /&gt;	authorid = e.ListItem[0];&lt;br /&gt;	if (e.CommandName == "Titles")&lt;br /&gt;	{&lt;br /&gt;		ActiveForm = Form2;&lt;br /&gt;	}&lt;br /&gt;	else if (e.CommandName == "Sales")&lt;br /&gt;	{&lt;br /&gt;		ActiveForm = Form3;&lt;br /&gt;	}&lt;br /&gt;	else&lt;br /&gt;	{&lt;br /&gt;		ActiveForm = Form1;&lt;br /&gt;	}&lt;br /&gt;private void GetAuthorTitles()&lt;br /&gt;{&lt;br /&gt;	string ssql = "select titles.title_id, title, type, price, notes from titleauthor, titles where titleauthor.au_id = '" + authorid + "' and titleauthor.title_id = titles.title_id";&lt;br /&gt;	DataSet ds1 = new DataSet();&lt;br /&gt;	OleDbDataAdapter Adapter = new OleDbDataAdapter(ssql,oleDbConnection1);&lt;br /&gt;	Adapter.Fill(ds1);&lt;br /&gt;	ObjectList2.DataSource = ds1;&lt;br /&gt;	ObjectList2.LabelField = "Title";&lt;br /&gt;	ObjectList2.DataBind();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void Form2_Activate(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;	GetAuthorTitles();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This part covered the most significant use of ObjectList control. The next part of the article would discuss about simple controls like PhoneCall, Link and TextView.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5471498205189124557?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5471498205189124557/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-4.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5471498205189124557'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5471498205189124557'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-4.html' title='Mobile Web Development in ASP.NET - Part 4'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-1198871905135645811</id><published>2009-08-03T00:56:00.000-07:00</published><updated>2009-08-03T00:58:23.926-07:00</updated><title type='text'>Mobile Web Development in ASP.NET - Part 3</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Part3 of the series on Mobile Web Development deals with the SelectionList control that offers you variety of choices of selecting an item or items from a list and act accordingly.&lt;br /&gt;&lt;br /&gt;SelectionList Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SelectionList control provides the UI selection capability for a list control. Although they are both lists, a SelectionList control differs in capabilities and scope from a List control. &lt;br /&gt;&lt;br /&gt;Features of SelectionList &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An item selected from a SelectionList control does not generate a server event. You need to add a Command Control for submitting the form to the server.&lt;br /&gt;SelectionList control allows multiple items to be selected. &lt;br /&gt;SelectionList control manages only small lists and does not offer pagination. &lt;br /&gt;SelectionList control supports different types with the SelectType attribute values: SelectType=DropDown|ListBox|Radio|MultiSelectListBox|CheckBox&lt;br /&gt;&lt;br /&gt;The following controls can contain one or more SelectionList controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Form&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Panel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SelectionList control can contain one or more of the following control.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Item&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Device Templates&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The SelectionList control does not support device templates.&lt;br /&gt;&lt;br /&gt;Example3&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following example shows how to create a selection list for hardware peripherals. When the user chooses a device, a second page displays the device name and its price.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Inherits="System.Web.UI.MobileControls.MobilePage"&lt;br /&gt;   Language="c#" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="mobile"&lt;br /&gt;    Namespace="System.Web.UI.MobileControls"&lt;br /&gt;    Assembly="System.Web.Mobile" %&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="c#" runat="server"&gt;&lt;br /&gt;public void PriceHandler(Object source, EventArgs e)&lt;br /&gt;{&lt;br /&gt;   String selectedHardware = HardwareDevices.Selection.Value;&lt;br /&gt;   Price.Text = HardwareDevices.Selection.Text&lt;br /&gt;      + " at " + selectedHardware;&lt;br /&gt;   ActiveForm = PricePage;&lt;br /&gt;}&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form runat="server"&gt;&lt;br /&gt;   &lt;mobile:Label&gt;For pricing, select a component:&lt;/mobile:Label&gt;&lt;br&gt;&lt;br&gt;&lt;br /&gt;   &lt;mobile:SelectionList id=" HardwareDevices " runat="server"&gt;&lt;br /&gt;      &lt;item Text="Printer" Value="Rs 5000.00"/&gt;&lt;br /&gt;      &lt;item Text="CDR Drive" Value="Rs 600.00"/&gt;&lt;br /&gt;      &lt;item Text="Modem" Value="Rs 1000.00"/&gt;&lt;br /&gt;      &lt;item Text="Speakers" Value="Rs 800.00"/&gt;&lt;br&gt;&lt;br /&gt;   &lt;/mobile:SelectionList&gt;&lt;br /&gt;   &lt;mobile:Command runat="server" OnClick="PriceHandler"&gt;&lt;br /&gt;   Get the price!&lt;/mobile:Command&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;mobile:Form runat="server" id="PricePage"&gt;&lt;br /&gt;   &lt;mobile:Label runat="server" id="PriceMessage" /&gt;&lt;br /&gt;      Hardware Device Price Request&lt;/mobile:Label&gt;&lt;br&gt;&lt;br /&gt;  &lt;mobile:Label runat="server" id="Price" /&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Example4&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;In this example, the DataSource property of the SelectionList class is an array called channels that is created and filled during the initial page load. You can set the SelectType property in the code and display the selection through two alternate means during postbacks&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" &lt;br /&gt;   Language="c#" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="mobile"&lt;br /&gt;    Namespace="System.Web.UI.MobileControls"&lt;br /&gt;    Assembly="System.Web.Mobile" %&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="c#" runat="server"&gt;&lt;br /&gt;&lt;br /&gt;public void Page_Load(Object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;   if (!IsPostBack)&lt;br /&gt;   {&lt;br /&gt;      Label1.Text = "Select a channel:";&lt;br /&gt;&lt;br /&gt;      // Create and fill an array list.&lt;br /&gt;      ArrayList channels = new ArrayList();&lt;br /&gt;      channels.Add("HBO");&lt;br /&gt;      channels.Add("Star");&lt;br /&gt;      channels.Add("ESPN");&lt;br /&gt;&lt;br /&gt;      // Bind the array to the list.&lt;br /&gt;      SelectionList1.DataSource = channels;&lt;br /&gt;      SelectionList1.DataBind();&lt;br /&gt;&lt;br /&gt;      // Set the SelectType property.&lt;br /&gt;      SelectionList1.SelectType = &lt;br /&gt;         System.Web.UI.MobileControls.ListSelectType.Radio;&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;public void Button_Click(Object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;   if (SelectionList1.SelectedIndex &gt; -1)&lt;br /&gt;   {&lt;br /&gt;      // To show the selection, get the Selection property.&lt;br /&gt;      Label1.Text = "You have selected " +&lt;br /&gt;         SelectionList1.Selection.Text;&lt;br /&gt;&lt;br /&gt;      // This is an alternate means of showing the selection&lt;br /&gt;      // using the MobileListItemCollection object.&lt;br /&gt;      Label2.Text = "You have selected " +&lt;br /&gt;      SelectionList1.Items[SelectionList1.SelectedIndex].Text;&lt;br /&gt;   }&lt;br /&gt;   else&lt;br /&gt;   {&lt;br /&gt;      Label1.Text = "No channels selected";&lt;br /&gt;   }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form id="Form1" runat="server"&gt;&lt;br /&gt;   &lt;mobile:Label id="Label1" runat="server" Text="Show a list." /&gt;&lt;br /&gt;   &lt;mobile:Label runat="server" id="Label2" /&gt;&lt;br /&gt;   &lt;mobile:SelectionList runat="server" id="SelectionList1" /&gt;&lt;br /&gt;   &lt;mobile:Command OnClick="Button_Click" Text="Ok" runat="server"/&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Both the List and SelectionList controls allow you to list items from a data source and provides the following properties:&lt;br /&gt;&lt;br /&gt;DataMember="dataMember"&lt;br /&gt;DataTextField="DataTextField"&lt;br /&gt;DataValueField="DataValueField"&lt;br /&gt;OnItemDataBind="itemDataBindHandler"&lt;br /&gt;&lt;br /&gt;Example5&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following example shows a SelectionList control bound to a dataset that has rows from the Authors table. On selecting an item (AuthorId), user pushes the command button to display his name in a label control.&lt;br /&gt; &lt;br /&gt;private void Form1_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;	if (Page.IsPostBack == false)&lt;br /&gt;	{&lt;br /&gt;		oleDbDataAdapter1.Fill (dataSet21);&lt;br /&gt;		SelectionList1.DataSource = dataSet21;&lt;br /&gt;		SelectionList1.DataBind();&lt;br /&gt;	}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;private void Command1_Click(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;	Label1.Text = "Name of the selected Author is: " + SelectionList1.Items[SelectionList1.SelectedIndex].Value.ToString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form id="Form1" runat="server"&gt;&lt;br /&gt;&lt;mobile:SelectionList id=SelectionList1 runat="server" DataSource="&lt;%# dataSet21 %&gt;" DataMember="Authors" DataValueField="Author" DataTextField="Au_ID"&gt;&lt;br /&gt;&lt;/mobile:SelectionList&gt;&lt;br /&gt;&lt;mobile:Command id="Command1" runat="server"&gt;Get Author Name&lt;/mobile:Command&gt;&lt;br /&gt;&lt;mobile:Label id="Label1" runat="server"&gt;&lt;/mobile:Label&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This part covers the most common uses of SelectionList control. The next part of the article would discuss about the the ObjectList control, a highly sophisticated control in the mobile list controls.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-1198871905135645811?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/1198871905135645811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-3.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1198871905135645811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1198871905135645811'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-3.html' title='Mobile Web Development in ASP.NET - Part 3'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-979274786936267603</id><published>2009-08-03T00:55:00.000-07:00</published><updated>2009-08-03T00:56:36.224-07:00</updated><title type='text'>Mobile Web Development in ASP.NET - Part 2</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first part of the article dealt with the Microsoft Mobile Internet ToolKit and Visual Studio environment and configuration settings required for creating a mobile based web application in ASP.NET. In the second part, I discuss few mobile controls and how to develop mobile pages that run on a browser or emulator…&lt;br /&gt;&lt;br /&gt;ASP.NET Mobile Controls&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A developer can create ASP.NET mobile Web Forms pages consisting of controls either in the ASP.NET Mobile Designer or with any text editor. Many of the controls are similar to desktop controls in Web Forms and to GUI controls in other programming languages, such as Microsoft Visual Basic.&lt;br /&gt;&lt;br /&gt;MobilePage&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This is the base class for all mobile ASP.NET pages. As such, the MobilePage control provides the outermost layer of all the containers in an ASP.NET mobile Web application. It is the only container associated with a URL and primarily contains style and context information common to all controls.&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Inherits="System.Web.UI.MobileControls.MobilePage" Language="c#" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="mobile" &lt;br /&gt;Namespace="System.Web.UI.MobileControls"&lt;br /&gt;Assembly="System.Web.Mobile" %&gt;&lt;br /&gt;&lt;br /&gt;A mobile page requires two directives. The first directive instructs the ASP.NET page framework to use MobilePage as the base class for the page. The Inherits attribute is required. If the page inherits directly from a MobilePage object, the Inherits attribute must be set to the System.Web.UI.MobileControls.MobilePage namespace. If the page inherits from a code-behind class, the name of the class must be specified instead. The Language attribute is optional; you can set it to the language used on the page, as with any other Web Forms page.&lt;br /&gt;&lt;br /&gt;The second directive registers the namespace used by ASP.NET mobile controls that have the mobile prefix. This allows you to declare mobile controls on the page by using the mobile prefix as below.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A MobilePage object can contain the following controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Form&lt;br /&gt;A MobilePage object must contain at least one Form control and can contain more than more than one Form control. &lt;br /&gt;System.Web.UI.MobileControls.Stylesheet&lt;br /&gt;A style sheet is not required for a MobilePage object. A MobilePage control may or may not have a Stylesheet control.&lt;br /&gt;&lt;br /&gt;Example1&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This example creates a mobile page and a form, and then adds a label to the form.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="mobile"&lt;br /&gt;    Namespace="System.Web.UI.MobileControls"&lt;br /&gt;    Assembly="System.Web.Mobile" %&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form runat="server"&gt;&lt;br /&gt;  &lt;mobile:Label runat="server"&gt;&lt;br /&gt;   My First MobilePage with some controls in it&lt;br /&gt;  &lt;/mobile:Label&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;List Control&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;It renders a list of items to a mobile device. This control supports templated rendering through device template sets, and it supports internal pagination just as you find it in datalist control in ASP.NET. For information on Template Sets and Templated Controls or Pagination, I will discuss them in the later part of the article.&lt;br /&gt;&lt;br /&gt;List control has both Static and Interactive Modes&lt;br /&gt;&lt;br /&gt;Static mode&lt;br /&gt;- The control behaves like a static list. Static list items can be declared as item child elements. &lt;br /&gt;Interactive mode&lt;br /&gt;- The control renders items as interactive elements. &lt;br /&gt;&lt;br /&gt;The behavior of these modes is based on the presence of an event handler. When an event handler is not present, the control is set to static mode. When an event handler is present, the control is set to interactive mode, in which each item is an interactive element that generates an event when clicked.&lt;br /&gt;&lt;br /&gt;You can optionally place DeviceSpecific/Choice construct inside a list control&lt;br /&gt;&lt;br /&gt;The following controls can contain one or more List controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Form&lt;br /&gt;System.Web.UI.MobileControls.Panel&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;A List control may or may not contain the following controls.&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.DeviceSpecific&lt;br /&gt;&lt;br /&gt;System.Web.UI.MobileControls.Item&lt;br /&gt;. &lt;br /&gt;&lt;br /&gt;Device Templates in List control&lt;br /&gt;&lt;br /&gt;HeaderTemplate&lt;br /&gt;The header template is rendered at the beginning of the list. In paginated mode, the header is rendered on each page. &lt;br /&gt;FooterTemplate&lt;br /&gt;The footer template is rendered at the end of the list. In paginated mode, the footer is rendered on each page. &lt;br /&gt;ItemTemplate&lt;br /&gt;The item template is rendered for each list item. &lt;br /&gt;AlternatingItemTemplate&lt;br /&gt;If defined, an alternating item template is rendered instead of the item template for even items. For example, the second item is an alternating template, as is the fourth item, as is every subsequent even-numbered item. &lt;br /&gt;SeparatorTemplate&lt;br /&gt;The separator template is rendered between two items.&lt;br /&gt;&lt;br /&gt;Example2&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The following example displays a list of fruit. When you select a fruit, the control displays its price.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;%@ Page Inherits= "System.Web.UI.MobileControls.MobilePage"&lt;br /&gt;    Language="C#" %&gt;&lt;br /&gt;&lt;%@ Register TagPrefix="mobile"&lt;br /&gt;    Namespace="System.Web.UI.MobileControls"&lt;br /&gt;    Assembly="System.Web.Mobile" %&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="c#" runat="server"&gt;&lt;br /&gt;protected void ListFruit_Click(Object source, ListCommandEventArgs e)&lt;br /&gt;{&lt;br /&gt;   String selectedFruit = "You selected " + e.ListItem.Text +&lt;br /&gt;      " at " + e.ListItem.Value + " per pound.";&lt;br /&gt;   PriceLabel.Text = selectedFruit;&lt;br /&gt;   ActiveForm = Price;&lt;br /&gt;}&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;mobile:Form id="Fruits" runat="server" BackColor="Cyan"&gt;&lt;br /&gt;   &lt;mobile:Label runat="server" id="label1"&gt;Select a Fruit!&lt;/mobile:Label&gt;&lt;br /&gt;   &lt;mobile:List runat="server" id="ListFruit" &lt;br /&gt;     OnItemCommand="ListFruit_Click" &gt;&lt;br /&gt;      &lt;item Text="Apples" Value="50 Rupees per Kg" /&gt;&lt;br /&gt;      &lt;item Text="Bananas" Value="1 Rupee" /&gt;&lt;br /&gt;      &lt;item Text="Grapes" Value="10 Rupees per Kg" /&gt;&lt;br /&gt;      &lt;item Text="Oranges" Value="30 Rupees per Kg" /&gt;&lt;br /&gt;   &lt;/mobile:List&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;mobile:Form id="Price" runat = "server"&gt;&lt;br /&gt;   &lt;mobile:Label runat="server" id="PriceLabel"/&gt;&lt;br /&gt;&lt;/mobile:Form&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The second part of the series has discussed two mobile controls, List and Label, placed in a mobile form container. Note that the Example2 has two mobile forms in a mobile page. In the Part3 of the article, you would get to know about more of the mobile controls.&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-979274786936267603?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/979274786936267603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-2.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/979274786936267603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/979274786936267603'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-2.html' title='Mobile Web Development in ASP.NET - Part 2'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6970484472811478480</id><published>2009-08-03T00:44:00.000-07:00</published><updated>2009-08-03T00:55:36.027-07:00</updated><title type='text'>Mobile Web Development in ASP.NET - Part 1</title><content type='html'>Introduction&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The Microsoft® Mobile Internet Toolkit (MIT) provides the tools for creating new applications that target mobile devices. This toolkit allows developers to create a mobile application that will be adapted to the display of multiple mobile devices: Personal Digital Assistants (PDAs) such as the Pocket PC, Web-enabled cell phones, pagers, etc. &lt;br /&gt;&lt;br /&gt;MMIT &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The ASP.NET mobile forms and controls are formerly known as the Microsoft Mobile Internet Toolkit (MMIT). They extend the power of the Microsoft .NET Framework and Visual Studio .NET to build mobile Web applications by enabling ASP.NET to deliver markup to a wide variety of mobile devices. It contains server-side technology that enables ASP.NET to deliver content to a wide variety of mobile devices.&lt;br /&gt;&lt;br /&gt;The .NET Framework version 1.1 provides support for mobile device development with ASP.NET mobile controls, support for Internet Protocol version 6, and ADO.NET classes for native communication with Open Database Connectivity (ODBC) and Oracle databases. It also enables the use of code access security to further lock down and isolate ASP.NET applications.&lt;br /&gt;&lt;br /&gt;ASP.NET mobile controls consist of a set of ASP.NET server controls and device adapters that can intelligently render your application. Knowledge of ASP.NET and Web Forms helps you use mobile controls to build mobile Web applications. You can build mobile Web applications using the ASP.NET Mobile Designer in Microsoft Visual Studio .NET or a text editor, and any programming language supported by the common language runtime. The .NET Framework and the ASP.NET mobile controls together form a powerful, flexible, and extensible platform for developing and deploying mobile Web applications. &lt;br /&gt;&lt;br /&gt;Testing the Mobile Application using Emulators&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The manufacturers of most mobile devices provide emulators that simulate the operation of their hardware and browsers. Emulator software enables you to view your ASP.NET mobile Web Forms application as it might appear on the manufacturers' hardware devices.&lt;br /&gt;&lt;br /&gt;To install an emulator as the Visual Studio application browser&lt;br /&gt;1. Install and test the mobile device emulator on your development computer. See the emulator's documentation for instructions. &lt;br /&gt;2. From the File menu, select Browse With. Visual Studio displays the Browse With dialog box. &lt;br /&gt;3. Click the Add button to display the Add Program dialog box. &lt;br /&gt;4. In the Program name field, enter the name of the emulator software's executable program file. Alternatively, select the Browse button to browse to the file's location. &lt;br /&gt;5. If the emulator supports command-line arguments, supply them in the Program name field. For example, you can specify the starting URL of the application, select a "skin" for the browser, or supply other start-up information that your browser might use. For more information about skins and specific start-up information, see your emulator's documentation. &lt;br /&gt;a. Use the %URL variable to specify where the application's start page should be substituted on the command line. This variable name is case sensitive. &lt;br /&gt;b. If supported, specify a skin name. Testing with multiple skins requires multiple instances of the emulator in the browser list. &lt;br /&gt;c. Supply any other arguments the emulator needs. See your emulator's documentation for details. &lt;br /&gt;6. In the Add Program dialog box's Friendly name field, type the name of the browser as you would like it to appear in Visual Studio. &lt;br /&gt;7. Click OK to close the Add Program dialog box. &lt;br /&gt;8. In the Browse With dialog box, select the emulator from the list of browsers, and click the Set as Default button. Click Close to close the Browse With dialog box. &lt;br /&gt;Note After you add an emulator to the list of browsers, you cannot modify its settings. You must delete it and add it again with the new settings.&lt;br /&gt;9. In the Solution Explorer, click on the name of the project file. &lt;br /&gt;10. From the Project menu, select Properties. The Property Pages dialog box appears. &lt;br /&gt;11. Click Configuration Properties. &lt;br /&gt;12. In the list of configuration properties, select Debugging. The dialog box displays the debugging configuration properties in the right-hand box. &lt;br /&gt;13. Set the Always use Internet Explorer property to False. &lt;br /&gt;&lt;br /&gt;Openwave Simulator&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Mobile Web applications developed in ASP.NET (using the ASP.NET mobile controls), can be tested with Openwave mobile browser simulators without leaving Microsoft Visual Studio .NET. This is done by configuring Visual Studio .NET to take advantage of the command-line arguments supported by the Openwave SDK 4.1.1 and Openwave SDK 6.1. (These Openwave SDKs are available for free from the Openwave Developer Web site.) &lt;br /&gt;&lt;br /&gt;Openwave SDK 4.1.1 contains a simulator for Openwave mobile browser 4.1, which adheres to the WAP 1.1 standard and renders content in WML. SDK 6.1 contains Openwave mobile browser 6.1, which adheres to the WAP 2.0 standard and renders content in XHTML Mobile Profile and CSS. You can use either or both simulators, depending on your needs and the target devices for your market. &lt;br /&gt;&lt;br /&gt;Summary&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The first part explained the basic ideas on Mobile ASP.NET environment and tools; the next part will take you how to develop simple mobile applications in ASP.NET.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6970484472811478480?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6970484472811478480/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-1.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6970484472811478480'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6970484472811478480'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/mobile-web-development-in-aspnet-part-1.html' title='Mobile Web Development in ASP.NET - Part 1'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3618655149167780576</id><published>2009-08-03T00:43:00.001-07:00</published><updated>2009-08-03T00:43:38.247-07:00</updated><title type='text'>How to create SSL certificate for Web Development?</title><content type='html'>How to create SSL certificate for Web Development?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Microsoft provides a tool named “MakeCert.exe” which helps us to create a temporary SSL Certificate for development environment. &lt;br /&gt;&lt;br /&gt;This tool comes with Visual Studio &amp; also with Windows SDK.&lt;br /&gt;&lt;br /&gt;If you installed Visual Studio, you can find it in this location: “C:\Program Files\Microsoft Visual Studio &lt;VERSION&gt;\SmartDevices\SDK\SDKTools”. If you installed Windows SDK, you will get it here: “C:\Program Files\Microsoft SDKs\Windows\&lt;VERSION&gt;\Bin”.&lt;br /&gt;&lt;br /&gt;Now open Command Console (“cmd.exe”) &amp; change your current directory to one of the location specified above. Type the following in Command Prompt &amp; hit enter:&lt;br /&gt;&lt;br /&gt;makecert -b 01/01/2009 -e 01/01/2020 -n "CN=Developers" -pe -r -sk "Microsoft Cryptographic Provider" -ss "Microsoft Cryptographic Store" c:\developerCertificate.cer&lt;br /&gt;&lt;br /&gt;This will create a test certificate (valid from 01/01/2009 to 01/01/2020) named “developerCertificate.cer” in your ‘C’ drive, which you can use for development environment. You can change the validity period by changing the begindate (-b) &amp; expirydate (-e). You can also change all the parameters specified above.&lt;br /&gt;&lt;br /&gt;Here is the list of the parameters mentioned above:&lt;br /&gt;&lt;br /&gt;Parameter Description &lt;br /&gt;-b Begin Date &lt;br /&gt;-e Expiry Date &lt;br /&gt;-n Certificate Subject Name &lt;br /&gt;-pe Mark Generated Private Key as Exportable &lt;br /&gt;-r Configures MakeCert to create a self-signed root certificate &lt;br /&gt;-sk Subject’s Key Container Name &lt;br /&gt;-ss&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3618655149167780576?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3618655149167780576/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/how-to-create-ssl-certificate-for-web.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3618655149167780576'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3618655149167780576'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/how-to-create-ssl-certificate-for-web.html' title='How to create SSL certificate for Web Development?'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5412325505181763886</id><published>2009-08-03T00:39:00.001-07:00</published><updated>2009-08-03T00:39:48.279-07:00</updated><title type='text'>Crystal Report to PDF</title><content type='html'>There are situations when we want to export Crystal reports to .pdf format programmatically. In these situations we can use ExportOptions for export the Crystal Reports to .pdf format. Also we have to set PdfRtfWordFormatOptions and ExportFormatType. PortableDocFormat . In the following example you can see how to export a Crystal Reports as a PDF format file in C#.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;private void button2_Click(object sender, EventArgs e)&lt;br /&gt;        {&lt;br /&gt;            try&lt;br /&gt;            {&lt;br /&gt;                ExportOptions CrExportOptions ;&lt;br /&gt;                DiskFileDestinationOptions CrDiskFileDestinationOptions = new DiskFileDestinationOptions();&lt;br /&gt;                PdfRtfWordFormatOptions CrFormatTypeOptions = new PdfRtfWordFormatOptions();&lt;br /&gt;                CrDiskFileDestinationOptions.DiskFileName = "c:\\csharp.net-informations.pdf";&lt;br /&gt;                CrExportOptions = cryRpt.ExportOptions;&lt;br /&gt;                {&lt;br /&gt;                    CrExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;&lt;br /&gt;                    CrExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;&lt;br /&gt;                    CrExportOptions.DestinationOptions = CrDiskFileDestinationOptions;&lt;br /&gt;                    CrExportOptions.FormatOptions = CrFormatTypeOptions;&lt;br /&gt;                }&lt;br /&gt;                cryRpt.Export();&lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                MessageBox.Show(ex.ToString());&lt;br /&gt;            }&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5412325505181763886?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5412325505181763886/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/crystal-report-to-pdf.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5412325505181763886'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5412325505181763886'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/crystal-report-to-pdf.html' title='Crystal Report to PDF'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6101093198273911946</id><published>2009-08-02T22:48:00.000-07:00</published><updated>2009-08-02T22:49:57.363-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='JavaScript to select one checkbox at a time inside a gridview'/><title type='text'>JavaScript to select one checkbox at a time inside a gridview containing checkbox as template column</title><content type='html'>Many times we need JavaScript for controls inside a gridview.One such need is to check only one checkbox at a time.This code snippet illustrates how to do that and this can be a guideline for all such needs.&lt;br /&gt;&lt;br /&gt;The below java script is for checkbox inside a gridview as template column.If one checkbox is selected, it should deselect other check boxes .In code behind u have to include JavaScript for each checkbox in rowdatabound event.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;protected void dgprod_RowDataBound(object sender, GridViewRowEventArgs e)&lt;br /&gt;{&lt;br /&gt;CheckBox chkh = new CheckBox();&lt;br /&gt;chkh=(checkbox)e.Row.FindControl("chkcat");&lt;br /&gt;chkh.Attributes.Add("onclick", "javascript:return Selectone(this,'"+ dgprod.ClientID +"');");&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;javascript to select one checkbox at a time:&lt;br /&gt;&lt;br /&gt;function selectone(chid,gridviewid)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var grid=document.getelementbyid("gridviewid");&lt;br /&gt;for (i=1; i{&lt;br /&gt;var inputs = grid.getElementsByTagName("input");&lt;br /&gt;if (inputs.length&gt;0)&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;for (i=1; i{&lt;br /&gt;if(inputs[i].type=="checkbox")&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;var chk=$get(inputs[i].id);&lt;br /&gt;&lt;br /&gt;if(chk.id!=chid.id)&lt;br /&gt;{&lt;br /&gt;chk.checked=false;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6101093198273911946?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6101093198273911946/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/08/javascript-to-select-one-checkbox-at.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6101093198273911946'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6101093198273911946'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/08/javascript-to-select-one-checkbox-at.html' title='JavaScript to select one checkbox at a time inside a gridview containing checkbox as template column'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-1978768048979617636</id><published>2009-07-31T04:35:00.001-07:00</published><updated>2009-07-31T04:35:55.391-07:00</updated><title type='text'>Writing and Reading to a Text File.</title><content type='html'>Writing and Reading to a Text File:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Description:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;When developers have large data in text box then it is not possible to insert into a database table. &lt;br /&gt;So you can use the below code to write to a text and save file path in the database. So to read&lt;br /&gt;a file use the below code by passing the file path.&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Design View:&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;  &lt;asp:textbox id="txtTemplate" runat="server" TextMode = "MultiLine"&gt;&lt;/asp:textbox&gt;&lt;br /&gt; &lt;br /&gt;Code Behind:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//.....Below Method is for writing data from a textbox to a text file.&lt;br /&gt;              &lt;br /&gt;&lt;br /&gt;protected void WritingToTextFile()&lt;br /&gt;{&lt;br /&gt; &lt;br /&gt; //.....Generating a file name.&lt;br /&gt; &lt;br /&gt;     string concatstring = DateTime.Now.ToString("ddMMyyyy")+" "+DateTime.Now.Hour.ToString()+""+DateTime.Now.Minute.ToString()+""+DateTime.Now.Second.ToString()+""+DateTime.Now.Millisecond.ToString();&lt;br /&gt; string fname = concatstring+".txt";&lt;br /&gt; string filename = "D:\\"+concatstring+".txt";&lt;br /&gt; &lt;br /&gt; //.....FileInfo class is for creating file.&lt;br /&gt; &lt;br /&gt; FileInfo fnew = new FileInfo(filename);&lt;br /&gt; &lt;br /&gt; //.....StreamWriter class is for writing text to the text file.&lt;br /&gt; &lt;br /&gt; StreamWriter sw = fnew.CreateText();&lt;br /&gt; sw.WriteLine(txtTemplate.Text);&lt;br /&gt; sw.Close();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;protected void ReadingTextFile(string sFileName)&lt;br /&gt;{&lt;br /&gt; string sframedata = "";&lt;br /&gt; string datas = "";&lt;br /&gt; &lt;br /&gt; //.....StreamReader class is for Reading text from the text file.&lt;br /&gt; &lt;br /&gt;                StreamReader sr = new StreamReader("D:\\"+sFileName);&lt;br /&gt; while((datas = sr.ReadLine()) != null)&lt;br /&gt; {&lt;br /&gt;  sframedata += datas;&lt;br /&gt; } &lt;br /&gt; txtTemplate.Text =  sframedata.ToString();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-1978768048979617636?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/1978768048979617636/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/writing-and-reading-to-text-file.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1978768048979617636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1978768048979617636'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/writing-and-reading-to-text-file.html' title='Writing and Reading to a Text File.'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-4486936890244220295</id><published>2009-07-31T04:31:00.000-07:00</published><updated>2009-07-31T04:32:24.993-07:00</updated><title type='text'>Xml File Read and Bind</title><content type='html'>XML File like this&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt; NewDataSet &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; British Indian Ocean Territory&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Diego Garcia&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Ahmadabad&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Akola&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Aurangabad Chikalthan Aerodrome&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bombay / Santacruz&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bilaspur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bhuj-Rudramata&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Belgaum / Sambra&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bhopal / Bairagarh&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bhaunagar&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Goa / Dabolim Airport&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Indore&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jabalpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Khandwa&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Kolhapur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Nagpur Sonegaon&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Rajkot&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Sholapur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Agartala&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Siliguri&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bhubaneswar&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Calcutta / Dum Dum&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Car Nicobar&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Gorakhpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Gauhati&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Gaya&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Imphal Tulihal&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jharsuguda&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jamshedpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; North Lakhimpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Dibrugarh / Mohanbari&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Port Blair&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Patna&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; M. O. Ranchi&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Agra&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Allahabad / Bamhrauli&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Amritsar&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Varanasi / Babatpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bareilly&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Kanpur / Chakeri&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; New Delhi / Safdarjung&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; New Delhi / Palam&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Gwalior&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Hissar&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jhansi&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jodhpur&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Jaipur / Sanganer&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Kota Aerodrome&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Lucknow / Amausi&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Satna&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Udaipur Dabok&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Bellary&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Vijayawada / Gannavaram&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Coimbatore / Peelamedu&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Cochin / Willingdon&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Cuddapah&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Hyderabad Airport&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Madurai&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Mangalore / Bajpe&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Madras / Minambakkam&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Tiruchchirapalli&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Thiruvananthapuram&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt; &lt; Table &gt; &lt;br /&gt;  &lt; Country &gt; India&lt; /Country &gt; &lt;br /&gt;  &lt; City &gt; Vellore&lt; /City &gt; &lt;br /&gt; &lt; /Table &gt; &lt;br /&gt;&lt; /NewDataSet &gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;client Side Code&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt; html xmlns="http://www.w3.org/1999/xhtml"  &gt;&lt;br /&gt;&lt; head runat="server" &gt;&lt;br /&gt;    &lt; title &amp;gtUntitled Page&lt; /title &gt;&lt;br /&gt;&lt; /head &gt;&lt;br /&gt;&lt; body &gt;&lt;br /&gt;    &lt; form id="form1" runat="server" &gt;&lt;br /&gt;    &lt; div &gt;&lt;br /&gt;    &lt; asp:DataGrid ID="dtg1" runat ="Server" AutoGenerateColumns ="false" &gt;&lt;br /&gt;    &lt; Columns &gt;&lt;br /&gt;    &lt; asp:TemplateColumn HeaderText ="Country" &gt;&lt;br /&gt;    &lt; ItemTemplate &gt;&lt;br /&gt;    &lt; asp:Label ID="lbl1" runat ="server" Text ='&lt; %# Bind("Country") % &gt;' &gt;&lt; /asp:Label &gt;&lt;br /&gt;    &lt; /ItemTemplate &gt; &lt;br /&gt;    &lt; /asp:TemplateColumn &gt; &lt;br /&gt;    &lt;br /&gt;    &lt;br /&gt;    &lt; asp:TemplateColumn HeaderText ="City" &gt;&lt;br /&gt;    &lt; ItemTemplate &gt;&lt;br /&gt;    &lt; asp:Label ID="lbl2" runat ="server" Text ='&lt; %# Bind("City") % &gt;' &gt;&lt; /asp:Label &gt;&lt;br /&gt;    &lt; /ItemTemplate &gt; &lt;br /&gt;    &lt; /asp:TemplateColumn &gt; &lt;br /&gt;    &lt; /Columns &gt; &lt;br /&gt;    &lt; /asp:DataGrid &gt; &lt;br /&gt;    &lt;br /&gt;    &lt; /div &gt;&lt;br /&gt;    &lt; /form &gt;&lt;br /&gt;&lt; /body &gt;&lt;br /&gt;&lt; /html &gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Server Side&lt;br /&gt;&lt;br /&gt;&lt;br /&gt; Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load&lt;br /&gt;        cls1 = New ClsConnect&lt;br /&gt;        ds.ReadXml(Server.MapPath("XMLFile.xml"))&lt;br /&gt;        dtg1.DataSource = ds&lt;br /&gt;        dtg1.DataBind()&lt;br /&gt;    End Sub&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-4486936890244220295?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/4486936890244220295/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/xml-file-read-and-bind.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4486936890244220295'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4486936890244220295'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/xml-file-read-and-bind.html' title='Xml File Read and Bind'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3812182290384898278</id><published>2009-07-30T05:42:00.000-07:00</published><updated>2009-07-30T05:45:16.541-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Silverlight DataGrid Paging'/><title type='text'>Silverlight DataGrid Paging</title><content type='html'>&lt;em&gt;Silverlight DataGrid does not have the built-in paging facility. So here is a small piece of code to implement paging in Silverlight DataGrid. For this custom paging &lt;br /&gt;Calculate the number of pages based on total number of records and page size &lt;br /&gt;Add those many buttons to a container like StackPanel and &lt;br /&gt;On those buttons click events bind the DataGrid to desired range of records.&lt;/em&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;1.Define the following Properties and Variables         &lt;/strong&gt;&lt;br /&gt;    public partial class Page : UserControl&lt;br /&gt;&lt;br /&gt;    {&lt;br /&gt;&lt;br /&gt;        //Property to hold the value of total records &lt;br /&gt;&lt;br /&gt;        public int TotalRow { get; set; }&lt;br /&gt;&lt;br /&gt;        //Property to hold the value of page size&lt;br /&gt;&lt;br /&gt;        public int PageSize { get; set; }&lt;br /&gt;&lt;br /&gt;        //Number of rows that the DataGrid&lt;br /&gt;&lt;br /&gt;        int totalRowsInGrid = 0;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Initialize the values &lt;/strong&gt;                public Page()&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            InitializeComponent();&lt;br /&gt;&lt;br /&gt;            //Initialize the page size&lt;br /&gt;&lt;br /&gt;            PageSize = 10;&lt;br /&gt;&lt;br /&gt;            //Get the desired data&lt;br /&gt;&lt;br /&gt;            user = User.Get();&lt;br /&gt;&lt;br /&gt;            //Set the TotalRow cout to the number of rows returned for data&lt;br /&gt;&lt;br /&gt;            TotalRow = user.Count;&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;            BindGrid(1);&lt;br /&gt;&lt;br /&gt;            DoPaging(this.PageSize, TotalRow);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Create a method to get the desired range of data based on page number&lt;/strong&gt;/// &lt;summary&gt;&lt;br /&gt;&lt;br /&gt;        /// Returns paged data based on page number&lt;br /&gt;&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;param name="pageNumber"&gt;&lt;/param&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;returns&gt;&lt;/returns&gt;&lt;br /&gt;&lt;br /&gt;        private List&lt;User&gt; GetData(int pageNumber)&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            int Pagestart = (pageNumber - 1) * this.PageSize;&lt;br /&gt;&lt;br /&gt;            TextBlockStartPageNumber.Text = (Pagestart+1).ToString();&lt;br /&gt;&lt;br /&gt;            TextBlockEndPageNumber.Text = (Pagestart + totalRowsInGrid).ToString();&lt;br /&gt;&lt;br /&gt;            TextBlockTotalRecords.Text = TotalRow.ToString();&lt;br /&gt;&lt;br /&gt;            int i = TotalRow;&lt;br /&gt;&lt;br /&gt;            List&lt;User&gt; PagedData;&lt;br /&gt;&lt;br /&gt;            //List&lt;User&gt; PagedData = user.Skip((pageNumber - 1) * PageSize).Take(PageSize) as List&lt;User&gt;;&lt;br /&gt;&lt;br /&gt;            //List&lt;YourObject&gt; PageedData = FullList.Skip((PageNumber - 1) * PageSize).Take(PageSize).ToList();&lt;br /&gt;&lt;br /&gt;            if ((i - ((pageNumber - 1) * this.PageSize)) &gt;= this.PageSize)&lt;br /&gt;&lt;br /&gt;                PagedData = user.GetRange(Pagestart, this.PageSize);&lt;br /&gt;&lt;br /&gt;            else&lt;br /&gt;&lt;br /&gt;                PagedData = user.GetRange(Pagestart, (i % this.PageSize));&lt;br /&gt;&lt;br /&gt;            return PagedData;&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;4. Bind the DataGrid&lt;/strong&gt;/// &lt;summary&gt;&lt;br /&gt;&lt;br /&gt;        /// Bind grid to the desired range of records&lt;br /&gt;&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;param name="PageNumber"&gt;&lt;/param&gt;&lt;br /&gt;&lt;br /&gt;        private void BindGrid(int PageNumber)&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            if (this.PageSize * PageNumber &gt; this.TotalRow)&lt;br /&gt;&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                totalRowsInGrid = this.TotalRow % this.PageSize;&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            else&lt;br /&gt;&lt;br /&gt;            {&lt;br /&gt;&lt;br /&gt;                totalRowsInGrid = this.PageSize;&lt;br /&gt;&lt;br /&gt;            }&lt;br /&gt;&lt;br /&gt;            dataGridPaging.ItemsSource = GetData(PageNumber);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;5. Write the click event for the paging buttons&lt;/strong&gt;/// &lt;summary&gt;&lt;br /&gt;&lt;br /&gt;        /// Handles the click event of buttons having page numbers&lt;br /&gt;&lt;br /&gt;        /// &lt;/summary&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;param name="sender"&gt;&lt;/param&gt;&lt;br /&gt;&lt;br /&gt;        /// &lt;param name="e"&gt;&lt;/param&gt;&lt;br /&gt;&lt;br /&gt;        void btn_Click(object sender, RoutedEventArgs e)&lt;br /&gt;&lt;br /&gt;        {&lt;br /&gt;&lt;br /&gt;            Button btn = sender as Button;&lt;br /&gt;&lt;br /&gt;            int iPageNumber = Convert.ToInt32(btn.Content.ToString());&lt;br /&gt;&lt;br /&gt;            BindGrid(iPageNumber);&lt;br /&gt;&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Regard&lt;br /&gt;&lt;br /&gt;Prateek&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3812182290384898278?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3812182290384898278/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/silverlight-datagrid-paging.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3812182290384898278'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3812182290384898278'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/silverlight-datagrid-paging.html' title='&lt;strong&gt;Silverlight DataGrid Paging&lt;/strong&gt;'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7740059724626032244</id><published>2009-07-29T23:55:00.000-07:00</published><updated>2009-07-29T23:56:21.460-07:00</updated><title type='text'>How Google Works</title><content type='html'>&lt;strong&gt;How Google Works&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;Google runs on a distributed network of thousands of low-cost computers and can therefore carry out fast parallel processing. Parallel processing is a method of computation in which many calculations can be performed simultaneously, significantly speeding up data processing. Google has three distinct parts:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;• Googlebot, a web crawler that finds and fetches web pages.&lt;br /&gt;• The indexer that sorts every word on every page and stores the resulting index of words in a huge database.&lt;br /&gt;• The query processor, which compares your search query to the index and recommends the documents that it considers most relevant.&lt;br /&gt;&lt;br /&gt;Let’s take a closer look at each part.&lt;br /&gt;&lt;strong&gt;1. Googlebot, Google’s Web Crawler&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Googlebot is Google’s web crawling robot, which finds and retrieves pages on the web and hands them off to the Google indexer. It’s easy to imagine Googlebot as a little spider scurrying across the strands of cyberspace, but in reality Googlebot doesn’t traverse the web at all. It functions much like your web browser, by sending a request to a web server for a web page, downloading the entire page, and then handing it off to Google’s indexer.&lt;br /&gt;&lt;br /&gt;Googlebot consists of many computers requesting and fetching pages much more quickly than you can with your web browser. In fact, Googlebot can request thousands of different pages simultaneously. To avoid overwhelming web servers, or crowding out requests from human users, Googlebot deliberately makes requests of each individual web server more slowly than it’s capable of doing.&lt;br /&gt;&lt;br /&gt;Googlebot finds pages in two ways: through an add URL form, www.google.com/addurl.html, and through finding links by crawling the web.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;2. Google’s Indexer&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Googlebot gives the indexer the full text of the pages it finds. These pages are stored in Google’s index database. This index is sorted alphabetically by search term, with each index entry storing a list of documents in which the term appears and the location within the text where it occurs. This data structure allows rapid access to documents that contain user query terms.&lt;br /&gt;&lt;br /&gt;To improve search performance, Google ignores (doesn’t index) common words called stop words (such as the, is, on, or, of, how, why, as well as certain single digits and single letters). Stop words are so common that they do little to narrow a search, and therefore they can safely be discarded. The indexer also ignores some punctuation and multiple spaces, as well as converting all letters to lowercase, to improve Google’s performance.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;3. Google’s Query Processor&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;The query processor has several parts, including the user interface (search box), the “engine” that evaluates queries and matches them to relevant documents, and the results formatter.&lt;br /&gt;&lt;br /&gt;Page Rank is Google’s system for ranking web pages. A page with a higher Page Rank is deemed more important and is more likely to be listed above a page with a lower Page Rank.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;I hope you like this article.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;Regards,&lt;br /&gt;&lt;br /&gt;Prateek&lt;/strong&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7740059724626032244?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7740059724626032244/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/how-google-works.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7740059724626032244'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7740059724626032244'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/how-google-works.html' title='How Google Works'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6643546328819665163</id><published>2009-07-29T05:08:00.001-07:00</published><updated>2009-07-29T05:09:03.099-07:00</updated><title type='text'>About AJAX</title><content type='html'>About AJAX&lt;br /&gt;&lt;br /&gt;• AJAX stands for Asynchronous JavaScript and XML.&lt;br /&gt;• AJAX is become popular with Google application like Google suggestion&lt;br /&gt;&lt;br /&gt;AJAX Components&lt;br /&gt;&lt;br /&gt;• HTML&lt;br /&gt;• CSS&lt;br /&gt;• DOM&lt;br /&gt;• JavaScript&lt;br /&gt;• XML&lt;br /&gt;• JSon&lt;br /&gt;• XMLHttp&lt;br /&gt;&lt;br /&gt;AJAX Framework&lt;br /&gt;&lt;br /&gt;• Built on top of ASP.NET 2.0, there is a valuable set of controls and services that extend the existing framework with Ajax support. &lt;br /&gt;• This tier of the server framework is called the ASP.NET AJAX Server Extensions. &lt;br /&gt;• The server extensions are broken up into three areas: server controls, Web Services Bridge and the Application Services Bridge.&lt;br /&gt;• Each of these components interacts closely with the application model on the client to improve the interactivity of existing ASP.NET pages.&lt;br /&gt;&lt;br /&gt;ASP.NET AJAX Server Controls&lt;br /&gt;&lt;br /&gt;The new set of server controls add to the already impressive arsenal of tools in the ASP.NET toolbox and are predominantly driven by two main controls. &lt;br /&gt;&lt;br /&gt;ScriptManager - is considered to be the brains of an Ajax-enabled page. One of the many responsibilities of the ScriptManager isorchestrating the regions on the page that are dynamically updated during asynchronous postbacks. &lt;br /&gt;&lt;br /&gt;UpdatePanel - is used to define the regions on the page that are designated for partial updates.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6643546328819665163?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6643546328819665163/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/about-ajax.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6643546328819665163'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6643546328819665163'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/about-ajax.html' title='About AJAX'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5622796220942752453</id><published>2009-07-29T05:06:00.000-07:00</published><updated>2009-07-29T05:08:17.752-07:00</updated><title type='text'>Getting the IP address</title><content type='html'>Well, yes, it looks like trivial but it isn't. Many a times we need to get the IP address of the user. There are a handful of suggestions to do this. I discuss the methods and the short comings in them.&lt;br /&gt;&lt;br /&gt;1. REMOTE_ADDR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string ipAddress = Request.ServerVariables["REMOTE_ADDR"];&lt;br /&gt;&lt;br /&gt;This method fails when the user's request travels through a Proxy server. The Ip address in this case will be of the proxy.&lt;br /&gt;&lt;br /&gt;2. HTTP_X_FORWARDED_FOR&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string ipAddress = Request.ServerVariables["HTTP_X_FORWARDED_FOR"];&lt;br /&gt;&lt;br /&gt;Generally method 1 is overcome by using HTTP_X_FORWARDED_FOR server variable. This method returns the user address. Well this method fails when the user request does not come through a proxy.&lt;br /&gt;&lt;br /&gt;3. REMOTE_ADDR and HTTP_X_FORWARDED_FOR &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string ipAddress =  Request.ServerVariables["HTTP_X_FORWARDED_FOR"];&lt;br /&gt;if (string.IsNullOrEmpty(ipAddress))&lt;br /&gt;    ipAddress = Request.ServerVariables["REMOTE_ADDR"];&lt;br /&gt;&lt;br /&gt;Using the combination of method 1 and 2 we come to method 3. Do you think this is the solution? No. This ain't too. The reason being, sometimes the requests passes through multiple Proxy servers. In this case HTTP_X_FORWARDED_FOR contains comma separated values of the various proxy servers through which the request passes. So you actually do not have one IP address but multiple ones.&lt;br /&gt;&lt;br /&gt;4. REMOTE_ADDR and HTTP_X_FORWARDED_FOR and some processing&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string ipAddress =  Request.ServerVariables["HTTP_X_FORWARDED_FOR"];&lt;br /&gt;if (string.IsNullOrEmpty(ipAddress))&lt;br /&gt;    ipAddress = Request.ServerVariables["REMOTE_ADDR"];&lt;br /&gt;&lt;br /&gt;int index = -1;&lt;br /&gt;if ((index = ipAddress.IndexOf(",")) &gt; -1)&lt;br /&gt;{&lt;br /&gt;    ipAddress = ipAddress.Substring(0, index);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The final solution we come to is, use method 3 but check if there is comma separated values. If there is then we take the first IP address which will be the IP address of the user.&lt;br /&gt;&lt;br /&gt;I have formatted this into a method which can be reused,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static class Utility&lt;br /&gt;{&lt;br /&gt;    public static string GetIP(NameValueCollection nameValueCollection)&lt;br /&gt;    {&lt;br /&gt;        string result = string.Empty;&lt;br /&gt;&lt;br /&gt;        if (nameValueCollection == null || nameValueCollection.Count &lt; 1)&lt;br /&gt;            return result;&lt;br /&gt;&lt;br /&gt;        result = nameValueCollection["HTTP_X_FORWARDED_FOR"];&lt;br /&gt;        if (string.IsNullOrEmpty(result))&lt;br /&gt;            return nameValueCollection["REMOTE_ADDR"];&lt;br /&gt;&lt;br /&gt;        int index = -1;&lt;br /&gt;        if ((index = result.IndexOf(",")) &gt; -1)&lt;br /&gt;        {&lt;br /&gt;            result = result.Substring(0, index);&lt;br /&gt;        }&lt;br /&gt;&lt;br /&gt;        return result;&lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Request.ServerVariables is a NameValueCollection. To use the above method you will have to pass in Request.ServerVariables as a parameter. Like this,&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string ipAddress = Utility.GetIP(Request.ServerVariables);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;An important inclusion is that this method works for Transparent proxies. There is no way (what I know) to detect the real IP address of a user for a Anonymous/Distorting Proxy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5622796220942752453?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5622796220942752453/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/getting-ip-address.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5622796220942752453'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5622796220942752453'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/getting-ip-address.html' title='Getting the IP address'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-5038594797153404183</id><published>2009-07-26T23:00:00.000-07:00</published><updated>2009-07-26T23:01:59.668-07:00</updated><title type='text'>Google Dance</title><content type='html'>&lt;strong&gt;Google Dance&lt;/strong&gt;&lt;br /&gt;The name &lt;em&gt;Google Dance &lt;/em&gt;is a term used to describe the index update of the Google search engine. It's the period when Google is rebuilding its rankings, and results fluctuate widely for a 3 to 5 day period. It can be identified by significant movement in search results and especially by Google's cache of all indexed pages reflecting the status of Google's last spidering.&lt;br /&gt;&lt;br /&gt;Approximately once a month, Google update their index by recalculating the Page ranks of each of the web pages that they have crawled. The period during the update is known as the Google dance. &lt;br /&gt;&lt;br /&gt;Because of the nature of Page Rank, the calculations need to be performed about 40 times and, because the index is so large, the calculations take several days to complete. During this period, the search results fluctuate; sometimes minute-by minute. It is because of these fluctuations that the term, Google Dance, was coined. The dance usually takes place sometime during the last third of each month. &lt;br /&gt;&lt;br /&gt;Google has two other servers that can be used for searching. The search results on them also change during the monthly update and they are part of the Google dance. &lt;br /&gt;&lt;br /&gt;Checking the Google Dance&lt;br /&gt;&lt;br /&gt;Until January 2004, Google had 12 main www servers online, which were as follows:&lt;br /&gt;&lt;br /&gt;&lt;em&gt;www-ex.google.com - (where you get when you type www.google.com)&lt;br /&gt;www-sj.google.com - (which can also be accessed at www2.google.com)&lt;br /&gt;www-va.google.com - (which can also be accessed at www3.google.com)&lt;br /&gt;www-dc.google.com&lt;br /&gt;www-ab.google.com&lt;br /&gt;www-in.google.com&lt;br /&gt;www-zu.google.com&lt;br /&gt;www-cw.google.com&lt;br /&gt;www-fi.google.com - found in May 2003.&lt;br /&gt;www-gv.google.com - found in August 2003.&lt;br /&gt;www-gv2.google.com - found in September 2003.&lt;br /&gt;www-kr.google.com - found in October 2003.&lt;/em&gt;&lt;br /&gt;At some point in January, these servers stopped accepting connections, and the only servers easy to connect to be: &lt;br /&gt;&lt;br /&gt;&lt;em&gt;www.google.com&lt;br /&gt;www2.google.com&lt;br /&gt;www3.google.com&lt;/em&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-5038594797153404183?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/5038594797153404183/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/google-dance.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5038594797153404183'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/5038594797153404183'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/google-dance.html' title='&lt;strong&gt;Google Dance&lt;/strong&gt;'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-3066674521013284594</id><published>2009-07-25T03:45:00.000-07:00</published><updated>2009-07-25T03:47:35.449-07:00</updated><title type='text'>Export data in excel from gridview</title><content type='html'>Here is the comple code to generate data in excel from gridview....&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;protected void Button1_Click(object sender, EventArgs e)&lt;br /&gt;{&lt;br /&gt;Response.Clear();&lt;br /&gt;Response.Buffer = true;&lt;br /&gt;Response.ContentType = "application/ms-excel";&lt;br /&gt;Response.AddHeader("content-disposition", string.Format("file.xls", "excelsheet"));&lt;br /&gt;&lt;br /&gt;System.IO.StringWriter stringwriter = new StringWriter();&lt;br /&gt;HtmlTextWriter hw = new HtmlTextWriter(stringwriter);&lt;br /&gt;GridView1.RenderControl(hw);&lt;br /&gt;Response.Write(stringwriter.ToString());&lt;br /&gt;Response.End();&lt;br /&gt;&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-3066674521013284594?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/3066674521013284594/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/export-data-in-excel-from-gridview.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3066674521013284594'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/3066674521013284594'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/export-data-in-excel-from-gridview.html' title='Export data in excel from gridview'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-8027803213339505394</id><published>2009-07-24T06:35:00.000-07:00</published><updated>2009-07-24T06:38:25.584-07:00</updated><title type='text'>Creating Add to Favorites link through JavaScript</title><content type='html'>JavaScript function code:&lt;br /&gt;function addfav()&lt;br /&gt;   {&lt;br /&gt;   if (document.all)&lt;br /&gt;      {&lt;br /&gt;      window.external.AddFavorite&lt;br /&gt;      ("http://www.bprateek.blogspot.com","Prateek Tips")&lt;br /&gt;      }&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt;from the link as:&lt;br /&gt;&lt;a href="javascript:addfav()"&gt;Add To Favorites&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-8027803213339505394?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/8027803213339505394/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/creating-add-to-favorites-link-through.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/8027803213339505394'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/8027803213339505394'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/creating-add-to-favorites-link-through.html' title='Creating Add to Favorites link through JavaScript'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-7329521804085600603</id><published>2009-07-24T03:34:00.000-07:00</published><updated>2009-07-24T03:40:52.454-07:00</updated><title type='text'>State Management using Querystring</title><content type='html'>//send data as querystring          Response.Redirect("http://localhost:3521/Basic/StateManagement/Stateinfo.aspx?name=sysmphony-services&amp;lang=en-US");&lt;br /&gt;//Querystring information&lt;br /&gt;        Label1.Text = "Query string output:Name: " + Server.HtmlEncode(Request.QueryString["name"]) +&lt;br /&gt;        ", Lang: " + Server.HtmlEncode(Request.QueryString["lang"]);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-7329521804085600603?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/7329521804085600603/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-querystring.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7329521804085600603'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/7329521804085600603'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-querystring.html' title='State Management using Querystring'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-6759127187818454454</id><published>2009-07-24T03:06:00.002-07:00</published><updated>2009-07-24T03:34:48.349-07:00</updated><title type='text'>State Management using Session</title><content type='html'>/Store session information&lt;br /&gt;    Session["Name"] = "Symphony Services: ";&lt;br /&gt;    Session["MobileNo"] = "9765543639";&lt;br /&gt;//Get session information in any page&lt;br /&gt;//Accessing session info&lt;br /&gt;    lblSession.Text = Session["Name"].ToString() +                              Session["MobileNo"].ToString();&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-6759127187818454454?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/6759127187818454454/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-session.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6759127187818454454'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/6759127187818454454'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-session.html' title='State Management using Session'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-994377147742152383</id><published>2009-07-24T03:06:00.001-07:00</published><updated>2009-07-24T03:06:51.003-07:00</updated><title type='text'>State Management using cookies</title><content type='html'>// Check if cookie exists, and display it if it does &lt;br /&gt;        if (Request.Cookies["lastVisit"] != null)&lt;br /&gt;// Encode the cookie in case the cookie contains client-side script&lt;br /&gt;        Label1.Text = Server.HtmlEncode(Request.Cookies["lastVisit"].Value); &lt;br /&gt;        else Label1.Text = "No value defined"; &lt;br /&gt;// Define the cookie for the next visit&lt;br /&gt;        Response.Cookies["lastVisit"].Value = DateTime.Now.ToString();&lt;br /&gt;        Response.Cookies["lastVisit"].Expires = DateTime.Now.AddDays(1);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-994377147742152383?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/994377147742152383/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-cookies.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/994377147742152383'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/994377147742152383'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/state-management-using-cookies.html' title='State Management using cookies'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-2634621857684262940</id><published>2009-07-22T06:39:00.000-07:00</published><updated>2009-07-22T06:40:29.829-07:00</updated><title type='text'>Download files</title><content type='html'>private void DownloadFile( string fname)&lt;br /&gt;  {&lt;br /&gt;   try&lt;br /&gt;   {&lt;br /&gt;    string path = MapPath( fname );&lt;br /&gt;    string name = System.IO.Path.GetFileName( path );&lt;br /&gt;    string ext = System.IO.Path.GetExtension( path );&lt;br /&gt;    string type = "";&lt;br /&gt;    // set known types based on file extension  &lt;br /&gt;    if ( ext != null )&lt;br /&gt;    {&lt;br /&gt;     switch( ext.ToLower() )&lt;br /&gt;     {&lt;br /&gt;      case ".htm":&lt;br /&gt;      case ".html":&lt;br /&gt;       type = "text/HTML";&lt;br /&gt;       break;&lt;br /&gt;  &lt;br /&gt;      case ".txt":&lt;br /&gt;       type = "text/plain";&lt;br /&gt;       break;&lt;br /&gt;     &lt;br /&gt;      case ".doc":&lt;br /&gt;      case ".rtf":&lt;br /&gt;       type = "Application/msword";&lt;br /&gt;       break;&lt;br /&gt;      case ".xml":&lt;br /&gt;       type = "Application/xml";&lt;br /&gt;       break;&lt;br /&gt;      case ".zip":&lt;br /&gt;       type = "application/zip";&lt;br /&gt;       break;&lt;br /&gt;     }&lt;br /&gt;    }&lt;br /&gt;   &lt;br /&gt;    Response.AppendHeader( "content-disposition","attachment; filename=" + name );&lt;br /&gt;    if ( type != "" )   &lt;br /&gt;     Response.ContentType = type;&lt;br /&gt;    Response.WriteFile( path );&lt;br /&gt;   }&lt;br /&gt;   catch(Exception ex)&lt;br /&gt;   {&lt;br /&gt;    new PowerXEditor.BL.CommonUtility().RegisterError(ex);&lt;br /&gt;   }&lt;br /&gt;   Response.End();    &lt;br /&gt;  }&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-2634621857684262940?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/2634621857684262940/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/download-files.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2634621857684262940'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2634621857684262940'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/download-files.html' title='Download files'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-1217959472139553537</id><published>2009-07-21T02:10:00.001-07:00</published><updated>2009-07-21T02:10:47.833-07:00</updated><title type='text'>String Manipulation in .Net</title><content type='html'>To remove specified number of characters from string:&lt;br /&gt;&lt;br /&gt;If we want to remove some characters from a string we can remove using Remove function. It will have 2 parameters. First parameter is from where we need to remove and the second parameter is how many characters we need to remove. 2nd parameter is optional&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;It will remove 1 to 3 chars “ext” will be removed&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string strremove = "Text to remove";&lt;br /&gt;string stremovedtext = strremove.Remove(1, 3);&lt;br /&gt;MessageBox.Show(stremovedtext);&lt;br /&gt;&lt;br /&gt;To find a string with in a string:&lt;br /&gt;&lt;br /&gt;To check whether a string is with in a string or not. We can use contains to check the speacified string is contains in another string.&lt;br /&gt;&lt;br /&gt;Example:&lt;br /&gt;&lt;br /&gt;Here we are searching “will” is contained in a text &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//to find a text with in a text&lt;br /&gt;string strfind="Text with in myself will  be searched";&lt;br /&gt;if (stremovedtext.Contains("will") == true)&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("String found");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("String not found");&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;To check the beginning or end of a string&lt;br /&gt;&lt;br /&gt;If we want to check the beginning or ending of a string. We can check it by using StartsWith or EndsWith.&lt;br /&gt;&lt;br /&gt;Example&lt;br /&gt;&lt;br /&gt;Here we want to check the string starts with “text” or ends with “text”&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string strstartsorends="Text with in myself will  be searched";&lt;br /&gt;if ((strstartsorends.StartsWith("text")) || (strstartsorends.EndsWith("text")))&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("It is started or ended with text");&lt;br /&gt;}&lt;br /&gt;else&lt;br /&gt;{&lt;br /&gt;MessageBox.Show("It is not started or ended with text");&lt;br /&gt;}&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-1217959472139553537?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/1217959472139553537/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/string-manipulation-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1217959472139553537'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/1217959472139553537'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/string-manipulation-in-net.html' title='String Manipulation in .Net'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-2642950919819198602</id><published>2009-07-18T05:00:00.000-07:00</published><updated>2009-07-20T09:11:22.043-07:00</updated><title type='text'>Send Email with Attachments in Asp.net 2.0 with C#.Net</title><content type='html'>we have to add following namespaces in our namespace area&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Import System.Net&lt;br /&gt;Import System.Net.Mail&lt;br /&gt;&lt;br /&gt;Now the function below which i have written, you just pass the information in arguments and call that function to send email.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;public static int SendEmail(string strFrom, string strTo, string strSubject, string strMsg)&lt;br /&gt;        {            &lt;br /&gt;            try&lt;br /&gt;            {                &lt;br /&gt;                // Object for mail&lt;br /&gt;                MailMessage objMailMsg = new MailMessage(strFrom, strTo);&lt;br /&gt;                &lt;br /&gt;                objMailMsg.BodyEncoding = Encoding.UTF8;&lt;br /&gt;                objMailMsg.Subject = strSubject;&lt;br /&gt;                objMailMsg.Body = strMsg;&lt;br /&gt;                Attachment at = new Attachment(Server.MapPath("~/Files/TempFile.txt"));&lt;br /&gt;                objMailMsg.Attachments.Add(at);&lt;br /&gt;                objMailMsg.Priority = MailPriority.High;&lt;br /&gt;                objMailMsg.IsBodyHtml = true;&lt;br /&gt;&lt;br /&gt;                //Email send through SMTP Protocol&lt;br /&gt;                SmtpClient objSMTPClient = new SmtpClient();&lt;br /&gt;                objSMTPClient.DeliveryMethod = SmtpDeliveryMethod.PickupDirectoryFromIis;&lt;br /&gt;                objSMTPClient.Send(objMailMsg);                &lt;br /&gt;            }&lt;br /&gt;            catch (Exception ex)&lt;br /&gt;            {&lt;br /&gt;                throw ex;&lt;br /&gt;                return 1;&lt;br /&gt;            } &lt;br /&gt;            finally&lt;br /&gt;            {&lt;br /&gt;                return 0;&lt;br /&gt;            }&lt;br /&gt;            &lt;br /&gt;        }        &lt;br /&gt;&lt;br /&gt;if this function return 0 then email sent successfully with attachments&lt;br /&gt;or is it return other than 0,then there might be some problems with server or attachments or Exception fired.&lt;br /&gt;&lt;br /&gt;I hope this articles will be helpful for developers&lt;br /&gt;&lt;br /&gt;Thanks&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-2642950919819198602?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/2642950919819198602/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/send-email-with-attachments-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2642950919819198602'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/2642950919819198602'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/send-email-with-attachments-in-aspnet.html' title='Send Email with Attachments in Asp.net 2.0 with C#.Net'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1903188344093543539.post-4896466821613730985</id><published>2009-07-17T09:52:00.000-07:00</published><updated>2009-07-20T09:11:22.043-07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='File Uploading in .NET'/><title type='text'>File Uploading in .NET</title><content type='html'>Hi,&lt;br /&gt;Viewers ,&lt;br /&gt;&lt;strong&gt;This is my first Post and I have started with .NET File uploading&lt;/strong&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;1. &lt;br /&gt;2. Sub Upload(Source As Object, e As EventArgs)&lt;br /&gt;6. &lt;br /&gt;7.    If Not (myFile.PostedFile Is Nothing) Then&lt;br /&gt;8. &lt;br /&gt;9.       Dim intFileNameLength as Integer&lt;br /&gt;10.       Dim strFileNamePath as String&lt;br /&gt;11.       Dim strFileNameOnly as String&lt;br /&gt;12. &lt;br /&gt;13.       'Logic to find the FileName (excluding the path)&lt;br /&gt;14.       strFileNamePath = MyFile.PostedFile.FileName&lt;br /&gt;15.       intFileNameLength = Instr(1, StrReverse(strFileNamePath), "\")&lt;br /&gt;16.       strFileNameOnly = Mid(strFileNamePath, (Len(strFileNamePath)-intFileNameLength)+2)&lt;br /&gt;17. &lt;br /&gt;18.             'myFile.PostedFile.SaveAs("c:\inetpub\wwwroot\yourwebapp\upload\" &amp; strFileNameOnly)&lt;br /&gt;19.             myFile.PostedFile.SaveAs("d:\" &amp; strFileNameOnly)&lt;br /&gt;20.       lblMsg.Text = "File Upload Success."&lt;br /&gt;21. &lt;br /&gt;22.    End If&lt;br /&gt;23. End Sub&lt;br /&gt;24.  &lt;br /&gt;26. &lt;br /&gt;27. &lt;br /&gt;28. &lt;br /&gt;29. &lt;h3&gt;                File Upload&lt;/h3&gt;&lt;br /&gt;30. &lt;br /&gt;31. &lt;form id="Form1" enctype="multipart/form-data" runat="server"&gt;&lt;br /&gt;32.    File: &lt;input id="myFile" type="file" runat="server"&gt;&lt;br /&gt;33.    &lt;?xml:namespace prefix = asp /&gt;&lt;asp:label id="lblMsg" runat="server"&gt;&lt;/asp:label&gt;&lt;br /&gt;34.    &lt;input id="Button1" type="button" value="Upload" runat="server" onserverclick="Upload"&gt;&lt;br /&gt;35. &lt;/form&gt;&lt;br /&gt;36. &lt;br /&gt;37. &lt;br /&gt;38. &lt;br /&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1903188344093543539-4896466821613730985?l=bprateek.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://bprateek.blogspot.com/feeds/4896466821613730985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://bprateek.blogspot.com/2009/07/file-uploading-in-net.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4896466821613730985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1903188344093543539/posts/default/4896466821613730985'/><link rel='alternate' type='text/html' href='http://bprateek.blogspot.com/2009/07/file-uploading-in-net.html' title='File Uploading in .NET'/><author><name>Prateek</name><uri>http://www.blogger.com/profile/05676209010957897094</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='21' height='32' src='http://2.bp.blogspot.com/_jCBj8IJ7kA0/TOEaIc8JhLI/AAAAAAAAADw/pOMVJaoWKaY/S220/20101105_014.jpg'/></author><thr:total>0</thr:total></entry></feed>
