<?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-4414130591562689667</id><updated>2012-02-01T17:17:49.645+05:30</updated><category term='Website Navigation with SiteMaps'/><category term='Generics VB.NET'/><category term='WCF Service'/><category term='XML Tutorial'/><category term='10 Features'/><category term='Windows Authentication'/><category term='Binary Searialization in Dot Net'/><category term='AJAX DropShadow Extender'/><category term='VB NET TreeView Control'/><category term='Asp Net Ajax Animation Extender'/><category term='Net 3.5 New Features'/><category term='Custom Serialization in Dot Net'/><category term='Themes and CSS in Asp.Net'/><category term='Forms Authentication'/><category term='Silverlight 1.1'/><category term='Asp Net 3.5 Changes'/><category term='Better Intellisense Support'/><category term='XML Parsing'/><category term='2008 Features'/><category term='Ajax NoBot Extender'/><category term='MVP Pattern in ASP NET'/><category term='Imap Address Book'/><category term='Ajax ModalPopup Extender'/><category term='Partial Class'/><category term='OOPS Concepts in ASP Dot Net'/><category term='XML Searialization in Dot Net'/><category term='Understanding ASP NET View State'/><category term='Class Members'/><category term='Deploy Asp Net Application'/><category term='Discovering Ajax Extender Controls'/><category term='Websites with Navigation'/><category term='Reading Contacts'/><category term='Generics ASP NET'/><category term='Visual Studio 2008'/><category term='TDD'/><category term='ASP.NET 3.5 Controls'/><category term='DataAdapter Object'/><category term='New Features in Dot Net 2.0'/><category term='MVC architecture in Asp Dot Net'/><category term='Asp Net Gridview'/><category term='Ajax Tab Control Extender'/><category term='Overview of 2008'/><category term='Designing Data Access Layer'/><category term='MVP Design Patterns'/><category term='XML Schema'/><category term='Globalization and Localization Overview'/><category term='Types of Email Concept in ASP.Net'/><category term='Visual Studio 2008 Features'/><category term='Types of Authentication'/><category term='Threading'/><category term='C# Support'/><category term='Data Access Layer C# Net'/><category term='XSL'/><category term='Test Driven Development'/><category term='Ajax DynamicPopulate Extender'/><category term='Encrypt View State'/><category term='Model View Presenter VS Model View Controller'/><category term='Extensible Markup Language'/><category term='Multi Framework'/><category term='Java Rich Text Editor'/><category term='Definition Generic'/><category term='Asp Net Ajax Extender Controls'/><category term='C# Reporting Services'/><category term='Example Gridview'/><category term='Asp.Net Configuration Files'/><category term='IIS Authentication'/><category term='Ajax Star Rating Extender Control'/><category term='AJAX CascadingDropdown Extender Control'/><category term='View State Hidden Field'/><category term='RTE Rich Text Editor'/><category term='WCF WPF Interview Questions'/><category term='What New Net 3.5 Sp1'/><category term='Web Site Navigation in ASP.NET'/><category term='Views'/><category term='Generics C#'/><category term='HTTP Handlers and HTTP Modules in ASP.NET'/><category term='URL Rewriting with ASP.NET'/><category term='Auhentication Types'/><category term='Polymorphism'/><category term='Asynchronous Programming'/><category term='Example of Atlas with Dot Net'/><category term='Refactoring Enhancement'/><category term='Asp Net Ajax Autocomplete Extender'/><category term='Ajax FilteredTextbox Extender'/><category term='Silverlight 1.0'/><category term='Types of Authorization'/><category term='UpdatePanel Control'/><category term='Ajax Accordion Events'/><category term='HTTP Handlers'/><category term='ASP.Net'/><category term='ASP NET Handler Session'/><category term='IIS Settings'/><category term='ASP NET Session State'/><category term='URL Rewriting with Dot Net'/><category term='WCF Example'/><category term='Discovery File'/><category term='UpdatePanel Tips and Tricks'/><category term='Validation Controls in Dot Net'/><category term='Net 3.5 Changes'/><category term='Abstraction'/><category term='VB Net Object Oriented'/><category term='CSS in Dot Net'/><category term='OOPS Concepts in Dot Net'/><category term='Example of Ajax with Dot Net'/><category term='URL Rewriting'/><category term='Email'/><category term='Populate TreeView Control'/><category term='Multiple Active Result Set'/><category term='MVC Architecture in Dot Net'/><category term='AlwaysVisibleControlExtender'/><category term='Tree View Control ASP NET'/><category term='Controllers'/><category term='SQL Server 2005 Reporting Services ASP NET'/><category term='Rich Text Editor Download'/><category term='What is XML?'/><category term='TreeView Control Data Binding'/><category term='Ajax Accordion Styles'/><category term='Data Access Layer Using VB NET'/><category term='HTTP Modules in ASP NET'/><category term='DataPager Example'/><category term='Validation Controls in Asp Dot Net 2.0'/><category term='WPF Rich Text Editor'/><category term='DISCO'/><category term='Sealed Class'/><category term='New in Framework 3.5'/><category term='C Sharp Vb Net'/><category term='OOPS'/><category term='Asp Net Tutorials'/><category term='Serialization in Dot Net Framework'/><category term='Ajax Extender Controls'/><category term='ASP NET Globalization and Localization'/><category term='ASP Net Rich Text Editor'/><category term='Asp Net Generic Handler'/><category term='Multi Threading in Dot Net'/><category term='Asp.Net Introduction'/><category term='An Overview of ASP.NET'/><category term='URL Rewriting with ASP Dot NET'/><category term='Ajax TreeView Control'/><category term='DAL'/><category term='WCF Tutorial'/><category term='Inheritance'/><category term='ListView'/><category term='Integrating Reporting Services With Web Application'/><category term='4.0 New Features'/><category term='TreeView Control Tutorial'/><category term='Ajax Slideshow Extender Control'/><category term='Atlas with ASP.NET 2.0'/><category term='Eclipse 3.5 What New'/><category term='Update Panel Asp Net Gridview'/><category term='Globalization and Localization C#'/><category term='Silverlight with Asp.Net'/><category term='Improve Code'/><category term='ASP.NET Skins'/><category term='AJAX Password Strength Extender'/><category term='UDDI'/><category term='HTTP Modules'/><category term='LINQ to SQL Code Examples'/><category term='Models'/><category term='Ajax Accordion Script'/><category term='Password Strength Extender'/><category term='XML Defination'/><category term='CSS in Asp.Net'/><category term='Object Composition'/><category term='Multiple Inheritance'/><category term='AJAX PopupControl Extender'/><category term='Model-View-Presenter framework for .NET'/><category term='Email Reading'/><category term='Introduction C# Generics'/><category term='Authentication'/><category term='Asp Net 3.5 Gridview'/><category term='ASP.NET Themes'/><category term='AJAX CollapsiblePanel Extender Control'/><category term='WCF Dot Net'/><category term='New in Dot Net 4.0'/><category term='Deployment in Asp Net 2.0'/><category term='ASP.NET 2.0 AJAX Extensions'/><category term='Generic Functions'/><category term='Silverlight'/><category term='.Net Security Architecture'/><category term='Partial Class in Asp.Net'/><category term='Windows Communication Foundation'/><category term='Asynchronous Process in ASP.Net'/><category term='Ajax RoundedCorners Control Extender'/><category term='Reading Address Book'/><category term='Better Improvement'/><category term='DOT NET WCF'/><category term='Dot Net Validation Controls'/><category term='What New Net 3.5'/><category term='Dot Net Threading'/><category term='Model View Presenter'/><category term='Features of Web Service'/><category term='XML Example'/><category term='C# MVP'/><category term='Rich Text Editor Iframe'/><category term='AJAX with ASP.NET 2.0'/><category term='Maintainability'/><category term='ListView and DataPager in ASP.NET 3.5'/><category term='Asp Menu Web Sitemap'/><category term='New Features in ASP Dot Net 2.0'/><category term='Ajax Control Toolkit'/><category term='HTTP'/><category term='ASP NET GridView Samples'/><category term='AJAX Controls'/><category term='WCF Interview questions'/><category term='Model View Presenter Using ASP.NET'/><category term='Split View'/><category term='Gridview Asp Net C#'/><category term='View State ASP NET C#'/><category term='Ajax Accordion Tutorial'/><category term='Themes In ASP.NET 2.0'/><category term='Ajax TextBoxWatermark Control Extender'/><category term='ASP.Net Web Service'/><category term='DataReader Object'/><category term='Address Book Scripts'/><category term='Dot Net Features'/><category term='Serialization in ASP Dot Net'/><category term='Class'/><category term='Structures'/><category term='Model View Presenter with ASP.NET'/><category term='LINQ'/><category term='Dot Net Latest News'/><category term='ASP NET MVC MVP'/><category term='Command Objects'/><category term='Types of Email Concept in Dot Net'/><category term='XSLT'/><category term='Net Framework 4.0 What New'/><category term='Microsoft ASP.NET AJAX Extensions'/><category term='AJAX Calendar Extender Control'/><category term='Difference Between VB.NET and C#'/><category term='DataContext Class'/><category term='ASP.Net 3.5'/><category term='Data Access Layer Using Dot NET 2.0'/><category term='Email Concept in ASP.Net'/><category term='Theme and Skins in Asp.Net'/><category term='MVP'/><category term='XML'/><category term='Contacts'/><category term='Objects'/><category term='Comparison for VB.NET and C#'/><category term='Orcas'/><category term='AJAX and Atlas with ASP.NET 2.0'/><category term='Override Keyword'/><category term='ASP.NET Site Navigation'/><category term='ASP.NET AJAX'/><category term='Data Provider'/><category term='ASP.Net Threading'/><category term='Data Access Layer'/><category term='Example of Atlas with ASP.NET'/><category term='Debugging Code'/><category term='Data Set'/><category term='Dot Net URL Rewriting'/><category term='MVC vs MVP'/><category term='Ajax Toolkit Accordion'/><category term='Asp Net Handler'/><category term='ADO.NET Connection Feature'/><category term='Introduction of Asp.Net'/><category term='Accordion in AJAX Control Toolkit'/><category term='Asp Net 3.5 Features'/><category term='Validation Controls in Asp Dot Net 3.5'/><category term='Developing Silverlight'/><category term='ADO.NET Architecture'/><category term='Resizable Control Extender'/><category term='Ajax ToggleButton Control Extender'/><category term='Dot Net Authentication'/><category term='ASP.Net Authentication'/><category term='Deployment in Asp Net'/><category term='Example of AJAX with ASP.NET'/><category term='LINQ with ASP.Net 3.5'/><category term='Language Integrated Query'/><category term='Asp Net 2.0 Gridview'/><category term='View State Variable'/><category term='Send Mail in Asp.Net'/><category term='AJAX'/><category term='Virtual Keyword'/><category term='Introduction of Silverlight'/><category term='Deploying Web Service'/><category term='DataPager in ASP.NET 3.5'/><category term='URL Rewriting with ASP.NET 2.0'/><category term='AutoCompleteExtender'/><category term='Rich Text Editor'/><category term='Asp Dot Net MVC Framework'/><category term='AJAX Dropdown Extender'/><category term='Data Access Layer in ASP NET'/><category term='C# NET TreeView Control'/><category term='Types of Themes'/><category term='MVP Architecture ASP NET'/><category term='Ajax Slider Control Extender'/><category term='Multi Threading'/><category term='Model-View-Presenter in ASP.NET'/><category term='LINQ with SQL Server'/><category term='Types of Validation Controls in ASP Dot Net 2.0'/><category term='ASP NET Globalization Culture'/><category term='VB Net and ASP Net'/><category term='Themes in Dot Net'/><category term='Access Keywords'/><category term='HTTP Handlers ASP NET'/><category term='WPF and WF'/><category term='Types of Serialization in Dot Net'/><category term='Create Web Service'/><category term='Email Application in Dot Net'/><category term='Multi-Treading in ASP.Net'/><category term='Reporting Services ASP NET C#'/><category term='MARS'/><category term='PopupControl Extender'/><category term='An Overview of ASP.NET 3.5'/><category term='Deploy Dot Net Application'/><category term='MVC Architecture'/><category term='Ajax Rich Text Editor'/><category term='Disable Viewstate in ASP NET'/><category term='Asp Net Ajax Accordian'/><category term='Example Globalization and localization'/><category term='WCF Samples'/><category term='Forms-based Authentication'/><category term='Use of View State'/><category term='DataPager'/><category term='Difference Between MVC MVP Patterns'/><category term='REST'/><category term='AJAX UpdatePanel'/><category term='Asp Net 4.0 New Features'/><category term='AJAX Resizable Control Extender'/><category term='ASP.NET AJAX UpdatePanel'/><category term='Introducing Generics'/><category term='ASP Dot Net Features'/><category term='Evolution of ADO.NET'/><category term='Net 4.0 New Features'/><category term='Ajax Control Toolkit Extender'/><category term='Readability'/><category term='Generic Class'/><category term='Web Service'/><category term='Connection Object'/><category term='ListView in ASP.NET 3.5'/><category term='Email Concept in Dot Net'/><category term='SOAP'/><category term='Send Mail in Dot Net'/><category term='Using Statement'/><category term='AJAX DragPanel Extender'/><category term='Authorization in ASP.NET'/><category term='WCF'/><category term='MVC Framework'/><category term='Reading Email Address'/><category term='Integrated ASP.NET AJAX Support'/><category term='Passport Authentication'/><category term='ListView Example'/><category term='Deployment in Dot Net'/><category term='ASP.NET Model View Presenter'/><category term='2008 Framework Features'/><category term='AJAX Always Visible Control Extender'/><category term='Reporting Services in Web Application'/><category term='AJAX ConfirmButton Extender Control'/><title type='text'>Dot Net Complete Help, Dot Net Tips, Dot Net Complete Information</title><subtitle type='html'>Dot Net, Asp Dot Net, Dot Net Tricks, Oracle Dot Net, Dot Net Tutorial, Dot Net Help, SQL Dot Net, Dot Net Compact Framework, Ado Dot Net, Dot Net Interview Questions, Vb Dot Net, Dot Net EBook, Ajax Dot Net, Dot Net Books, Free EBooks Dot Net, Asp Dot Net Code, Vb Dot Net Code, Asp Dot Net Help, Recent Blog Entries, Free EBooks Asp Dot Net</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></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-4414130591562689667.post-3092590460165788751</id><published>2010-03-12T15:11:00.000+05:30</published><updated>2010-03-12T15:11:23.680+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Generics VB.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Definition Generic'/><category scheme='http://www.blogger.com/atom/ns#' term='Generic Class'/><category scheme='http://www.blogger.com/atom/ns#' term='Generic Functions'/><category scheme='http://www.blogger.com/atom/ns#' term='Introducing Generics'/><category scheme='http://www.blogger.com/atom/ns#' term='Introduction C# Generics'/><category scheme='http://www.blogger.com/atom/ns#' term='Generics C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Generics ASP NET'/><title type='text'>Generics in VB.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Introduction of Generics&lt;/b&gt;&lt;br /&gt;Generics are very useful if you know what they are and how to use them. In this article we will show you what generics are and what they are used for. We will show you situations where the usage of generics makes sense. You will understand what the term generic stands for and how it can be used in your own projects.&lt;br /&gt;&lt;br /&gt;C++ was one of the first languages, which used some types of generics, however they were called “templates”. C# uses a similar syntax as the C++ templates, however in C# they are much easier to use. Generics are first available in Whidbey. Earlier versions of the CLR don’t support it. &amp;lt;&amp;gt; is used in C# to define a generic. However in VB.NET we use the keyword “Of”. In this article we will only discuss the VB.NET syntax.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What are Generics?&lt;/b&gt;&lt;br /&gt;The term “generic” means not to be bound to any specific type regardless of whether we are referring it to any programming language or not! Just think of a “glass”, which can be filled with the following types: water, juice, soda etc. As you can see it is not bound to one type. It can be filled with any type. In the same way we can refer it to VB.NET. We could create a class called “Glass” which could store any of these types depended on the users choice.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: blue;"&gt;Generics in one sentence :&lt;/span&gt;&lt;/b&gt; &lt;i&gt;Generics can be used to store collections, which are not bound to any data type.&lt;/i&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Why should I use Generics?&lt;/b&gt;&lt;br /&gt;Just imagine that you are working in a class where you would need to store different data types in a collection. Of course you could use an array, but don’t forget that you will need to create different arrays for different data types, which will just bloat your code. Furthermore your code will be unnecessary longer than needed. In that case we can use generics. We could use one generic class that could handle all of data types, without requiring writing the code again and again. This will save our time, resources, and increase the performance, because the user would not need to cast the data types. In summary we can say that generics are used for the following reasons:&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Performance&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Type Safe&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Code Reuse&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Performance&lt;/b&gt;&lt;br /&gt;How can generics help the developer to get a better performance? This is simple. The data-types are checked in the compile-timer rather than in run-time. Simply this change will improve the performance. No type casting necessary at run-time. However you should know that performance and speed are not the main aspects to use generics, but in maintainability and cleaner code. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Type Safe&lt;/b&gt;&lt;br /&gt;This means that whenever you add an object to the collection it is checked at compile time. That means that the data type should be safe and if you pass a wrong data-type to the collection, it will throw an error during the compile time and not in the run time. This way you can make sure to handle all errors so that they don’t appear at run time, when the client is using the application. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Code Reuse&lt;/b&gt;&lt;br /&gt;If you want to store different data types in a (non-generic) collection, than you won’t have any other option than declaring different collections for that. For example: You will need to declare a collection for integers, another for strings and another for double data types. These will unnecessary bloat your code. When using generics you just need to set the data type as a parameter and viola you can use it with whatever type you like.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Simple Example&lt;/b&gt;&lt;br /&gt;We have read a lot by now. It’s time to see some code. To demonstrate how simple it is to use we have chosen a simple example. Lets see how it looks like:&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Our Gen Class:&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: blue;"&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;Public Class Gen(Of T)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim dataType As T&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Property Val() As T&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Get&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Return dataType&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Get&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Set(ByVal value As T)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dataType = value&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Set&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Property&lt;br /&gt;&lt;br /&gt;End Class&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Our Main:&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: blue;"&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;Sub Main()&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' This one accepts strings&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim mystring As New Gen(Of String)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; mystring.Val = "hello world"&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine(mystring.Val)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ' Change the declaration so that it accepts now an integer&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim myInt As New Gen(Of Integer)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; myInt.Val = 5&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Console.WriteLine(myInt.Val)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine("Press Enter to finish ... ")&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.Read()&lt;br /&gt;&lt;br /&gt;End Sub&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Our Output&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: blue;"&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;hello world&lt;br /&gt;5&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How it works&lt;/b&gt;&lt;br /&gt;As you can see above we have only two main parts. The first is the class “Gen” and the second is the main function. The “Gen” class is generic. As already described in the introduction we need the “Of” keyword to declare it as generic. In C# and C++ we can use &amp;lt;&amp;gt; to create generic classes. &lt;br /&gt;&lt;br /&gt;The “T” next right to the “Of” represents our data-type which we will pass when we create a new instance of that class. The rest of the code should be familiar to you. &lt;br /&gt;&lt;br /&gt;The interesting part is going on in the main function where we create two instances of the “Gen” class. In the first instance we are using a String. This will allow passing string values to the class variables.&lt;br /&gt;&lt;br /&gt;Dim mystring As New Gen(Of String)&lt;br /&gt;mystring.Val = "hello world"&lt;br /&gt;System.Console.WriteLine(mystring.Val)&lt;br /&gt;&lt;br /&gt;In the second instance we are using an Integer. Here we can use integer values to pass to the class variables. &lt;br /&gt;&lt;br /&gt;Dim myInt As New Gen(Of Integer)&lt;br /&gt;myInt.Val = 5&lt;br /&gt;System.Console.WriteLine(myInt.Val)&lt;br /&gt;&lt;br /&gt;As you can see this was our first simple generic example. To get the same result without using generic, will cost you two classes. Your code will just bloat for nothing. The first one would need a string and the second one could use an integer, but what if you decide to create a third data-type, lets say a double? Well then you will need to create a third class, which will again make your code longer than it already is. While using generics you only need one class for any data-type.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://weblogs.asp.net/sonukapoor/pages/237898.aspx"&gt;weblogs.asp.net&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-3092590460165788751?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/3092590460165788751/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/generics-in-vbnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3092590460165788751'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3092590460165788751'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/generics-in-vbnet.html' title='Generics in VB.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-4233379305338845877</id><published>2010-03-05T19:05:00.000+05:30</published><updated>2010-03-05T19:05:03.047+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP Net Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor Iframe'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='RTE Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='WPF Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor Download'/><title type='text'>Rich Text Editor - Part II</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;After we have explored how to create &lt;a href="http://dotnetcompletehelp.blogspot.com/2010/03/rich-text-editor-part-i.html"&gt;a rich text editor&lt;/a&gt;, it is time to add some new features which will extend its usability and benefits. In this article we will get to know how new features were implemented. Again, all the major functionalities are written in javascript.&lt;br /&gt;&lt;br /&gt;Below are the newly added features.&lt;/span&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Strike Through: This will strike through the text entered by the user.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Decrease-Increase Indent: This will decrease or increase the text indent.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Insert Images: This will open a new window giving the user the ability to upload an image to the server and insert it directly into the editor.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Copy, Cut, and Paste: This will copy, cut or paste the text entered by the user into the clipboard.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Print: It allows only the text to be printed by opening the Print Setup dialog.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Bulleted List &amp;amp; Numbered List: It adds a bullet or number at the beginning of the text.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Super-Sub script: It will format the text into super script or sub script.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Insert Lines: It adds lines to the text.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Add HTML code to the user control&lt;/b&gt;&lt;br /&gt;We will add new HTML elements to add more features into the toolbar. We will place images for all the above mentioned actions and handle all the events to perform their functionalities.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 1&lt;/i&gt;&lt;br /&gt;&amp;lt;IMG class=StrikeOut id=Strikethrough&lt;br /&gt;&amp;nbsp;onmouseover="ChangeImg('Strikethrough','strikethrough.over.gif')"&lt;br /&gt;&amp;nbsp;title="Strike Through" onclick="Formats('StrikeThrough','&amp;lt;%= this.HamEditorChildID %&amp;gt;' )"&lt;br /&gt;&amp;nbsp;onmouseout="ReturnImg('Strikethrough','strikethrough.gif',imgStatusUnderLine)"&lt;br /&gt;&amp;nbsp;src="Images/strikethrough.gif" &amp;gt;&lt;br /&gt;&lt;br /&gt;In the above listing we added an img HTML control. The onmouseover event will call a javascript function (which I already explained in the previous article), will change the image to a selected one, the onclick event will call another function which will apply the formatting into the selected text, and onmouseout will return the image to its previous state. For the rest of the features we will use the same concept except for the Insert Images.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S5EHGOoaAfI/AAAAAAAAA_Q/92CLt9asods/s1600-h/image001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="202" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S5EHGOoaAfI/AAAAAAAAA_Q/92CLt9asods/s400/image001.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 1 &lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Javascript File&lt;/b&gt;&lt;br /&gt;We will add the new functions to the already created javascript file to handle the events for all the new features. They are all defined in one javascript file linked to this editor.&lt;br /&gt;&lt;i style="color: blue;"&gt;&lt;br /&gt;Listing 2&lt;/i&gt;&lt;br /&gt;function Formats(style,editorId)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Save the Iframe id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var finalDivId = editorId + '_content';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the focus back to the text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.frames[finalDivId].focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Apply the new style&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.frames[finalDivId].document.execCommand(style);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Set the focus back to the text&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; document.frames[finalDivId].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above function is used by almost all the new event handlers. It takes two parameters; the first is the style to be applied, for example Copy, Paste, etc; the second is the editor id. We used the same function used before (execCommand) to apply the transformation.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 3&lt;/i&gt;&lt;br /&gt;function SetBorders(id)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // set the borders to the emoticons icons onmouseover&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var imgBorder = document.getElementById(id);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderStyle = "solid";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderWidth = "thin";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderColor = "#688B9A";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above function is being called when the insert emoticons div layer is shown. When the mouse is over an emotion, what we do is call this function which will set the borders for the table cell. In this way, it will be obvious for the user to see that he is over a specific emoticon. Notice the x image we added, it allows the user to close the div layer if he does not want to add any emoticons.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHI3E-ddI/AAAAAAAAA_g/WxkK3WLV1x0/s1600-h/image002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="207" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHI3E-ddI/AAAAAAAAA_g/WxkK3WLV1x0/s400/image002.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 2&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: blue;"&gt;&lt;br /&gt;Listing 4&lt;/i&gt;&lt;br /&gt;function ClearBorders(id)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Clear the borders of the emoticons icons onmouseout event&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var imgBorder = document.getElementById(id);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderStyle = "solid";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderWidth = "thin";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; imgBorder.style.borderColor = "white";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above function will be called when the mouse is out of a specific emotion to clear its borders.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 5&lt;/i&gt;&lt;br /&gt;function SetImage(editorId,path,e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the click location&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var height = e.clientY + parseInt('5');&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the height inside the clicked image&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var offsetHeight = parseInt(e.offsetY);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; height = height - offsetHeight;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the click location(width)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var width = e.clientX&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Get the width inside the clicked image&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var offsetWidth = parseInt(e.offsetX);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; width = width - offsetWidth;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Save the iframe id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; var finalDivId = editorId + '_content';&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; path = unescape(path);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Insert an image from the users Computers. &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; window.open('UploadImages.aspx?path=' + path +&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;'&amp;amp;f=' + finalDivId,null,'width=500px,height=50px,titlebar=no,menubar=no,statusbar=no,toolbar=no,top='&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;+ height + 'left=' + width );&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;For the insert images new feature, we created a new webform called UploadImages.aspx. This form will be open when the user clicks on insert images icon to allow the user to select an image from his/her computer and upload it into the server in order to be able to insert it into the text editor. It contains two other fields to let the user specify the width and height of the image he/she wants to insert after it was uploaded. Below is a picture of the text editor when this new window is being opened.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHIEjlCKI/AAAAAAAAA_Y/CjXSXzAu_As/s1600-h/image003.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="202" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHIEjlCKI/AAAAAAAAA_Y/CjXSXzAu_As/s400/image003.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 3&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The user has the ability to browse his/her computer to select an image and in its code behind and we are handling the upload part into the web server. I gave a great option for the administrator to set the directory on the web server where the image is going to be uploaded. I will explain it in detail in the code behind part. The maximum number of digits of the height and width properties is 3. The minimum value for the height property is 100 px and the maximum value of the width property is 150 px; as you can see they are their default values.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 6&lt;/i&gt;&lt;br /&gt;function insertsImage(imageurl,editorId,height,width)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; opener.document.frames[editorId].focus();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(imageurl != "" | editorId!= "")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; imageurl = unescape(imageurl);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; var imageurl = imageurl + '"'&amp;nbsp; + "width=" + width + "px" + " " + "height="+ height + "px";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; // Save the iframe id&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; opener.document.frames[editorId].document.execCommand('InsertImage',false,imageurl);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; opener.document.frames[editorId].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This function will be called when the user clicks on insert image. In its click event we are uploading the file and then inserting the image through javascript into the text editor with the specified width and height.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S5EHJx-YG_I/AAAAAAAAA_o/gnc0wExEHqw/s1600-h/image004.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="203" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S5EHJx-YG_I/AAAAAAAAA_o/gnc0wExEHqw/s400/image004.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 4&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Code Behind &lt;/b&gt;&lt;br /&gt;We will see how the upload images code behind is implemented and how the administrator of this editor can set the default directory where the images can be uploaded.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 7&lt;/i&gt;&lt;br /&gt;public string FilePath&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return _filePath;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _filePath = Server.HtmlEncode(Request.ApplicationPath + value);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above listing is a property of type string which the administrator can use to set the default upload directory. The below listing will show you how to use it in your webform to specify the directory. This path will be sent to the UploadImages.aspx page query string when it is being opened from the javascript function.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 8&lt;/i&gt;&lt;br /&gt;string imagePath = "/UserImages";&lt;br /&gt;((hamHtmlEditor)this.FindControl("HamHtmlEditor1")).FilePath = imagePath;&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 9&lt;/i&gt;&lt;br /&gt;public string Location&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return _location;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _location = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above property is being used to get the editor ID in order to be able to insert it directly after being uploaded to the web server.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 10&lt;/i&gt;&lt;br /&gt;if(heightValidator.IsValid &amp;amp;&amp;amp; widthValidator.IsValid)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; string elementToInsert = Request.QueryString["f"];&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(UploadImage.PostedFile != null &amp;amp;&amp;amp; UploadImage.PostedFile.ContentLength &amp;gt; 0)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; try&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string fileName = System.IO.Path.GetFileName(UploadImage.PostedFile.FileName);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; string fileLocation = Request.QueryString["path"] + "/" + fileName; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; this.ImagePath = Server.HtmlEncode(fileLocation);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; this.Location = elementToInsert;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Button1.Enabled = false;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; UploadImage.PostedFile.SaveAs(Server.MapPath(fileLocation));&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; catch(Exception ex)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Response.Write("&amp;lt;script language=javascript&amp;gt;alert('"+&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; ex.Message.ToString().Replace(@"\",@"\\")+"');&amp;lt;/script&amp;gt;");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; finally&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Button1.Enabled = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The above code is written inside the insert images' button click. Its purpose is to upload the image to the already specified directory after it checks if the height and width values are correct. The try and catch blocks are used to handle exceptions.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing11&lt;/i&gt;&lt;br /&gt;public bool ShowHeader&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; get&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; return _Header;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; set&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; _Header = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;A new property of type Boolean is introduced. Once it is set to false the toolbar will not show up. I added this property to give you the ability to show only read-only text after the text is being posted.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHKRrMbFI/AAAAAAAAA_w/paTnd46nSOg/s1600-h/image005.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="157" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S5EHKRrMbFI/AAAAAAAAA_w/paTnd46nSOg/s400/image005.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 5&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The above figure is the rich text editor when its ShowHeader property is set to false. The toolbar and the below other icons will be invisible. In this way, you can use it only for displaying your saved text.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S5EHLIKw7eI/AAAAAAAAA_4/NPa0LJQButA/s1600-h/image006.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="202" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S5EHLIKw7eI/AAAAAAAAA_4/NPa0LJQButA/s400/image006.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Figure 6&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Here is a final version of the editor with all the new features being used. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;This editor is being tested on IE only for this release. Hope you gained useful information throughout this article. I would like to have feedback from my blog readers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://aspalliance.com/1156_Rich_Text_Editor__Part_II.all"&gt;aspalliance.com&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-4233379305338845877?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/4233379305338845877/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/rich-text-editor-part-ii.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4233379305338845877'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4233379305338845877'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/rich-text-editor-part-ii.html' title='Rich Text Editor - Part II'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S5EHGOoaAfI/AAAAAAAAA_Q/92CLt9asods/s72-c/image001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-7032348872416340801</id><published>2010-03-04T11:40:00.000+05:30</published><updated>2010-03-05T18:53:38.252+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Java Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP Net Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor Iframe'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='RTE Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='WPF Rich Text Editor'/><category scheme='http://www.blogger.com/atom/ns#' term='Rich Text Editor Download'/><title type='text'>Rich Text Editor - Part I</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;The editor contains the following elements:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;1). A toolbar containing all the functionality (listed below)&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Alignment (left, center, right)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Font formatting (bold, underline, italic, font size, font name, font color)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Word counts, remove formatting, insert lines, undo, redo, and insert emoticons &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;2). An HTML page integrated inside an Iframe and a text area element integrated inside another iframe. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;3). Two icons for displaying "View as HTML" and "Design Mode," a textbox holding the value of the word count, and finally two hidden textboxes&amp;nbsp; to preserve the data entered by the user.&lt;br /&gt;&lt;br /&gt;To keep up with this demonstration, you should have knowledge in javascript language and in HTML. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Add HTML code to the user control&lt;/b&gt;&lt;br /&gt;We will create a user control and create the necessary HTML elements. The user control does not contain &amp;lt;head&amp;gt;, &amp;lt;body&amp;gt; or &amp;lt;form&amp;gt; tags.&lt;br /&gt;&lt;br /&gt;We will create 3 tables for displaying the icons for the toolbar plus 3 dropdown lists; 2 are placed at the top of the control and 1 is placed at the bottom of the control.&amp;nbsp; Three common events are being used for each icon, &lt;i&gt;onmouseover&lt;/i&gt;, &lt;i&gt;onmouseup&lt;/i&gt;, &lt;i&gt;onclick&lt;/i&gt; and they are handled using javascript which are all embedded inside a javascript file. Separating the javascript code from the HTML code will let your code be well understood and debugged. Then we will create 3 div layers, the first layer contains the already created HTML page. I have used an HTML page because if the user has entered a url it will automatically render its HTML code the same for the sake of using icons inside your text. The second will contain a text area element which is used for displaying the HTML code to the user during runtime and the third will contain the emoticons which will be shown when the user click on the insert emoticons image.&lt;br /&gt;&lt;br /&gt;To enable the user to enter data at runtime, you have to add set the page "designMode" property on to where the control is being used.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 1&lt;/i&gt;&lt;br /&gt;(onload="document.frames['HamHtmlEditor1_content'].document.designMode='on'")&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S49KdqwL8RI/AAAAAAAAA-4/NVVWJFGtp5w/s1600-h/image001.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="102" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S49KdqwL8RI/AAAAAAAAA-4/NVVWJFGtp5w/s400/image001.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;Figure1&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Javascript File&lt;/b&gt;&lt;br /&gt;We will write functions for handling the events raised by the user. First, we will define global variables. Each of these variables has its own functionality, but most are created to store a value indicating if an icon was previously clicked or no by default its value is equal to No. Only one variable has another purpose, this variable is called (sourceText) and will be equal to the text entered by the user. &lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 2&lt;/i&gt;&lt;br /&gt;var sourceText= '';&lt;br /&gt;var imgStatusBold = 'No';&lt;br /&gt;var imgStatusItalic = 'No';&lt;br /&gt;var imgStatusUnderLine = 'No';&lt;br /&gt;var imgStatusLeft = 'No';&lt;br /&gt;var imgStatusCenter = 'No';&lt;br /&gt;var imgStatusRight = 'No';&lt;br /&gt;var imgStatusRemoveF= 'No';&lt;br /&gt;var imgStatusWCount = 'No';&lt;br /&gt;var imgStatusInsertL = 'No';&lt;br /&gt;&lt;br /&gt;Based on the value of the above variables, when the user clicks on an icon, if the specific variable's value is equal to “Yes” it indicates that this icon is not as the equal to the one loaded when the user control has been loaded and then directly we change the icon to its first status and set its variable to “No.” If the value was “No” then we will change the icon and its proper variable to “Yes.”&lt;br /&gt;&lt;br /&gt;Three common functions are called &lt;i&gt;onmouseover&lt;/i&gt;, &lt;i&gt;onmouseup&lt;/i&gt;, and &lt;i&gt;onclick&lt;/i&gt;. &lt;i&gt;Onmouseover&lt;/i&gt;, a function (ChangeImg()), is used to change the icon when the user places his mouse at a certain icon. This function takes 2 parameters. The toolbar icons are contained in a folder called "Images" under the root element of the web application.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 3&lt;/i&gt;&lt;br /&gt;function ChangeImg(id, imgsrc)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var imgSrc = "Images/" + imgsrc;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById(id).src = imgSrc;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;i&gt;Onmouseup&lt;/i&gt; function is used to return the icon to its previous state when the mouse leaves a specific icon; it takes 3 parameters (icon id, new icon name, and a variable).&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 4&lt;/i&gt;&lt;br /&gt;function ReturnImg(id, imgsrc, ownVar)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(ownVar == 'No')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;var imgSrc = "Images/" + imgsrc;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById(id).src = imgSrc;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The third parameter is used to indicate either this icon was selected or not. Its default value is No.&lt;br /&gt;&lt;br /&gt;Onclick function is called to perform a specific action. A single javascript method is used for all the actions, plus for each action a specific criteria.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 5&lt;/i&gt;&lt;br /&gt;document.frames['HamHtmlEditor1_content'].document.execCommand('JustifyLeft',false,null);&lt;br /&gt;&lt;br /&gt;The above method is used to align the text entered by the user to the left. &lt;i&gt;ExecCommand&lt;/i&gt; is used to execute a command on a document. It consists of predefined functions which are used to manipulate the page layout directly into the browser. Do not use it until the page has finished loading.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 6&lt;/i&gt;&lt;br /&gt;function MakeBold(boldover, bold)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var img = document.getElementById('Bold')&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var imgBold = "Images/" + boldover&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var imgNotBold = "Images/" + bold&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;img.src = imgBold;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(imgStatusBold == 'Yes')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;imgStatusBold='No';&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;img.src = "Images/" + bold;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;imgStatusBold= 'Yes'&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].document.execCommand('bold',false,null);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The function above is used to format the text entered by the user as bold. When he clicks on this icon, we should change it to another one. Set the global variable for this action to “Yes” which means that it has been selected. We will use this variable each time the user clicks on it to see if it has been previously selected or no, and then we will make the transformation to the text into bold. It takes 2 parameters, the first is to store the bold-over image location (url) and the second is to store the bold image location (url). The same concept is used to make the text Italic and underlined.&lt;br /&gt;&lt;br /&gt;To apply alignments into the text, we use the same as the MakeBold() function, but instead, the 3 alignment functionalities work in a parallel way which means that if a specific alignment is selected all others will be unselected and will retain their original status.&lt;br /&gt;&lt;br /&gt;Now we will create a function that counts how many words the user has entered. A variable is defined with default value equal to 0. Another variable is defined that holds the text entered. We will split the spaces in this variable, add the splitting results to an array and check each element length in the array. If it is equal to zero then it is a space, else add 1 to the specific variable. After this stage we will set the value of the textbox to the count variable.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 7&lt;/i&gt;&lt;br /&gt;var wordCount = document.frames['HamHtmlEditor1_content'].document.body.innerText;&lt;br /&gt;var count = 0;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;countWithSpace = wordCount.replace('\n', '');&lt;br /&gt;countWithoutSpaces = countWithSpace.split(' ');&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;for(i=0;i&amp;lt;countWithoutSpaces.length;i++)&lt;countwithoutspaces.length;i++)&gt;&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(countWithoutSpaces[i].length&amp;gt;0)&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;count +=1;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;window.parent.document.getElementById('HamHtmlEditor1_TxtCount').value = count;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;When the "Remove Formatting" image is clicked, we call a javascript function which sends "RemoveFormat" to the execCommand to remove all the formats applied to the text. It is very useful if a user wants to remove all the formats that he already applied into the text.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 8&lt;/i&gt;&lt;br /&gt;function RemoveFormating()&lt;br /&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; document.frames['HamHtmlEditor1_content'].document.execCommand('RemoveFormat');&lt;br /&gt;&amp;nbsp;&amp;nbsp; document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;"&lt;i&gt;Undo&lt;/i&gt;" &amp;amp; "&lt;i&gt;Redo&lt;/i&gt;" are done the same as the above javascript function, but they send "undo" or "redo" to the execCommand to undo or redo the user action. It takes 1 parameter which is the execCommand function name.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 9&lt;/i&gt;&lt;br /&gt;function Formats (style)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].document.execCommand(style);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;When the user clicks on "Insert emoticons" icon, we will show the third div layer placed directly after this icon which contains all the emoticons images. When doing this we have to use Javascript. &lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 10&lt;/i&gt;&lt;br /&gt;function ShowDiv(images)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var div = document.getElementById(images);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if(div.style.display == 'block')&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;div.style.display = 'none';&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;else&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;div.style.display = 'block';&lt;br /&gt;}&lt;/countwithoutspaces.length;i++)&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S49KffI4DDI/AAAAAAAAA_A/UJRumvaPXz0/s1600-h/image002.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="205" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S49KffI4DDI/AAAAAAAAA_A/UJRumvaPXz0/s400/image002.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;Figure2: Shows the editor when the "insert emoticons" is clicked.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When the user clicks on any emoticon inside the third div layer, another javascript function is called to insert that image and to place the cursor back to the editor. This method takes 3 parameters. The first parameter is passed to execCommand that inserts the image into the document (insertimage), the second is the image location (url), and the third is the id of the div layer.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 11&lt;/i&gt;&lt;br /&gt;function insertImages(style,url,images)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById(images).style.display = 'none'&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;HamHtmlEditor1_content.document.execCommand(style,'',url)&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;When the "&lt;i&gt;View as HTML&lt;/i&gt;" image is clicked, the second div layer is shown and the first layer is hidden. The "readonly" property of this div layer is set to "true" which means that the user at runtime cannot edit it, then we will get the HTML code and insert it into that div layer.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 12&lt;/i&gt;&lt;br /&gt;function TransformtoHtml()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById('HamHtmlEditor1_Div2').style.display = 'block';&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById('HamHtmlEditor1_Div2').innerText = &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].document.body.innerHTML;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;When the "&lt;i&gt;Design view&lt;/i&gt;" image is clicked, the third div layer (containing the HTML code) is just hidden.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 13&lt;/i&gt;&lt;br /&gt;function TransformToText()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById('HamHtmlEditor1_Div2').style.display = 'none';&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The dropdown lists are used to let the user selects the predefined data entered to manipulate the text.&lt;br /&gt;&lt;br /&gt;The first one is used to change the font size; sizes may vary from 1 (10 pt) to 7 (22 pt). We will handle the onclick event by calling a javascript function. This function gets the user selected from the dropdown list and sends it as a third parameter to the execCommand command. The first parameter is the FontSize, in which you are telling this command to execute the FontSize function with its specific size.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 14&lt;/i&gt;&lt;br /&gt;function ChangeFont()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fontSize = document.getElementById('FontDropDownonchange');&lt;br /&gt;&lt;br /&gt;&amp;nbsp;document.frames['HamHtmlEditor1_content'].document.execCommand('FontSize',0,fontSize.options[fontSize.selectedIndex].text);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The code below is used to change the font name; the first parameter of the execCommand command takes fontname as first parameter, the second is false or 0, and the third is the user’s selection.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 15&lt;/i&gt;&lt;br /&gt;function ChangeFontName()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fontName = document.getElementById("FontFamilyName");&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].document.execCommand('FontName',false, document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The third is used to change the font color; the colors are predefined so if you want to add more colors you can modify the HTML code of this dropdown list.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 16&lt;/i&gt;&lt;br /&gt;function ChangeFontColor()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;var fontColor = document.getElementById("Color");&lt;br /&gt;&amp;nbsp;&amp;nbsp; &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].document.execCommand('ForeColor',false,fontColor.options[fontColor.selectedIndex].text);&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.frames['HamHtmlEditor1_content'].focus();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The final function will assign the text entered by the user to a hidden input HTML element and store its specific HTML code to another hidden HTML element. It is called when the editor loses the focus (onblur) event of the iframe containing the HTML page. In this way, we can use the two properties created as you will see in the next section to get the hidden inputs values from the code behind.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 17&lt;/i&gt;&lt;br /&gt;function CloneText()&lt;br /&gt;{&lt;br /&gt;&amp;nbsp; document.getElementById('HamHtmlEditor1_ContentTxt').innerText = document.frames['HamHtmlEditor1_content'].document.body.innerText;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;document.getElementById('HamHtmlEditor1_ContentHtml').value = document.frames['HamHtmlEditor1_content'].document.body.outerHTML;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;After completing this stage, you will have the javascript file ready; all you need to do now is to link it to the page where you want to use the user control by adding the below code in the &amp;lt;head&amp;gt; tag.&lt;br /&gt;&lt;br /&gt;&amp;lt;script src="HTMLEditor.js" language="javascript" type="text/javascript&amp;gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&lt;br /&gt;If you want to debug the code included in the javascript, add the word "debugger;" at the beginning of the code. In this way the compiler will start the debugging mode. Or you can go to your internet&lt;br /&gt;explorer options, navigate to Advanced, unselect the disable script debugging (internet explorer), unselect disable script debugging (other) and now add your breakpoints.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Editor Properties&lt;/b&gt;&lt;br /&gt;If you want to save the text entered by the user to a .txt file or the HTML code to another .txt file, you can use the two properties added to this control.&lt;br /&gt;&lt;br /&gt;First create two fields in your ascx.cs page.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 18&lt;/i&gt;&lt;br /&gt;protected System.Web.UI.HtmlControls.HtmlInputText ContentTxt;&lt;br /&gt;protected System.Web.UI.HtmlControls.HtmlInputText ContentHtml;&lt;br /&gt;&lt;br /&gt;Create two protected string variables which will store the above created fields' values.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 19&lt;/i&gt;&lt;br /&gt;protected string _text;&lt;br /&gt;protected string _html;&lt;br /&gt;&lt;br /&gt;The first property is called "ContentText" which can get the text and assign it to a string variable in your code behind.&lt;br /&gt;&lt;br /&gt;ContentTxt is declared as HtmlInputText control in the field area. Its property value will be stored into the _text string variable.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 20&lt;/i&gt;&lt;br /&gt;public string ContentText&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;get &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return _text = ContentTxt.Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_text = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;The second is called "ContentInnerHtml" which can get the specific HTML code for the entered text.&lt;br /&gt;&lt;br /&gt;ContentInnerHtml is declared as HtmlInputText in the field area. Its property value will be stored into the _html string variable.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 21&lt;/i&gt;&lt;br /&gt;public string ContentInnerHtml&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;get&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;return _html&amp;nbsp; = ContentHtml.Value;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;set&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;_html = value;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Adding a Stylesheet &lt;/b&gt;&lt;br /&gt;We will create a Stylesheet (Styles.css) to modify the toolbar and iframes UI. We will set the toolbar background color to blue and the background to repeat. Then we will give the same color to both the right and bottom borders of iframes. You are free to add whatever modification on the control user interface (UI) by modifying the below code.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Listing 22&lt;/i&gt;&lt;br /&gt;.HtmlView&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;background-color:white;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-width:medium;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-style:solid;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-color:cornflowerblue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-width:medium;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-color:cornflowerblue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-style:solid;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.FirstDiv&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;background-color:white;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-width:medium;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-style:solid;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-bottom-color:cornflowerblue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-width:medium;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-color:cornflowerblue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;border-right-style:solid;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;.toolbar&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;background-color:cornflowerblue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;background-repeat:repeat;&lt;br /&gt;&amp;nbsp;}&lt;br /&gt;&lt;br /&gt;Now it is time to link this Stylesheet to your webform where you dragged the user control by adding the below code inside the &amp;lt;head&amp;gt; tag.&lt;br /&gt;&lt;br /&gt;&amp;lt;LINK href="Styles.css" type="text/css" rel="stylesheet"&amp;gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S49KgC-XJNI/AAAAAAAAA_I/OTdrKL0GPBw/s1600-h/image003.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="158" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S49KgC-XJNI/AAAAAAAAA_I/OTdrKL0GPBw/s400/image003.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;div style="text-align: center;"&gt;&lt;i&gt;&lt;span style="font-size: small;"&gt;Figure 3&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;If you need to include more than one instance of the user control in a page, you have to create dynamical ids for all the div layers. You may have noticed the div layers’ ids are set to "userControlID_divlayer."&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;As you saw in this article, we explained it in detail using the javascript language and XHTML.&lt;br /&gt;&lt;br /&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://aspalliance.com/1092_Rich_Text_Editor_Part_I.all"&gt;aspalliance.com&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-7032348872416340801?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/7032348872416340801/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/rich-text-editor-part-i.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7032348872416340801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7032348872416340801'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/03/rich-text-editor-part-i.html' title='Rich Text Editor - Part I'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/S49KdqwL8RI/AAAAAAAAA-4/NVVWJFGtp5w/s72-c/image001.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-3249918450563518420</id><published>2010-02-24T11:51:00.000+05:30</published><updated>2010-02-24T11:51:40.279+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net Gridview'/><category scheme='http://www.blogger.com/atom/ns#' term='Example Gridview'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net 2.0 Gridview'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET GridView Samples'/><category scheme='http://www.blogger.com/atom/ns#' term='Gridview Asp Net C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net 3.5 Gridview'/><category scheme='http://www.blogger.com/atom/ns#' term='Update Panel Asp Net Gridview'/><title type='text'>GridView in ASP.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;br /&gt;The GridView control is one of the most powerful controls in ASP.NET. It's highly customizable and most Web developers are familiar with it. It requires too much work for mundane tasks such as sorting the rows based on columns, editing or deleting rows, etc.&lt;br /&gt;&lt;br /&gt;GridView control further enhances the flexibility of the previous DataGrid control. The GridView control reduces the amount of code you need to write.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S4TAQGnL6FI/AAAAAAAAA9Y/WB5QoExc5Bo/s1600-h/11297.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="192" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S4TAQGnL6FI/AAAAAAAAA9Y/WB5QoExc5Bo/s200/11297.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;i&gt;The Controls&lt;/i&gt;: The GridView and DetailsView controls under the Data tab in the Toolbox.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Figure 1 shows the GridView and DetailsView controls found under the Data tab in the Toolbox. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Configuring the SqlDataSource Control&lt;/b&gt;&lt;br /&gt;Create a Web application using Visual Studio. In the default page, drag-and-drop the SqlDataSource control. Using this control declaratively establishes a connection to a SQL data source without writing any code. In the days of ASP.NET 1.x, you needed to write elaborate code to access data sources using ADO.NET. Now, you have controls that encapsulate all the logic needed to access a data source.&lt;br /&gt;&lt;br /&gt;To configure the SqlDataSource control to connect to a SQL Server 2000 database, click on the Configure Data Source... link in the Smart Tag (see Figure 2).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S4TARnr5DlI/AAAAAAAAA9g/-VuyQuOpx74/s1600-h/11298.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="72" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S4TARnr5DlI/AAAAAAAAA9g/-VuyQuOpx74/s320/11298.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;The SqlDataSource Control&lt;/i&gt;: Click on the Configure Data Source... link to configure the SqlDataSource control.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Click on the New... button to establish a new data connection. &lt;br /&gt;&lt;br /&gt;Select the Northwind database (see Figure 3). Click on Test Connection to verify that the connection is working. Click OK when done.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TASR4lP4I/AAAAAAAAA9o/5tK-8e2uvpI/s1600-h/11299.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="281" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TASR4lP4I/AAAAAAAAA9o/5tK-8e2uvpI/s320/11299.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;span style="font-size: x-small;"&gt;&lt;i&gt;Specify the Database Properties&lt;/i&gt;: Select the Northwind database to specify the database properties.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You should see the data connection details (see Figure 4). Click Next to proceed.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S4TATNv4N1I/AAAAAAAAA9w/1z2wWVxNUEk/s1600-h/11300.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S4TATNv4N1I/AAAAAAAAA9w/1z2wWVxNUEk/s320/11300.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;View the Connection Details&lt;/i&gt;: After specifying the database properties, you should see the data connection details.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You have the option to save the connection string to the web.config file. If you do so, every time you need the connection string you can simply reference the connection string stored in web.config. In this example case, name the connection as NorthWindConn. &lt;br /&gt;&lt;br /&gt;If you examine your web.config now, you will see the added &amp;lt;connectionStrings&amp;gt; element: &lt;br /&gt;&lt;br /&gt;&amp;lt;configuration xmlns= "http://schemas.microsoft.com/.NetConfiguration/v2.0"&amp;gt;&lt;br /&gt;&amp;lt;appSettings/&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;connectionStrings&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;add name="NorthWindConn" connectionString="Server=(local);Integrated Security=True; Database=Northwind;Persist Security Info=True" providerName="System.Data.SqlClient" /&amp;gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/connectionStrings&amp;gt;&lt;br /&gt;...&lt;br /&gt;...&lt;br /&gt;&lt;br /&gt;Click on Next. &lt;br /&gt;&lt;br /&gt;In the next step, specify the column that you want to retrieve (see Figure 5). Click on Next when you're done.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAT6rmY2I/AAAAAAAAA94/Bn4za4DOueQ/s1600-h/11301.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAT6rmY2I/AAAAAAAAA94/Bn4za4DOueQ/s320/11301.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Construct the SQL Statements&lt;/i&gt;: Specify the column that you want to retrieve construct the SQL statements.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You can now test the SQL query that you have created in the previous step. Click on the Test Query button to execute the SQL query (see Figure 6). When done, click Finish.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S4TAUnRi1BI/AAAAAAAAA-A/LX4sn4M1Y7c/s1600-h/11302.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="240" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S4TAUnRi1BI/AAAAAAAAA-A/LX4sn4M1Y7c/s320/11302.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Test the Query&lt;/i&gt;: Click on the Test Query button to execute the SQL query.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Your SqlDataSource control is now configured. Switch to Source view to see the source of the SqlDataSource control. Note how the control references the connection string using the "&amp;lt;%$ %&amp;gt;" directive: &lt;br /&gt;&lt;br /&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource1" Runat="server" SelectCommand="SELECT [ProductID], [ProductName], [SupplierID], [CategoryID], [QuantityPerUnit], [UnitPrice] FROM [Alphabetical list of products]" ConnectionString="&amp;lt;%$ ConnectionStrings: NorthWindConn %&amp;gt;"&amp;gt;&lt;br /&gt;&amp;lt;/asp:SqlDataSource&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Configuring the GridView Control&lt;/b&gt;&lt;br /&gt;Having configured the SqlDataSource control, you can now drag-and-drop the GridView control to the page. In the Smart Tag, select SqlDataSource1 in the Choose Data Source dropdown list to bind the SqlDataSource control with the GridView control. &lt;br /&gt;&lt;br /&gt;You should also check the Enable Paging, Enable Sorting, and Enable Selection checkboxes (see Figure 7). Figure 7 shows how the GridView control looks after applying the Sand &amp;amp; Sky auto-format.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TAVMgyo3I/AAAAAAAAA-I/olGy0MCl8BE/s1600-h/11303.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="136" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TAVMgyo3I/AAAAAAAAA-I/olGy0MCl8BE/s320/11303.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;i&gt;Configuring the GridView Control&lt;/i&gt;: This is how the GridView control looks after applying the Sand &amp;amp; Sky auto-format.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Press F5 to load the page using the Web browser and you should see something similar to Figure 8.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAWVhgURI/AAAAAAAAA-Q/dubwWorLqQw/s1600-h/11304.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="190" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAWVhgURI/AAAAAAAAA-Q/dubwWorLqQw/s320/11304.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;i&gt;Testing the GridView Control&lt;/i&gt;: Press F5 to load the page using the Web browser.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br style="color: blue;" /&gt;&lt;span style="color: blue;"&gt;Editing and Deleting Rows in the GridView Control&lt;/span&gt;&lt;br /&gt;To make the data editable, switch to Source view and add two new attributes: UpdateCommand and DeleteCommand:&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource1" &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Runat="server" &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectCommand="SELECT [ProductID], [ProductName], [SupplierID], [CategoryID], &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [QuantityPerUnit], [UnitPrice] FROM [Alphabetical list of products]"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectionString="&amp;lt;%$ ConnectionStrings:NorthWindConn %&amp;gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateCommand="UPDATE Products SET ProductName = @ProductName, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SupplierID= @SupplierID, CategoryID =@CategoryID , QuantityPerUnit = @QuantityPerUnit , &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UnitPrice = CONVERT(money,@UnitPrice) WHERE ProductID=@ProductID"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DeleteCommand="DELETE FROM Products WHERE ProductID=@ProductID"&amp;gt;&lt;br /&gt;&amp;lt;/asp:SqlDataSource&amp;gt;&lt;br /&gt;&lt;br /&gt;The UpdateCommand and DeleteCommand attributes specify the SQL statements that execute when you perform an update or delete operation. &lt;br /&gt;&lt;br /&gt;After adding the two attributes, the Smart Tag for the GridView control gains two additional checkboxes—Enable Editing and Enable Deleting. Check the two additional options.&lt;br /&gt;&lt;br /&gt;Press F5 to test the page again. This time you will be able to make changes to the rows in the GridView control (see Figure 9).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAXCUZkoI/AAAAAAAAA-Y/6xFY1sEU2Qk/s1600-h/11305.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="175" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAXCUZkoI/AAAAAAAAA-Y/6xFY1sEU2Qk/s320/11305.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Editing a Row&lt;/i&gt;: After pressing F5, you'll be able to make changes to the rows in the GridView control.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;The DetailsView Control&lt;/b&gt;&lt;br /&gt;The DetailsView control is similar to the GridView control with one notable exception it displays one record at a time. To see how the DetailsView control works, drag-and-drop a DetailsView control onto the page. Bind it to SqlDataSource1 and check all the checkboxes shown in Figure 10.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAXkJzvuI/AAAAAAAAA-g/I9VEthxmtRA/s1600-h/11306.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="216" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S4TAXkJzvuI/AAAAAAAAA-g/I9VEthxmtRA/s320/11306.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;i&gt;Using the DetailsView Control&lt;/i&gt;: Bind the control to SqlDataSource1 and check all the checkboxes.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Press F5 to load the page. You will be able to browse through all the records as well as edit or delete them. &lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;Inserting a New Record&lt;/span&gt;&lt;br /&gt;You've seen how to display, edit, and delete records using the GridView and DetailsView controls. To let users add new records, simply modify the source view of the SqlDataSource control by adding the InsertCommand attribute: &lt;br /&gt;&lt;br /&gt;&amp;lt;asp:SqlDataSource ID="SqlDataSource1" &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Runat="server" &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SelectCommand="SELECT [ProductID], [ProductName], [SupplierID], [CategoryID], &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [QuantityPerUnit], [UnitPrice] FROM [Products]"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ConnectionString="&amp;lt;%$ ConnectionStrings:NorthWindConn %&amp;gt;"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; UpdateCommand="UPDATE Products SET ProductName = @ProductName, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; SupplierID= @SupplierID, CategoryID = @CategoryID , &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QuantityPerUnit = @QuantityPerUnit , UnitPrice = CONVERT(money,@UnitPrice) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WHERE (ProductID=@ProductID)"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DeleteCommand="DELETE FROM Products WHERE ProductID=@ProductID"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; InsertCommand="INSERT INTO Products (ProductName, SupplierID, CategoryID, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; QuantityPerUnit, UnitPrice) VALUES (@ProductName, @SupplierID, @CategoryID, &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; @QuantityPerUnit,CONVERT(money,@UnitPrice))"&amp;gt;&lt;br /&gt;&amp;lt;/asp:SqlDataSource&amp;gt;&lt;br /&gt;&lt;br /&gt;When this is done, the DetailsView control's Smart Tag will display the Enable Inserting checkbox. Check that checkbox to allow users to add a new record.&lt;br /&gt;&lt;br /&gt;Add a new record by clicking on the New link on the DetailsView control (see Figure 11).&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TAYYTZD4I/AAAAAAAAA-o/hDSPrVp6OjM/s1600-h/11307.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="155" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S4TAYYTZD4I/AAAAAAAAA-o/hDSPrVp6OjM/s320/11307.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;i&gt;Add a New Record&lt;/i&gt;: Add a new record by clicking on the New link on the DetailsView control.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Codeless Controls&lt;/b&gt;&lt;br /&gt;Using the new GridView and DetailsView controls in ASP.NET have not required you to write a single line of code. You simply configure the controls declaratively, and the controls perform most of the work for you.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://www.devx.com/dotnet/Article/22141/0/page/1"&gt;www.devx.com&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-3249918450563518420?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/3249918450563518420/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/gridview-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3249918450563518420'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3249918450563518420'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/gridview-in-aspnet.html' title='GridView in ASP.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S4TAQGnL6FI/AAAAAAAAA9Y/WB5QoExc5Bo/s72-c/11297.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-2219874381726011200</id><published>2010-02-19T16:49:00.000+05:30</published><updated>2010-02-19T16:49:46.194+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net 4.0 New Features'/><category scheme='http://www.blogger.com/atom/ns#' term='Dot Net Latest News'/><category scheme='http://www.blogger.com/atom/ns#' term='Net 4.0 New Features'/><category scheme='http://www.blogger.com/atom/ns#' term='4.0 New Features'/><category scheme='http://www.blogger.com/atom/ns#' term='New in Dot Net 4.0'/><category scheme='http://www.blogger.com/atom/ns#' term='Net Framework 4.0 What New'/><title type='text'>New Features in the .NET Framework 4</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Recently, Microsoft released the newer version of its IDE Visual Studio 2010 and .Net FX 4. The newer version of this framework includes the next version of ASP.Net, ASP.Net 4.0. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Adding MetaKeyword and MetaDescription Using Page object&lt;/b&gt;&lt;br /&gt;Meta keywords and description are most important components of a page when we want to make it search engine friendly. Every search engine will look for these tags to know more information of the page contents. ASP.Net 2.0 introduced a new feature where one can add these tags from the code behind using HtmlMeta class. It would have been better if we are able to do this through Page directive (Page class).&amp;nbsp; ASP.Net 4.0 added 2 new properties on the Page object to let you define the Meta keywords and Description.&lt;br /&gt;&lt;br /&gt;Refer the code below,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S35v-CoV6-I/AAAAAAAAA7I/IVIcwsTntuA/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="58" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S35v-CoV6-I/AAAAAAAAA7I/IVIcwsTntuA/s400/1.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;OR&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35wDgTBsGI/AAAAAAAAA7Q/mdpKDsCB8q4/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="37" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35wDgTBsGI/AAAAAAAAA7Q/mdpKDsCB8q4/s400/2.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The above code will add the meta tags in the output html.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;More Control on Controls ViewState&lt;/b&gt;&lt;br /&gt;ViewState is one of the important factors if we start looking at improving the performance our asp.net site.&amp;nbsp; Till ASP.Net 3.x, we have EnableViewState property both at Page level and server control level to control the view state. Disabling the ViewState at page level will disable the viewstate to all the page controls. In order to improve the performance, one need to switch off the viewstate for individual control for which saving the viewstate is not necessary and hence disabling viewstate at page level is not a suitable option.&amp;nbsp; To overcome this difficulty, asp.net 4.0 added a new property to Page object and controls called ViewStateMode.&lt;br /&gt;&lt;br /&gt;This property can take 3 values,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;1). Enabled&lt;/span&gt;&lt;br /&gt;This value will enable the view state. This is the default value for the Page object.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;2). Disabled&lt;/span&gt;&lt;br /&gt;This value will disable the viewstate&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;3). Inherit&lt;/span&gt;&lt;br /&gt;This value will make the control to inherit the setting of the parent. This is the default value for a control.&lt;br /&gt;&lt;br /&gt;With this property, we can disable the viewstate for the page and enable it for the control if only required.&lt;br /&gt;&lt;br /&gt;Consider the following code,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35wNDmX6HI/AAAAAAAAA7Y/BDhbiSnnP5c/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35wNDmX6HI/AAAAAAAAA7Y/BDhbiSnnP5c/s400/3.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;CodeBehind&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S35wSfnjltI/AAAAAAAAA7g/ygOkIsMAqPs/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="101" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S35wSfnjltI/AAAAAAAAA7g/ygOkIsMAqPs/s400/4.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When the page executed we will get the following output,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S35wYO_aROI/AAAAAAAAA7o/0sec_LLx9-8/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="25" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S35wYO_aROI/AAAAAAAAA7o/0sec_LLx9-8/s400/5.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When the button is clicked,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S35wcdX9dkI/AAAAAAAAA7w/-VfGlulS0aI/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="22" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S35wcdX9dkI/AAAAAAAAA7w/-VfGlulS0aI/s400/6.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Since, the viewstate is disabled at page level (Page object) and the viewstate is enabled for “Label1” we will get the above output on Button click. Please note that if we have not set the value, the default will be “inherit” (for Label2).&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ClientID Generation for ASP.Net Controls&lt;/b&gt;&lt;br /&gt;In order to access a server control from a client side script, a developer will require getting its client id. Predicting the ClientID of any control that is packed inside a parent like UserControls, MasterPage or any DataBound controls is a challenging task till day. For example, if we have 2 TextBox control inside a page that have an associated MasterPage then the ClientID will be similar to,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S35wkRgnkBI/AAAAAAAAA74/D4D2q_-TNHk/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="50" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S35wkRgnkBI/AAAAAAAAA74/D4D2q_-TNHk/s400/7.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;This is done to make the ID of the control unique in the page.&lt;br /&gt;&lt;br /&gt;In earlier versions for asp.net, we can register a server side hidden control which can hold the ClientID of the server control to access it from client side.&lt;br /&gt;&lt;br /&gt;ASP.Net 4.0 addresses this difficulty by providing a new property called ClientIDMode for every controls and Page object. We can also set the property in configuration files.&lt;br /&gt;&lt;br /&gt;This property will take the following 4 values,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;1). Static&lt;/span&gt;&lt;br /&gt;Setting this value will make the ClientID same as the ID. It will not concatenate ID of the parent naming containers.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;2). Predictable&lt;/span&gt;&lt;br /&gt;This will be useful to predict the ClientID of child controls in data controls. Setting this property will prevent the “ctlxxx” prefix in the ClientID. We will see more about this value later in this section.&lt;br /&gt;&lt;br style="color: blue;" /&gt;&lt;span style="color: blue;"&gt;3). Legacy&lt;/span&gt;&lt;br /&gt;This value will make the ClientID generation same as earlier versions of ASP.Net&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;4). Inherit&lt;/span&gt;&lt;br /&gt;This value will make the control to inherit the parent control’s setting. This is the default value for this property.&lt;br /&gt;&lt;br /&gt;For example,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S35xhaeYGWI/AAAAAAAAA8I/sTAgwdV8F4Q/s1600-h/8.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="36" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S35xhaeYGWI/AAAAAAAAA8I/sTAgwdV8F4Q/s400/8.bmp" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;This setting will make all the page controls to have ClientID same as ID. For example, if we have 2 Textbox control, the output will be similar to,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35w4z3YrRI/AAAAAAAAA8A/kdCQh_brmlM/s1600-h/8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="23" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35w4z3YrRI/AAAAAAAAA8A/kdCQh_brmlM/s400/8.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;To set this property in Web.Config file/Machine.config file,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S35xvqiGGPI/AAAAAAAAA8Q/lo27HrXOKhk/s1600-h/9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="16" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S35xvqiGGPI/AAAAAAAAA8Q/lo27HrXOKhk/s400/9.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The above setting should be inside &amp;lt;System.Web&amp;gt; section.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: blue;"&gt;Child Control’s ClientID in Data Control&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;For example, if we have child controls inside a ListView control the ClientID will be generated like below by default.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S35x4cnDXiI/AAAAAAAAA8Y/sMCpqknaR-c/s1600-h/10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="201" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S35x4cnDXiI/AAAAAAAAA8Y/sMCpqknaR-c/s400/10.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Because the ListView control has Label control to display data in each column of every row we have SPAN tag with ClientID’s generated.&lt;br /&gt;&lt;br /&gt;To make this ID’s predictable from clientside; we can set the ClientIDMode of the ListView control to "Predictable" and ClientIDRowSuffix to one or more number of the columns from the database.&amp;nbsp; Multiple column names should be a comma separated value. Please note that Repeater control will not support ClientIDRowSuffix property.&lt;br /&gt;&lt;br /&gt;Consider the below,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yAACbn6I/AAAAAAAAA8g/SZa7pJd4O-w/s1600-h/11.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="36" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yAACbn6I/AAAAAAAAA8g/SZa7pJd4O-w/s400/11.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The above setting will remove the prefix “ctlxx” and will append the value of the column specified in ClientIDRowSuffix. This will generate the ClientID’s like,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S35yGcTsdcI/AAAAAAAAA8o/u_rK5eArjbs/s1600-h/12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="187" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S35yGcTsdcI/AAAAAAAAA8o/u_rK5eArjbs/s400/12.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The above HTML is for single row. Next row will have the next employee’s name appended at the end.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ListView control Improvements&lt;/b&gt;&lt;br /&gt;ListView control is new databound control that is released in ASP.Net 3.5. To display data, we need to define 2 mandatory templates, LayoutTemplate and ItemTemplate. In ASP.Net 4.0 version, the LayoutTemplate is made optional and only defining ItemTemplate will display the data.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yTgldmAI/AAAAAAAAA8w/l8zqFECDlkU/s1600-h/13.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="305" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yTgldmAI/AAAAAAAAA8w/l8zqFECDlkU/s400/13.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Empty Website project and Cleaner Web.Config file&lt;/b&gt;&lt;br /&gt;Visual Studio 2010 includes a new project template to create empty ASP.Net 4.0 Web application project (Similar to Empty Website Template in older version).&amp;nbsp; These empty project templates will now include Web.Config file which is very clean and simple. Due to so many new additional features released, the web.config file is overloaded with information on handlers and modules (for asp.net ajax, etc). To maintain the Web.config easily, Visual Studio 2010 (from beta 2) includes only entries to identify the target framework used. Rest of the needed settings are moved to machine.config file.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Routing in Webforms&lt;/b&gt;&lt;br /&gt;Routing is a technique where asp.net webforms can be accessed with a friendly and descriptive URL’s.&amp;nbsp; Hence, the ugly URL’s with querystring can now be converted to a meaningful and descriptive which will be easy to remember and will improve the search engine rank. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;CSS Improvements&lt;/b&gt;&lt;br /&gt;The other major improvements in ASP.Net 4.0 are on the way the HTML rendered to the client browser. The rendered HTML will be complaint with latest HTML standards.&lt;br /&gt;&lt;br /&gt;Few things will be,&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;1). A new property called controlRenderingCompatibilityVersion is added to the Pages element of configuration files.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yi87wpaI/AAAAAAAAA84/fh-8bKlcuVs/s1600-h/14.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="12" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35yi87wpaI/AAAAAAAAA84/fh-8bKlcuVs/s400/14.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The value “3.5” indicates the controls are rendered in legacy ways. The value “4.0” indicates the control will be rendered with the latest improvements of 4.0 framework.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;2). Till 3.5 framework, setting “Enabled=false” for any control will render disabled attributes in the HTML for the control. According to the latest HTML standard the disabled attribute should be set only for INPUT tags. ASP.Net 4.0 addresses this issue by rendering disabled attribute to only INPUT tags and a CSS class called “aspNetDisabled” to other controls to disable it when controlRenderingCompatibilityVersion property is set to “4.0”.&lt;br /&gt;&lt;br /&gt;Below you can find a HTML rendered for a Label and TextBox control when controlRenderingCompatibilityVersion property is set to “4.0”.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35y0G77-1I/AAAAAAAAA9I/U3x6EyRyK-M/s1600-h/15.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="20" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35y0G77-1I/AAAAAAAAA9I/U3x6EyRyK-M/s400/15.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;3). From ASP.Net 2.0, the hidden fields generated for viewstate are packed inside a div tag for XHTML standard. This leads a small white space on the page. ASP.Net 4.0 now includes this div with a css class “aspNetHidden”. We can now define the class to prevent the white space by setting border to 0.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S35y7IsTcZI/AAAAAAAAA9Q/uzoyaS8T8HM/s1600-h/16.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="12" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S35y7IsTcZI/AAAAAAAAA9Q/uzoyaS8T8HM/s400/16.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;4). Menu controls render markup that is semantically correct and compliant with accessibility guidelines.&lt;br /&gt;&lt;br /&gt;5). Validation controls do not render inline styles.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;RabioButtonList and CheckboxList Changes&lt;/b&gt;&lt;br /&gt;From ASP.Net 4.0, the RadioButtonList and CheckBoxList controls includes 2 more value fro the property RepeatLayout.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;1). OrderedList&lt;/span&gt;&lt;br /&gt;The radiobutton/checkbox is rendered as li elements within an ol element.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: blue;"&gt;2). UnorderedList&lt;/span&gt;&lt;br /&gt;The radiobutton/checkbox is rendered as li elements within an ul element.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Improvements in Code Expressions&lt;/b&gt;&lt;br /&gt;There is a new code expression syntax that is being shipped with ASP.Net 4.0.&amp;nbsp; We commonly use the following syntax to output a value from aspx page called code expression.&lt;br /&gt;&amp;lt;%= HTMLOutput %&amp;gt;&lt;br /&gt;&lt;br /&gt;There is a new code expression releasing with ASP.Net 4.0 version that will html encode the value.&lt;br /&gt;&amp;lt;%: HTMLOutput %&amp;gt;&lt;br /&gt;&lt;br /&gt;The above code expression will output the value after doing html encode. i.e. the above expression is equivalent to &lt;br /&gt;&amp;lt;%= HttpUtility.HtmlEncode(HTMLOutput) %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Permanent Redirection with HTTP 301 Moved Permanently Response&lt;/b&gt;&lt;br /&gt;When we move our internet page to a different location, it is always required to send “HTTP 301 Moved Permanently” response to the search engines to hold back the page rank before redirecting to the new page. Understanding this need asp.net 4.0 includes a new method to do redirection called RedirectPermanent(). &lt;br /&gt;&lt;br /&gt;Refer below,&lt;br /&gt;Response.RedirectPermanent("new url")&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;This article series detailed on some of the enhancements the new framework brings for a webdeveloper.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://www.codedigest.com/Articles/ASPNET/285_New_Features_in_ASPNet_40-PART_1.aspx"&gt;www.codedigest.com&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-2219874381726011200?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/2219874381726011200/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/new-features-in-net-framework-4.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2219874381726011200'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2219874381726011200'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/new-features-in-net-framework-4.html' title='New Features in the .NET Framework 4'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S35v-CoV6-I/AAAAAAAAA7I/IVIcwsTntuA/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-4284304669450942448</id><published>2010-02-16T12:03:00.000+05:30</published><updated>2010-02-19T12:25:15.398+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Web Site Navigation in ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Menu Web Sitemap'/><category scheme='http://www.blogger.com/atom/ns#' term='Website Navigation with SiteMaps'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Site Navigation'/><category scheme='http://www.blogger.com/atom/ns#' term='Websites with Navigation'/><title type='text'>Website Navigation Using a SiteMap</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;The ASP.NET 2.0 infrastructure consisting of SiteMap, SiteMapDataSource and navigational controls. These pieces can help you to quickly put up an aesthetically pleasing web site.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;The SiteMap Class&lt;/b&gt;&lt;br /&gt;For web site navigation, ASP.NET 2.0 offers an infrastructure that provides site map information for web page development using navigational controls and SiteMapDataSource controls. The SiteMap class depends therefore on SiteMapProvider and XmlSiteMapProvider (default) classes. The navigation support infrastructure may use all of the following items:&lt;/span&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Provider classes&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Web.sitemap file (XML)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Navigational Controls&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;SiteMapPath control&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;SiteMap is a container of site information (folders and files) represented in an XML format that provides the root node of the site, the SiteMapProvider used, and tracks the provider objects. System.Web.SiteMap inherits from System.Object. The default provider XMLSiteMapProvider works through the Web.sitemap. Besides being useful for site navigation, the sitemap also provides a easy way for search engines to look for pages on the site.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Create the folder structure for the site&lt;/b&gt;&lt;br /&gt;Here is an example of a site with two folders, ColdFusion61 and MSAccess at the site http://localhost/Tutorials. This was the same site that was created in the tutorial for describing the concept of a Master page in VS2005. The unexpanded folder structure is shown in this picture.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o4x2q_VmI/AAAAAAAAA44/d-qj805S-6Y/s1600-h/sm01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="176" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o4x2q_VmI/AAAAAAAAA44/d-qj805S-6Y/s200/sm01.jpg" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The ColdFusionMX61 contains two web pages, Default.aspx and Coldfusion.aspx. The MSAccess folder contains three web pages, Ado.aspx, DAP.aspx, and Default.aspx. Besides these, each of the folders have their own images directory (now empty) to keep the images related to these folders. This detail is shown in the next picture.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o4ztmSgaI/AAAAAAAAA5A/HkEyYy2XKAY/s1600-h/sm02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o4ztmSgaI/AAAAAAAAA5A/HkEyYy2XKAY/s320/sm02.jpg" width="224" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Web Site Navigation Using a SiteMap - Adding a SiteMap to the site&lt;/b&gt;&lt;br /&gt;After highlighting the project, right click to access the drop-down menu. Click on Add New Item... which brings up the following window.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o40HldBZI/AAAAAAAAA5I/q-H425d2yoM/s1600-h/sm03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="270" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o40HldBZI/AAAAAAAAA5I/q-H425d2yoM/s400/sm03.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;When you highlight the SiteMap icon you will find Web.sitemap as the name of the file. If you click on the Add button this file will be added to your site as shown. Before clicking the Add button you may choose a name of your own, but do not change the extension. Extensions such as *.sitemap and *.config are protected by ASP.NET for security reasons.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o41EqysII/AAAAAAAAA5Q/Dnfkgk8_dLE/s1600-h/sm04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o41EqysII/AAAAAAAAA5Q/Dnfkgk8_dLE/s320/sm04.jpg" width="216" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Site structure is in an XML file&lt;/b&gt;&lt;br /&gt;Web.sitemap is an XML file with a special structure. It comes with a default template for a folder and a folder/file structure with three attributes, URL, Title, and Description as shown. In a rendered page these can be seen in the address bar, item's control name, and a tool-tip text showing the description.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o41l6oIXI/AAAAAAAAA5Y/vFHc8AGoz7k/s1600-h/sm05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="92" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o41l6oIXI/AAAAAAAAA5Y/vFHc8AGoz7k/s400/sm05.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Here &amp;lt;siteMap/&amp;gt; is the root and it has &amp;lt;siteMapNode/&amp;gt; children. These children represent the folder. These children also contain children which are the files in the folder. As shown here, the default that is added has three &amp;lt;siteMapNodes/&amp;gt; which can be used to represent one folder and two files in the folder.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o42QJeKvI/AAAAAAAAA5g/G2Jyk25nZx4/s1600-h/sm06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="77" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o42QJeKvI/AAAAAAAAA5g/G2Jyk25nZx4/s400/sm06.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The SiteMap XML file has been modified to reflect the folder structure shown earlier, as shown in the next picture. Only the structure of the ColdFusionMX61 folder has been partially implemented in this file. Also shown is the provision made for the MSAccess Folder to contain the files DAP.aspx and Ado.aspx. It must be remembered that all the ASPX files will be ContentHolder files. The title, URL and description values for both the ColdFusionMX61 folder and the file it contains have been added to the declaration. The comments should help in identifying these attributes.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o43FFvNAI/AAAAAAAAA5o/L_dT_2go9po/s1600-h/sm07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="282" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o43FFvNAI/AAAAAAAAA5o/L_dT_2go9po/s400/sm07.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Add the structure of the MSAccess folder along the same lines. Make use of intellisense at every step as shown. This will add to the correctness of the formatting.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o5K9x3VZI/AAAAAAAAA5w/Ckghra0cOvM/s1600-h/sm09.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="330" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o5K9x3VZI/AAAAAAAAA5w/Ckghra0cOvM/s400/sm09.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The completed Web.sitemap file is shown in the next paragraph.&lt;br /&gt;&lt;br /&gt;&amp;lt;?xml version="1.0" encoding="utf-8" ?&amp;gt;&lt;br /&gt;&amp;lt;siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" &amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;!--Home Page--&amp;gt; &amp;lt;siteMapNode url="~/Default.aspx" title="Home" description="Home Page"&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;!--ColdFusionMX61 Folder &amp;amp; Contents--&amp;gt; &lt;br /&gt;&amp;lt;--&amp;nbsp;&amp;nbsp; Folder&amp;nbsp;&amp;nbsp; --&amp;gt; &lt;br /&gt;&amp;lt;siteMapNode title="ColdFusionMX61" url="~/ColdFusionMX61/Default.aspx" Description="CFMX Tutorials"&amp;gt;&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&amp;lt;--&amp;nbsp; File&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; &lt;br /&gt;&amp;lt;siteMapNode url="~/ColdFusionMX61/Coldfusion.aspx" title="CFMX"&amp;nbsp; description="All tutorials on CFMX" /&amp;gt;&lt;br /&gt;&amp;lt;/siteMapNode&amp;gt; &lt;br /&gt;&lt;br /&gt;&amp;lt;!--MS Access Folder &amp;amp; Files--&amp;gt; &lt;br /&gt;&amp;lt;--&amp;nbsp;&amp;nbsp; Folder&amp;nbsp;&amp;nbsp; --&amp;gt; &lt;br /&gt;&amp;lt;siteMapNode title="MSAccess" url="~/MSAccess/Default.aspx" description="MS Access 2003 related"&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;--&amp;nbsp; Two Files&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; --&amp;gt; &lt;br /&gt;&amp;lt;siteMapNode title="ActiveXDataObjects" url="~/MSAccess/Ado.aspx" description="Using MS Access Application"/&amp;gt;&lt;br /&gt;&amp;lt;siteMapNode title="Data Access Pages" url="~/MSAccess/DAP.aspx" description="Enabling for the web"/&amp;gt;&lt;br /&gt;&amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;&amp;lt;/siteMapNode&amp;gt;&lt;br /&gt;&amp;lt;/siteMap&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Web Site Navigation Using a SiteMap - Site Navigation with Menu Control&lt;/b&gt;&lt;br /&gt;Site navigation as implemented in ASP.NET 2.0 uses the idea of providers to interact with the site structure data captured in the XML file Web.sitemap. The default provider that is provided reads the Web.sitemap file and creates a SiteMap object. The navigational controls that you will find in the toolbox use the sitemap object to implement the navigation. Instead of the default provider, a custom provider may also be used. This tutorial uses the built-in or default provider for site navigation.&lt;br /&gt;&lt;br /&gt;For navigational aids there are several options like drop-down, Treeview, and Menu which are not specific for navigation but are wired to the hierarchical structure of the site by means of the SiteMapDataSource control. On the other hand you may also use a SiteMapPath control which is specially programmed for site navigation.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o5Lq-fSVI/AAAAAAAAA54/tb3euUja2UI/s1600-h/sitemap.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="255" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o5Lq-fSVI/AAAAAAAAA54/tb3euUja2UI/s400/sitemap.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Web Site Navigation Using a SiteMap - Where should we place the menu control?&lt;/b&gt;&lt;br /&gt;Since the navigational menu should be available from all pages, the ideal place for the menu control is the Master Page. We need to add a SiteMapDataSource control which runs at the "Server" that extracts site structure related data that feeds a navigational control. We also need to add a navigational control which will look up this data source to navigate through the web pages. We will be adding two controls from the toolbox where they are shown in the next picture.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o5MX8RysI/AAAAAAAAA6A/5Bq6v6KN6vw/s1600-h/sm10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="320" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S3o5MX8RysI/AAAAAAAAA6A/5Bq6v6KN6vw/s320/sm10.jpg" width="218" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You may drag and drop them onto the locations shown on the MasterPage.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o5NESAVqI/AAAAAAAAA6I/jo-pVy_UgPk/s1600-h/sm11.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="297" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o5NESAVqI/AAAAAAAAA6I/jo-pVy_UgPk/s400/sm11.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The design view of this page is shown in the next picture.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o5TTB_6TI/AAAAAAAAA6Q/hUnoYrxlttI/s1600-h/sm12.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S3o5TTB_6TI/AAAAAAAAA6Q/hUnoYrxlttI/s400/sm12.jpg" width="340" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The menu control has a large number of properties, both static and dynamic, as well as for interactive display. However its DataSourceID property should match with the SitaMapDataSource's ID Property as shown in the next picture.&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:Menu ID="Menu1" &lt;br /&gt;runat="server" &lt;br /&gt;DataSourceID="SiteMapDataSource1"&amp;nbsp; Height="277px" &lt;br /&gt;BackColor="#FFFBD6" &lt;br /&gt;DynamicHorizontalOffset="2" &lt;br /&gt;Font-Names="Verdana" &lt;br /&gt;Font-Size="0.4em" &lt;br /&gt;ForeColor="#990000" &lt;br /&gt;StaticSubMenuIndent="10px"&amp;gt;&lt;br /&gt;&amp;lt;StaticMenuItemStyle HorizontalPadding="5px" VerticalPadding="2px" Font-Size="Small" /&amp;gt;&lt;br /&gt;&amp;lt;DynamicHoverStyle BackColor="#990000" ForeColor="White" /&amp;gt;&lt;br /&gt;&amp;lt;DynamicMenuStyle BackColor="#FFFBD6" /&amp;gt;&lt;br /&gt;&amp;lt;StaticSelectedStyle BackColor="#FFCC66" /&amp;gt;&lt;br /&gt;&amp;lt;DynamicSelectedStyle BackColor="#FFCC66" /&amp;gt;&lt;br /&gt;&amp;lt;DynamicMenuItemStyle Font-Size="Medium" HorizontalPadding="5px" VerticalPadding="2px" /&amp;gt;&lt;br /&gt;&amp;lt;StaticHoverStyle BackColor="#990000" ForeColor="Maroon" Font-Size="Medium" /&amp;gt;&lt;br /&gt;&amp;lt;StaticMenuStyle BackColor="#FFFFC0" BorderColor="#C0C000" /&amp;gt;&lt;br /&gt;&amp;lt;/asp:Menu&amp;gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;asp:SiteMapDataSource ID="SiteMapDataSource1"&amp;nbsp; runat="server" /&amp;gt;&lt;br /&gt;&lt;br /&gt;With this association between the menu control and the SiteMapDataSource, the site navigation can be immediately verified as shown in the following two displays. This picture shows the page Coldfusion.aspx. When you hover over the menu you can see the various pages to which you can navigate using this menu. The placement of the menu control and its look may not be aesthetically pleasing, but the idea is to demonstrate the functionality of navigation.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o5Ua0Il8I/AAAAAAAAA6Y/MUXKuujVKpM/s1600-h/sm13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S3o5Ua0Il8I/AAAAAAAAA6Y/MUXKuujVKpM/s400/sm13.jpg" width="293" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You may navigate to another page, such as Ado.aspx, and you will see the following display in your browser.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o5VDj3VEI/AAAAAAAAA6g/qbo6b6WxjQ4/s1600-h/sm14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S3o5VDj3VEI/AAAAAAAAA6g/qbo6b6WxjQ4/s400/sm14.jpg" width="328" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;Site navigation is extremly easy to implement using the ASP.NET 2.0 infrastructure consisting of SiteMap, SiteMapDataSource and navigational controls. This can be very useful for those interested in getting an aesthetically pleasing web site up and running in record time. For those of you who used the Site Diagram, the Site Designer and the Navigation Bar controls in Visual InterDev, the functionality provided with in .NET Framework for site navigation should be a Godsend. It must be remembered that site pages not included in the Web.sitemap cannot be reached by the navigation controls unless you take other measures.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://www.aspfree.com/c/a/.NET/Web-Site-Navigation-Using-a-SiteMap/"&gt;www.aspfree.com&lt;/a&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-4284304669450942448?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/4284304669450942448/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/web-site-navigation-using-sitemap.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4284304669450942448'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4284304669450942448'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/web-site-navigation-using-sitemap.html' title='Website Navigation Using a SiteMap'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/S3o4x2q_VmI/AAAAAAAAA44/d-qj805S-6Y/s72-c/sm01.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-7511157965442221529</id><published>2010-02-03T16:11:00.000+05:30</published><updated>2010-02-03T16:21:50.368+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Globalization and Localization C#'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET Globalization and Localization'/><category scheme='http://www.blogger.com/atom/ns#' term='Example Globalization and localization'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET Globalization Culture'/><category scheme='http://www.blogger.com/atom/ns#' term='Globalization and Localization Overview'/><title type='text'>Globalization and localization in ASP.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Introduction of Globalization and localization&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Applications must be designed to accommodate users from various cultures. Users in different parts of the world use different languages and different formatting standards for numbers, currency, and dates. International applications should be customizable according to the preferences of users belonging to different nations, cultures, or regions.&lt;br /&gt;&lt;br /&gt;An application uses the locale to identify the preference of a user. The local is the combination of a language and a country. For example, the locale of a user speaking English and belonging to the United States is "en-US". The locale includes information about the formats used for representing time and date, symbols and conventions used for representing currency, and the character encoding scheme being used.&lt;br /&gt;&lt;br /&gt;The structure of an internationalized application is divided into two blocks:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Code Block :&lt;/i&gt; Contains the application code or the executable part of an application. This block will remain the same for all locales.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Data Block :&lt;/i&gt; Contains all the resources, such as text and images used by the user interface (UI). This block is locale-specific, and each locale will have one data block.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The process of making&amp;nbsp; an application ready for customers is called internationalization. It includes three phases:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Globalization :&lt;/i&gt; Involves writing the executable code for an application in such a way that makes it culture-neutral and language-neutral. While incorporating globalization, you must ensure that the culture-specific details are not hard-coded into the executable code. The primary task in this phase is to identify the various locale-sensitive resources and to isolate these resources from the executable code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Localizability :&lt;/i&gt; An application that has been globalized must be tested to ensure that its executable code is independent of the culture and language-specific data. This is called localizability testing. The focus of localizability testing is to check how the application adapts itself to different locales.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Localization :&lt;/i&gt; Involves the customization of an application for a specific locale. One major task in this phase is the translation of resources identified during the globalization phase. During this phase, various resources, such as images and text, for the designated locale are created.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When designing an international application, you should ensure the following factors:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;User Interface (UI) :&lt;/i&gt; The language used to design different UI components, such as menu, message box, static-text holder (label), is not fixed during design phase of the application.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Information Formats :&lt;/i&gt; The formats of different elements, such as currency, number, and date, are not fixed during design phase of the application.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The different aspects of an application that should be taken into account while incorporating localization are:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Formats :&lt;/i&gt; The formats used for displaying numbers, time, dates and currency should be considered while incorporating localization.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Graphics :&lt;/i&gt; The locale-sensitive graphics, such as maps, traffic signs, and calendar should be considered while incorporating localization.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Implementing Globalization&lt;/b&gt;&lt;br /&gt;The &lt;i&gt;System.Globalization&lt;/i&gt; namespace provides different classes that enable you to determine locale-specific information, such as te language and country of an application at run time. The System.Globalization namespace includes classes that enable you to localize your application. For example, the Calendar class contains different calendars, such as JulianCalendar and GrgorianCalendar.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Using the CultureInfo Class&lt;/b&gt;&lt;br /&gt;Every locale is identified by a culture. The general format of the culture is as follows:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Language code :&lt;/i&gt; Represents a two-letter representation of a language. It is always written in lowercase. For example, the language code for Arabic is "ar" and that for Russian is "ru".&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Country/Region code :&lt;/i&gt; Represents a two-letter representation of a country or a region. It is always written in uppercase. For example, the country code for Russia is "RU" and that for France is "FR".&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Cultures are of two types:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Neutral culture :&lt;/i&gt; Signifies a culture that is linked only to a language and not to a country. For example, "ru" is a neutral code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Specific culture :&lt;/i&gt; Signifies a culture that is linked to both a country and a language. For example, "ru-RU" is a specific code.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here describes some of the commonly used properties of the CultureInfo class:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;CurrentCulture&lt;/i&gt; - Returns an instance of the CultureInfo class that represents the culture for the current thread&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;CurrentUICulture&lt;/i&gt; - Returns an instance of CultureInfo class that represents the culture for culture-specific resources.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;DisplayName&lt;/i&gt; - Returns the name of the culture in format: &amp;lt;Language code&amp;gt;-&amp;lt;country/region code&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;EnglishName&lt;/i&gt; - Returns the English name of the culture in f&amp;lt;Language code&amp;gt;-&amp;lt;country/region code&amp;gt; format&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Name&lt;/i&gt; - Returns the name of the culture in &amp;lt;Language code&amp;gt;-&amp;lt;country/region code&amp;gt; format&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;LCID&lt;/i&gt; - Returns the culture identifier for the instance of the CultureInfo class. Every culture has an identifier. For e.g., 0x0407 is the identifier for "de-DE" culture&lt;br /&gt;&lt;br /&gt;The following table describes some of the commonly used methods of the CultureInfo class:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;GetCultures&lt;/i&gt; - Returns a list of supported cultures.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;GetFormat&lt;/i&gt; - Returns an object that represents the format of a specified type. For e.g., this method will return an object representing the format of the date when the specified type is date/time.&lt;br /&gt;&lt;br /&gt;The following code snippet shows how to use the CultureInfo class:&lt;br /&gt;&lt;br /&gt;CultureInfo my_CI = new CultureInfo ("ru-RU");&lt;br /&gt;&lt;br /&gt;In the preceding code snippet, a new CultureInfo class instance by the name, my_CI, is created that sets the culture of the instance to "ru-RU".&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Working with Resources&lt;/b&gt;&lt;br /&gt;A resource is any non-executable data that is logically deployed with an application. A resource might be displayed in an application as an error message or as a part of the UI. Examples of resources include the strings displayed in the UI based on the culture settings of the system or a set of images. A separate resource file should be created for each culture for which the application is to be customized. Information is stored in a resource file in the key/value format. For example, to store the welcome message you must assign a the message to a key. Like this:&lt;br /&gt;&lt;br /&gt;WelcomeText = "Welcome to my homepage";&lt;br /&gt;&lt;br /&gt;In the preceding code snippet, WelcomeText is the key and "Welcome to my homepage" is the value. There are specific naming conventions to follow when naming resource files. The resource file for default culture should be Strings.txt or Strings.ResX, and for any other culture Strings.culture-name.ResX. Where Strings represents the name of the file. For e.g., Strings.fr-CA.resx. After resource files are created in the text form, they need to be converted into a binary format recognized by the .NET Framework.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Generating Resource File&lt;/b&gt;&lt;br /&gt;You can use the Resource File Generator (ResGen.exe) command prompt utility to convert a resource file in the text format into the binary format. The syntax is as follows:&lt;br /&gt;&lt;br /&gt;resgen [/compile] [inputfilename.extension] [outputfilename.extension]&lt;br /&gt;&lt;br /&gt;The extension of the input filename will be .resource.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Creating Resource-Only Assemblies&lt;/b&gt;&lt;br /&gt;To create a resource-only assembly, perform the following steps:&lt;/span&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Create a new Visual C# project with the Empty Project template.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;From the Project menu, select the Add Existing Item option to add the resources files to the project.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;In Solution Explorer, right-click your project and select the Properties option. The property page opens.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;In the Output Type drop-down menu, change the output type of your project to class Library. This will cause your assembly to be compiled as a .dll file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Build you application.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The output will be a DLL file, which will contain all the resource files you added.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Creating Satellite Assemblies&lt;/b&gt;&lt;br /&gt;Satellite assemblies are resource-only assemblies that contain only culture-specific resources. The name of the resources included in a satellite assembly should follow this naming convention:&lt;br /&gt;&lt;br /&gt;Filename.culture-subculture.resource&lt;br /&gt;The name of a resource file included within a satellite assembly should reflect the culture to which it belongs. All applications will contain one culture-neutral main assembly, which will be loaded by default when a request is sent to the application. The relationship between the main assembly and the satellite assembly under the Windows platform follows a hub-and-spoke model. When a Web application is deployed, the main assembly is always copied in the bin folder in the application root. Satellite assemblies are copied into the subfolders beneath the bin folder in the application root. Satellite assemblies are copied into the subfolders beneath the bin folder based on their culture. For example, the satellite assembly for the culture, fr, will be copied into the bin\fr folder and that for the culture, fr-CA, will be copied into the bin\fr\CA folder.&lt;br /&gt;&lt;br /&gt;Perform the following steps to create a satellite assembly:&lt;/span&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Open the Web application to which you need to add resource files.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;From the project menu, select the Add existing Item option to add the resource files to your application. Resource files should be named according to the naming conventions.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;From the Build menu, select the Build solution option to build your solution.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Culture-specific resource files are automatically compiled into satellite assemblies and placed in an appropriate directory structure.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The difference between resource-only and satellite assemblies is that resource-only assemblies can contain any resource, such as images and text. Satellite assemblies contain only culture-specific resources.&lt;br /&gt;&lt;br /&gt;You can also use the AL.exe utility to link resource files to your application. The AL (Assembly Linker) is a command prompt utility shipped with the standard version of Visual Studio .NET.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Retrieving Resources at Run Time&lt;/b&gt;&lt;br /&gt;The System.Resources namespace provides different classes, which enable you to retrieve values from resource files. This namespace contains the ResourceManager class which manages all the resources associated with an application.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;ResourceManager Class&lt;/i&gt;&lt;br /&gt;It can be used to retrieve resources from an assembly. Each instance of the ResourceManager class is associated with an assembly that contains the resources. This class provides different constructors that can be used according to the need. For example, when you need to retrieve resources from an assembly, use the ResourceManager constructor, which has the following syntax:&lt;br /&gt;&lt;br /&gt;ResourceManager ( "BaseName" , "Assembly Name", Type)&lt;br /&gt;&lt;br /&gt;In the preceding syntax:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;BaseName :&lt;/i&gt; Represents the root name of the resource.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Assembly Name :&lt;/i&gt; Represents the name of the assembly, which contains the resource.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Type :&lt;/i&gt; Represents the ResourceSet, which is the set of resources for a specific culture. The resources associated with each culture have a ResourceSet associated with them.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;If the resources are stored in a folder instead of an assembly, you can use the &lt;i&gt;FileBasedResourceManager&lt;/i&gt; function of the ResourceManager class. This function takes the following three parameters:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;BaseName :&lt;/i&gt; Represents the root of the resource&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;ResourceDir :&lt;/i&gt; Represents the folder in which the resource is to be searched.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;Type :&lt;/i&gt; Represents the ResourceSet.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The other important classes in the System.Resources namespace are:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;ResourceWriter :&lt;/i&gt; Used to write into a resource file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;ResourceReader :&lt;/i&gt; Used to read form a resource file.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Configuring a Web application for Globalization&lt;/b&gt;&lt;br /&gt;In ASP.NET, you can use the Web.config file to configure an application for globalization. The &amp;lt;globalization&amp;gt; tag enables you to configure locale-specific information, such as culture and encoding. The &amp;lt;globalization&amp;gt; tag has the following attributes:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;requestEncoding :&lt;/i&gt; Allows you to specify the assumed encoding of incoming requests. The default value of this attribute is utf-8.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;responseEncoding :&lt;/i&gt; Allows you to specify the encoding used for the response data. The default value is utf-8.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;fileEncoding :&lt;/i&gt; Allows you to specify the way in which the .aspx, .asmx, .asax files are encoded in a Web application. The default value is utf-8.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;culture :&lt;/i&gt; Allows you to specify the culture.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;i&gt;uiCulture :&lt;/i&gt; Allows you to specify the UI culture.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The following code snippet shows an example of how to use the &amp;lt;globalization&amp;gt; tag to configure a Web application:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&amp;lt;globalization&lt;br /&gt;requestEncoding="utf-8"&lt;br /&gt;responseEncoding="utf-8"&lt;br /&gt;culture="ru-RU"&lt;br /&gt;uiculture="ru-RU" /&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Example&lt;/b&gt;&lt;br /&gt;Here we will be creating an ASP.NET application that is locale-aware. For simplicity sake we our only creating it for 2 cultures, although its just the repetition of steps that would be required if you wish to implement using more cultures.&lt;br /&gt;&lt;br /&gt;Our application will have an user interface with a drop down list from where the user can select the culture of his choice and then the Text values of the controls would be as per the selected culture.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Solution:&lt;/i&gt;&lt;br /&gt;Perform the following steps for the same:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Create a new Web application and I have named it "globalization" as per this example.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Change the name of the Webform1.aspx to culture.aspx.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Design the culture form. Drag two label controls, a dropdownlist and a button.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Create two resource Files. For this right-click the project file and select the Add-&amp;gt;New folder. Rename this folder as Resources.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Now add new items to this project, select resource assembly file from the template pane. Rename it as strings.resx.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;In the name column write "msg" and in the value column write "Welcome to my homepage", in this strings.resx file. Save this file and close it.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Drag this file to the "Resources" folder from the solution explorer.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Similarly add another .resx file, remember to use the culture convention of renaming it. We will be renaming it for France culture so, the it would be renamed as "strings.fr-FR.resx".&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Now we need to generate strings.Resources file and strings.fr-FR.resources file.For this go to the command prompt of Visual Studio .NET (go to start-&amp;gt;all programs-&amp;gt;Microsoft Visual Studio .net 2003-&amp;gt;Visual Studio .net tools-&amp;gt;Microsoft Visual Studio .net command prompt)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Type the following command there:&amp;nbsp; resgen strings.resx&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;You will need to navigate to the "Resources" folder using " cd " command of DOS, since you have this .resx file in Resources folder.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Do this for all your .resx files and their respective .resources files would be generated, as shown in the figure below:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;/ol&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2lQkK0W3dI/AAAAAAAAA4Y/cR1jtz5Rrf0/s1600-h/Globalization-Localization-Resource.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="226" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2lQkK0W3dI/AAAAAAAAA4Y/cR1jtz5Rrf0/s400/Globalization-Localization-Resource.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;You can see these files in your Resources folder of your application as shown in the figure.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S2lQ-EPh3yI/AAAAAAAAA4g/82jyQ5AsD5E/s1600-h/Globalization-Localization-Strings.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="327" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S2lQ-EPh3yI/AAAAAAAAA4g/82jyQ5AsD5E/s400/Globalization-Localization-Strings.jpg" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The main code performing this functionality is given below.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt; &lt;br /&gt;private void Page_Load(object sender, System.EventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;System.Resources.ResourceManager rm =ResourceManager.CreateFileBasedResourceManager( "strings", Server.MapPath("Resources")+Path.DirectorySeparatorChar , null);&lt;br /&gt;string a = Session["lang"].ToString ();&lt;br /&gt;CultureInfo cinfo=new CultureInfo(a);&lt;br /&gt;lblmsg.Text=rm.GetString ("msg",cinfo);&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Here Session["lang"] is assigned the value of the selected item form the drop down list, that contains the available cultures for the site.&lt;br /&gt;&lt;br /&gt;The first output screen looks like this:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2lRX3RxmoI/AAAAAAAAA4o/QHDZdte7J04/s1600-h/Globalization-Localization-Select-Culture.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="197" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2lRX3RxmoI/AAAAAAAAA4o/QHDZdte7J04/s400/Globalization-Localization-Select-Culture.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When you select any culture, the message is displayed in that particular culture as provided by you in the .resx files.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2lRhlRkVoI/AAAAAAAAA4w/vc175ZavAAs/s1600-h/Globalization-Localization-Language.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="195" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2lRhlRkVoI/AAAAAAAAA4w/vc175ZavAAs/s400/Globalization-Localization-Language.gif" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;I have tried to cover some important aspects of implementing Globalization in ASP.NET 2.0. I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: x-small;"&gt;Source : &lt;a href="http://www.beansoftware.com/ASP.NET-Tutorials/Globalization-Localization.aspx"&gt;www.beansoftware.com&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-7511157965442221529?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/7511157965442221529/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/globalization-and-localization-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7511157965442221529'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7511157965442221529'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/globalization-and-localization-in.html' title='Globalization and localization in ASP.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S2lQkK0W3dI/AAAAAAAAA4Y/cR1jtz5Rrf0/s72-c/Globalization-Localization-Resource.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-2520466025802041452</id><published>2010-02-02T14:34:00.000+05:30</published><updated>2010-02-02T15:15:33.969+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Handlers ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net Generic Handler'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Modules'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Modules in ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET Handler Session'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Handlers'/><category scheme='http://www.blogger.com/atom/ns#' term='HTTP Handlers and HTTP Modules in ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net Handler'/><title type='text'>HTTP Handlers and HTTP Modules in ASP.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Introduction&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Web servers serve resources that have been put on the Internet and provide other services like security, logging, etc. At the beginning of the Internet era, client's needs were very limited; .htm files were often satisfactory. As time passed, however, client's requirements extended beyond the functionality contained in .htm files or static files.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Developers needed a way to extend or complement the functionality of Web servers. Web server vendors devised different solutions, but they all followed a common theme. All Web server complement technologies allowed developers to create and plug in components for enhancing Web server functionality. Microsoft came up with ISAPI (Internet Service Application Programming Interface).&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;ISAPI is an important technology that allows us to enhance the capabilities of an ISAPI-compliant Web server (IIS is an ISAPI-compliant Web server). The following components serve this purpose:&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;ISAPI Extensions&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;ISAPI Filters &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;ISAPI extensions are implemented by using Win32 DLLs. You can think of an ISAPI extension as a normal application. ISAPI extensions are the target of http requests. That means you must call them to activate them.&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;ISAPI filter as just that: a filter. It sits between your Web server and the client. Every time a client makes a request to the server, it passes through the filter. Clients do not specifically target the filter in their requests, rather, clients simply send requests to the Web server, and then the Web server passes that request to the interested filters. Filters can then modify the request, perform some logging operations, etc. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;ASP.NET Request Processing&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;ASP.NET request processing is based on a pipeline model in which ASP.NET passes http requests to all the modules in the pipeline. Each module receives the http request and has full control over it. The module can play with the request in any way it sees fit. Once the request passes through all of the HTTP modules, it is eventually served by an HTTP handler. The HTTP handler performs some processing on it, and the result again passes through the HTTP modules in the pipeline.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The following figure describes this flow.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fg_ORWegI/AAAAAAAAA14/PMrV86WOBng/s1600-h/020417_01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fg_ORWegI/AAAAAAAAA14/PMrV86WOBng/s400/020417_01.jpg" width="287" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;During the processing of an http request, only one HTTP handler will be called, whereas more than one HTTP modules can be called. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Http Handlers&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;HTTP handlers are the .NET components that implement the System.Web.IHttpHandler interface. Any class that implements the IHttpHandler interface can act as a target for the incoming HTTP requests. HTTP handlers are somewhat similar to ISAPI extensions. One difference between HTTP handlers and ISAPI extensions is that HTTP handlers can be called directly by using their file name in the URL, similar to ISAPI extensions. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;span id="konasapn0"&gt;&lt;span class="clsBlurb"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span id="konasapn0"&gt;&lt;span class="clsBlurb"&gt;&lt;b&gt; &lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;These classes can be mapped to http requests by using the web.config or machine.config file. Once that is done, ASP.NET will instantiate http handler whenever the corresponding request comes in. ASP.NET also supports the creation of http handlers by means of the IHttpHandlerFactory interface. ASP.NET provides the capability of routing http requests to an object of the class that implements the IHttpHandlerFactory interface.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Registering HTTP Handlers in Configuration Files&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;ASP.NET maintains its configuration information in the following configuration files:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;machine.config&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;web.config &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;machine.config file contains the configuration settings that apply to all the Web applications installed on that box.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;web.config file is specific to each Web application. Each Web application can have its own web.config file. Any sub directory of a Web application may have its own web.config file; this allows them to override the settings imposed by the parent directories.&lt;httphandlers&gt;&lt;add&gt;&lt;add&gt;Here is a generic example of adding an HTTP handler:&lt;/add&gt;&lt;/add&gt;&lt;/httphandlers&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fvHdxwO2I/AAAAAAAAA2w/Bkje4rXmqpc/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="37" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fvHdxwO2I/AAAAAAAAA2w/Bkje4rXmqpc/s400/1.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;httphandlers&gt;&lt;add&gt;&lt;add&gt; &lt;/add&gt;&lt;/add&gt;&lt;/httphandlers&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In the above XML,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The verb attribute specifies the HTTP verbs supported by the handler. If the handler supports all of the HTTP verbs, simply use "*", otherwise list the supported verbs in a comma separated list. So if your handler supports only HTTP GET and POST, then verb attribute will be "GET, POST".&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The path attribute specifies the path or wildcard specification of the files for which this handler will be invoked. For example, if you want your handler to be called only when test.xyz file is requested, then the path attribute will contain "test.xyz"; similarly if you want your handler called for any file having .xyz extension, the path attribute will contain "*.xyz".&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The type attribute specifies the actual type of the handler or handler factory in the form of a combination of namespace, class name and assembly name. ASP.NET runtime first searches the assembly DLL in the application's bin directory and then searches in the Global Assembly Cache (GAC).&amp;nbsp; &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: blue;"&gt;Use of HTTP Handlers by the ASP.NET Runtime&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Believe it or not, ASP.NET uses HTTP handlers for implementing a lot of its own functionality. ASP.NET uses handlers for processing .aspx, .asmx, .soap and other ASP.NET files.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The following is the snippet from the machine.config file:&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fvdmi4N0I/AAAAAAAAA24/zonATzmsQsU/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="210" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fvdmi4N0I/AAAAAAAAA24/zonATzmsQsU/s400/2.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt; &lt;i style="color: blue;"&gt;&amp;nbsp;&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: blue;"&gt;Implementing HTTP Handlers&lt;/i&gt;&lt;br /&gt;Steps involved in implementing our HTTP handler are as follows:&lt;/span&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Write a class which implements IHttpHandler interface&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Register this handler in web.config or machine.config file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Map the file extension(.htm) to ASP.NET ISAPI extension DLL (aspnet_isapi.dll) in Internet Services Manager. &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: #cc0000;"&gt;Step1&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Create a new C# Class Library project in Visual Studio.NET and name it "MyHandler". Visual Studio.NET will automatically add a class named "Class1.cs" into the project. Rename it "NewHandler"; open this class in the code window and change the class name and constructor name to "NewHandler".&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The following is the code for the NewHandler class.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fvuTwmvJI/AAAAAAAAA3A/H_PKsXzXAw4/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fvuTwmvJI/AAAAAAAAA3A/H_PKsXzXAw4/s400/3.JPG" width="351" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Let's compile it and place it in the bin directory of the webapp virtual directory. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: #cc0000;"&gt;Step 2&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Register this handler by adding the following text in the web.config file:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fv4nHru1I/AAAAAAAAA3I/8I_6HHz92IU/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="51" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fv4nHru1I/AAAAAAAAA3I/8I_6HHz92IU/s400/4.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;add path="*.htm" type="MyHandler.NewHandler,MyHandler" verb="*"&gt;&lt;/add&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: #cc0000;"&gt;Step 3&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Since we are creating a handler for handling files of a new extension, we also need to tell IIS about this extension and map it to ASP.NET. If we don't perform this step and try to access the Hello.htm file, IIS will simply return the file rather than pass it to ASP.NET runtime. As a consequence, the HTTP handler will not be called. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Launch the Internet Services Manager tool, right click on Default Web Site, select Properties, go to Home Directory tab and press Configuration button. This will popup Application Configuration dialog. Click Add button and fill the Executable field with the path to the aspnet_isapi.dll file and fill .htm in the Extension field. Leave the other fields as is; the dialog box should look as follows:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fh1vDTbeI/AAAAAAAAA2A/WdATHJFYieE/s1600-h/020417_02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="227" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fh1vDTbeI/AAAAAAAAA2A/WdATHJFYieE/s400/020417_02.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Close the Application Configuration and Default Web Site Properties dialog boxes by pressing the OK button.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now we are good to go. Launch Internet Explorer and go to the following url:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;http://localhost/webapp/hello.htm&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;You should see the following page:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fjGprAFJI/AAAAAAAAA2I/oAXzJYXyYwk/s1600-h/020417_03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="118" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fjGprAFJI/AAAAAAAAA2I/oAXzJYXyYwk/s400/020417_03.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: blue;"&gt;Session State in HTTP Handlers&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Maintaining session state is one of the most common tasks that Web applications perform. HTTP handlers also need to have access to the session state. But session state is not enabled by default for HTTP handlers. In order to read and/or write session data, HTTP handlers are required to implement one of the following interfaces:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;IRequiresSessionState&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;IReadOnlySessionState. &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;An HTTP handler should implement the IRequiresSessionState interface when it requires read-write access to the session data. If a handler only needs read access to session data, then it should only implement the IReadOnlySessionState interface.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Both of these interfaces are just marker interfaces and do not contain any methods. So if we want to enable session state for our NewHandler handler, then declare the NewHandler class as followed:&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;public class NewHandler : IHttpHandler, IRequiresSessionState&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;HTTP Modules&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;HTTP modules are .NET components that implement the System.Web.IHttpModule interface. These components plug themselves into the ASP.NET request processing pipeline by registering themselves for certain events. Whenever those events occur, ASP.NET invokes the interested HTTP modules so that the modules can play with the request.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;There are four more events that we can use. These events are as follows:&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Application_OnStart : This event is raised when the very first request arrives to the Web application.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Application_OnEnd : This event is raised just before the application is going to terminate.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Session_OnStart : This event is raised for the very first request of the user's session.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Session_OnEnd : This event is raised when the session is abandoned or expired. &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: blue;"&gt;Registering HTTP Modules in Configuration Files&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Once an HTTP module is built and copied into the bin directory of our Web application or copied into the Global Assembly Cache, then we will register it in either the web.config or machine.config file.&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Since configuration settings are inheritable, the child directories inherit configuration settings of the parent directory. As a consequence, child directories might inherit some unwanted HTTP modules as part of the parent configuration; therefore, we need a way to remove those unwanted modules. We can use the &lt;i&gt;remove&lt;/i&gt; &lt;remove&gt; node for this.&lt;/remove&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;If we want to remove all of the inherited HTTP modules from our application, we can use the &lt;clear&gt; &lt;i&gt;clear&lt;/i&gt; node. &lt;/clear&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;The following is a generic example of adding an HTTP module:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fwiyfg1CI/AAAAAAAAA3Q/nusPLvz2nbU/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="55" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fwiyfg1CI/AAAAAAAAA3Q/nusPLvz2nbU/s400/5.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The following is a generic example of removing an HTTP module from your application.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fwrMy0bvI/AAAAAAAAA3Y/4qQ9FfDldQk/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="68" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fwrMy0bvI/AAAAAAAAA3Y/4qQ9FfDldQk/s320/6.JPG" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;In the above XML,&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The type attribute specifies the actual type of the HTTP module in the form of class and assembly name.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The name attribute specifies the friendly name for the module. This is the name that will be used by other applications for identifying the HTTP module. &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;i style="color: blue;"&gt;Use of HTTP Modules by the ASP.NET Runtime&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;ASP.NET runtime uses HTTP modules for implementing some special features. The following snippet from the machine.config file shows the HTTP modules installed by the ASP.NET runtime.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fw4cSHbfI/AAAAAAAAA3g/opv8LHmzloo/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="202" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fw4cSHbfI/AAAAAAAAA3g/opv8LHmzloo/s400/7.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;All of the above HTTP modules are used by ASP.NET to provide services like authentication and authorization, session management and output caching. Since these modules have been registered in machine.config file, these modules are automatically available to all of the Web applications. &lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: blue;"&gt;Implementing an HTTP Module for Providing Security Services&lt;/i&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Our HTTP module will basically provide a custom authentication service. It will receive authentication credentials in HTTP request and will determine whether those credentials are valid. Through the User.Identity object, it will associate those roles that are accessible to our Web application pages to the user's identity. Following is the code of our HTTP module.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fxFJhotKI/AAAAAAAAA3o/Ikp4bOKygOs/s1600-h/8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fxFJhotKI/AAAAAAAAA3o/Ikp4bOKygOs/s400/8.JPG" width="367" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fxJTsw64I/AAAAAAAAA3w/oY6cfTN4Ego/s1600-h/9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fxJTsw64I/AAAAAAAAA3w/oY6cfTN4Ego/s400/9.JPG" width="325" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fxNByWO8I/AAAAAAAAA34/j4eQ0HHjRk8/s1600-h/10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="332" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fxNByWO8I/AAAAAAAAA34/j4eQ0HHjRk8/s400/10.JPG" width="400" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Now let's see this authentication mechanism in action. Currently we are only allowing the following users to log in to our system:&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;User id = Admin, Password = Admin123, Role = Administrator&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;User id = Main, Password = Main123, Role = User &lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Note that user id and password are case-sensitive.&lt;br /&gt;&lt;br /&gt;First try logging-in without providing credentials. Go to http://localhost/webapp2/index.aspx and you should see the following message.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fkGKhXQhI/AAAAAAAAA2Q/n4PqZ_t60mg/s1600-h/020417_04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="133" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fkGKhXQhI/AAAAAAAAA2Q/n4PqZ_t60mg/s400/020417_04.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Now try logging-in with the user id "Admin" and password "Admin123". Go to http://localhost/webapp2/index.aspx?userid=Admin&amp;amp;password=Admin123 and you should see the following welcome message.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fkdnWI2iI/AAAAAAAAA2Y/FIpIz1I35b8/s1600-h/020417_05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fkdnWI2iI/AAAAAAAAA2Y/FIpIz1I35b8/s400/020417_05.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Now try to log-in with the user id "Main" and password "Main123". Go to http://localhost/webapp2/index.aspx?userid=Mansoor&amp;amp;password=mas and you should see the following welcome page.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fk0nY97QI/AAAAAAAAA2g/IlVNti-dl_E/s1600-h/020417_06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S2fk0nY97QI/AAAAAAAAA2g/IlVNti-dl_E/s400/020417_06.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Now try to log-in with the wrong combination of user id and password. Go to http://localhost/webapp2/index.aspx?userid=Main&amp;amp;password=xyz and you should see the following error message.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2flgOIQHZI/AAAAAAAAA2o/8W2bpgDZLvU/s1600-h/020417_07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2flgOIQHZI/AAAAAAAAA2o/8W2bpgDZLvU/s400/020417_07.jpg" width="400" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This shows our security module in action. You can generalize this security module by using database-access code in the AuthenticateAndGetRoles method. &lt;/span&gt;&lt;span style="font-size: small;"&gt;To specify this, change the &lt;authentication&gt; &lt;/authentication&gt;&lt;/span&gt;&lt;i&gt;&lt;span id="konasapn0"&gt;&lt;span class="clsBlurb"&gt;authentication &lt;/span&gt;&lt;/span&gt;&lt;/i&gt;&lt;span style="font-size: small;"&gt;&lt;authentication&gt;node in web.config file of webapp2 to look like this:&lt;/authentication&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fxwzQ6aWI/AAAAAAAAA4A/53ouyJIYHwo/s1600-h/11.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="26" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S2fxwzQ6aWI/AAAAAAAAA4A/53ouyJIYHwo/s200/11.JPG" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;authentication mode="None"&gt; &lt;/authentication&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Similarly, don't allow anonymous users to our Web site. Add the following to web.config file:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fx2w0XsXI/AAAAAAAAA4I/lEGNoYBFd54/s1600-h/12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="98" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S2fx2w0XsXI/AAAAAAAAA4I/lEGNoYBFd54/s200/12.JPG" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Users should at least have anonymous access to the file that they will use for providing credentials. Use the following configuration setting in the web.config file for specifying index.aspx as the only anonymously accessible file:&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fyC64J6QI/AAAAAAAAA4Q/AoEkqfX7SUQ/s1600-h/13.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="140" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S2fyC64J6QI/AAAAAAAAA4Q/AoEkqfX7SUQ/s200/13.JPG" width="200" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt; &lt;b&gt;Conclusion&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;As you might have realized with HTTP handlers and modules, ASP.NET has put a lot of power in the hands of developers. I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-2520466025802041452?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/2520466025802041452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/http-handlers-and-http-modules-in.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2520466025802041452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2520466025802041452'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/02/http-handlers-and-http-modules-in.html' title='HTTP Handlers and HTTP Modules in ASP.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_CZVCL91-wHo/S2fg_ORWegI/AAAAAAAAA14/PMrV86WOBng/s72-c/020417_01.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-7581636533961485324</id><published>2010-01-21T15:14:00.000+05:30</published><updated>2010-01-21T15:14:57.850+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Net 3.5 Changes'/><category scheme='http://www.blogger.com/atom/ns#' term='What New Net 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='Eclipse 3.5 What New'/><category scheme='http://www.blogger.com/atom/ns#' term='New in Framework 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net 3.5 Changes'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio 2008 Features'/><category scheme='http://www.blogger.com/atom/ns#' term='Net 3.5 New Features'/><category scheme='http://www.blogger.com/atom/ns#' term='What New Net 3.5 Sp1'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net 3.5 Features'/><title type='text'>What's New in ASP.NET 3.5?</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;If you are not ready to upgrade your existing ASP.NET 2.0 applications to ASP.NET 3.5, you will want to upgrade to Visual Studio 2008 because of all its Web development-friendly new features, including full support for ASP.NET 2.0 development. You can maintain and improve your ASP.NET 2.0 applications with Visual Studio 2008.&lt;br /&gt;&lt;br /&gt;The changes in ASP.NET 3.5 as one of two categories: ASP.NET 3.5 specific features and ASP.NET-related Visual Studio 2008 enhancements such as nested master page support.&lt;br /&gt;&lt;br /&gt;Review these new ASP.NET 3.5 specific features:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;The ListView control&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;The DataPager control&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;The LinqDataSource&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Integrated AJAX support&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Improved designer support for AJAX control extenders&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Review these new ASP.NET 3.5-related Visual Studio 2008 enhancements:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Nested Master Page support&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Multi-Framework Targeting&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Enhanced Web design experience&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;JavaScript IntelliSense&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;JavaScript debugging&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;CSS Properties window&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;Manage Styles tool window&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Microsoft paid particular attention to making sure that .NET 3.5 is a smooth upgrade from .NET 2.0 with a goal of not requiring you to modify any existing code when moving your code to .NET 3.5. Another piece of good news is that there are no project model changes with Visual Studio 2008. When building new ASP.NET applications you can choose from the Web Site or Web Application project models and select the .&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ASP.NET 3.5 Specific Features&lt;/b&gt;&lt;br /&gt;First discuss a couple new controls added to ASP.NET 3.5, starting with the ListView and the DataPager.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;The ListView Control&lt;/i&gt;&lt;br /&gt;You could have an ASP.NET control with the free form templating capabilities of the Repeater control and the data editing capabilities of the DataGrid control. Imagine no more because that control exists in ASP.NET 3.5—the new &lt;asp:listview&gt; control.&lt;br /&gt;&lt;br /&gt;The ListView supports data binding to all the traditional data sources such as SQLDataSource, ObjectDataSource, XMLDataSource as well as the new LinqDataSource.&lt;br /&gt;&lt;br /&gt;You have complete control of how the ListView presents your data through the use of 11 templates.&lt;br /&gt;&lt;/asp:listview&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;LayoutTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;AlternatingItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;EditItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;EmptyDataTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;EmptyItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;GroupTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;GroupSeparatorTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;InsertItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;ItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;ItemSeparatorTemplate&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;SelectedItemTemplate&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The two most important templates are the LayoutTemplate and the ItemTemplate. The LayoutTemplate is the outer shell containing the HTML that defines the overall look and feel of the control while the ItemTemplate contains the HTML that specifies how each bound record will appear.&lt;br /&gt;&lt;br /&gt;Simple example to an example complete with the ability to insert, update, and delete data. I used the ListView's smart tag option to configure the data capabilities as well as the look and feel I wanted for this sample. The result is a ListView complete with the templates that control the formatting for adding, updating, and deleting records in the ListView.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gZWe95RwI/AAAAAAAAAxI/I-LPUjjrqG4/s1600-h/38741_Figure01.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="140" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gZWe95RwI/AAAAAAAAAxI/I-LPUjjrqG4/s400/38741_Figure01.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Configure ListView:&lt;/b&gt; Select Configure ListView for ListView configuration options.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gZpA2SRtI/AAAAAAAAAxQ/qYkac8zPXic/s1600-h/38741_Figure02.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="285" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gZpA2SRtI/AAAAAAAAAxQ/qYkac8zPXic/s400/38741_Figure02.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: x-small;"&gt;&lt;b&gt;ListView Configuration Options:&lt;/b&gt; The options include selecting a layout, style, data updating options, and paging.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The ListView control does not support paging, but that is not a problem because it does work hand-in-hand with the new DataPager control.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;The DataPager Control&lt;/i&gt;&lt;br /&gt;The &lt;asp:datapager&gt; control provides paging capabilities. It is an external control that points at the control it provides paging support for. As an external control, you gain the advantage of being able to place it anywhere on the page and configuring what it is going to look like. The DataPager works with controls that implement the IPageableItemContainer interface. At the moment, the DataPager only works with the new ListView control because it's the only one that implements the IPageableItemContainer interface.&lt;br /&gt;&lt;br /&gt;The DataPager's PageControlID specifies which control the DataPager will provide paging support.The PageSize setting determines how many rows of data will be displayed on each page. There are three different types of field controls available, NextPreviousPagerField, NumericPagerField, and TemplatePagerField.&lt;/asp:datapager&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gaDY_YhsI/AAAAAAAAAxY/EPowWa0x1CM/s1600-h/38741_Figure03.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="367" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gaDY_YhsI/AAAAAAAAAxY/EPowWa0x1CM/s400/38741_Figure03.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;DataPager with Paging Options:&lt;/b&gt; Here's a Web page utilizing the DataPager control and the NextPreviousPagerField and NumericPagerField options.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The NextPreviousPagerField provides an interface for users to move from page to page or jump to the first or last page.The NumericPagerField provides an interface for users to select a page by page number. The TemplatePagerField provides a mechanism for you to develop a custom paging interface.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S1gaWnjZ9FI/AAAAAAAAAxg/qXdEvXfOTqs/s1600-h/38741_Figure04.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="182" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S1gaWnjZ9FI/AAAAAAAAAxg/qXdEvXfOTqs/s400/38741_Figure04.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;NextPreviousPagerField:&lt;/b&gt; The figure shows the process of adding the NextPreviousPagerField in the Source window.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gamtK7sSI/AAAAAAAAAxo/sW0LRHQ_VX4/s1600-h/38741_Figure05.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="237" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gamtK7sSI/AAAAAAAAAxo/sW0LRHQ_VX4/s400/38741_Figure05.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;NumericPagerField:&lt;/b&gt; Here's how you add a NumericPagerField in the Source window.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: #990000;"&gt;The LinqDataSource Control&lt;/i&gt;&lt;br /&gt;The &lt;asp:linqdatasource&gt; control is an ASP.NET control that, like the &lt;asp:sqldatasource&gt; and &lt;asp:objectdatasource&gt; controls, is used to declaratively bind ASP.NET controls to a data source. What makes the LinqDataSource unique is that instead of binding directly to something such as a database or data access layer object, which you can still do, you bind to a LINQ-friendly data model such as a LINQ to SQL object relational model (ORM).&lt;br /&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Integrated AJAX Support&lt;/i&gt;&lt;br /&gt;Back in the day before Microsoft released ASP.NET 3.5, you had to download and install the Microsoft ASP.NET AJAX 1.0 framework to build or deploy an AJAX-enabled application. But those days are gone now, because AJAX is now treated as a first-class citizen in Visual Studio and the libraries are now included in .NET 3.5. When you build a new Web site, you no longer need to specify an AJAX-ready Visual Studio project template.&lt;/asp:objectdatasource&gt;&lt;/asp:sqldatasource&gt;&lt;/asp:linqdatasource&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1ga3o6vJzI/AAAAAAAAAxw/Y852UyWPgCI/s1600-h/38741_Figure06.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="261" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1ga3o6vJzI/AAAAAAAAAxw/Y852UyWPgCI/s400/38741_Figure06.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;No AJAX Templates:&lt;/b&gt; The new Web site dialog box does not contain AJAX-specific templates.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Improved Designer Support for AJAX Control Extenders&lt;/i&gt;&lt;br /&gt;AJAX control extenders provide a way to add capabilities and functionality to controls already on a page. The ASP.NET AJAX Control Toolkit is a great community-driven collection of free control extenders that you can use to easily add AJAX functionality to your pages.&lt;br /&gt;&lt;br /&gt;With Visual Studio 2005, you had to manually wire up the controls with the extender control you wanted to use. Visual Studio 2008's improved designer support for ASP.NET AJAX control extenders has made the process much easier by providing Smart Tag options to add or remove extenders from a particular control. When Visual Studio 2008 detects that one or more extenders exist for the control you have selected it will display the control's Smart Tag. Selecting Add Extender will display the Extender Wizard for you to select which extender you would like to use.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gbIk0UZNI/AAAAAAAAAx4/lX39scoYsrA/s1600-h/38741_Figure07.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="117" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gbIk0UZNI/AAAAAAAAAx4/lX39scoYsrA/s400/38741_Figure07.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt; &lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;Add Extenders:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt; When Visual Studio 2008 detects extenders are present for a control, Add Extender is added to the Smart Tag options.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gbT2KB-XI/AAAAAAAAAyA/oE-yCRVbn4U/s1600-h/38741_Figure08.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="310" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gbT2KB-XI/AAAAAAAAAyA/oE-yCRVbn4U/s400/38741_Figure08.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt; &lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Selecting Extenders:&lt;/b&gt; You can select an extender for a specific control type.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;ASP.NET 3.5-Related Visual Studio 2008 Enhancements&lt;/b&gt;&lt;br /&gt;The Visual Studio 2008 IDE has been enhanced to improve your productivity when developing Web applications.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Nested Master Pages Support&lt;/i&gt;&lt;br /&gt;Visual Studio 2005 didn't really support nested master pages. The problem was that pages based on master pages could not be edited within the Visual Studio 2005 designer. Microsoft has corrected this behavior with Visual Studio 2008.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gbiWwxoaI/AAAAAAAAAyI/cLFh8xyapFs/s1600-h/38741_Figure09.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="242" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gbiWwxoaI/AAAAAAAAAyI/cLFh8xyapFs/s400/38741_Figure09.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Nested Master Page Template:&lt;/b&gt; The Nested Master Page template has been added to the Add New Item dialog box.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The process for creating a nested master page is slightly different depending on which project model you are using: Web Site or Web Application Project. Use a project based on the Web Application Project model for this example. Add a new item to a project and select the Nested Master Page template and enter a name for the nested master. Next, need to select the master page I want to base my nested master page on.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gcUGw4zmI/AAAAAAAAAyY/vvRXp7hZ300/s1600-h/38741_Figure10.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="245" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gcUGw4zmI/AAAAAAAAAyY/vvRXp7hZ300/s400/38741_Figure10.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Select Master:&lt;/b&gt; Select the master template you wish to base your nested master page on.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The process for creating a new page from a nested master page is the same as it was in ASP.NET 2.0. The good news is that now you can work with the new nested master page based in the WYSIWYG Designer in Visual Studio 2008.&lt;br /&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Multi-Framework Targeting&lt;/i&gt;&lt;br /&gt;When you open an existing project, or create a new one, you are given the option to select which framework version you want to target. The Visual Studio 2008 IDE will adjust itself to your framework selection and only offer features, options, controls, templates, and assemblies, among other things, based on the targeted framework. This includes automatically updating the assemblies referenced in your project and sections in the Web.config file.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gckJk8KsI/AAAAAAAAAyg/cyXgYPZoz90/s1600-h/38741_Figure12.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="261" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gckJk8KsI/AAAAAAAAAyg/cyXgYPZoz90/s400/38741_Figure12.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Target Framework Version:&lt;/b&gt; You can target a specific framework version when creating a new Web site.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;One of the benefits of the multi-framework targeting support is that all the new features added to Visual Studio 2008, such as nested master page support, enhanced JavaScript support, and the HTML editor enhancements, are available to you as you continue to work on and support your ASP.NET 2.0-based Web sites.&lt;br /&gt;&lt;br /&gt;The process of specifying which version of the .NET Framework to target for an existing project depends on which project model you are using and unfortunately, which language you are using. If you are using the Web Site project model, regardless of the language selected, select the Build option on the project Property Pages and select the framework you want to target from the dropdown.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gcvVPgHdI/AAAAAAAAAyo/N6RMWdsTnqM/s1600-h/38741_Figure13.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="225" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gcvVPgHdI/AAAAAAAAAyo/N6RMWdsTnqM/s400/38741_Figure13.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Target Framework from Project Properties:&lt;/b&gt; For existing Web site projects you can specify the target framework from the project properties.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;If you are using the Web Application project model, here is where things get interesting. For projects written in C#, things are simple. Open the project properties and select the framework you wish to target on the Application tab.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gdAmLjX7I/AAAAAAAAAyw/_H8QO0ka4Ds/s1600-h/38741_Figure14.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="330" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gdAmLjX7I/AAAAAAAAAyw/_H8QO0ka4Ds/s400/38741_Figure14.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Targeting Framework in C#:&lt;/b&gt; For C# Web application projects you can specify the target framework from the Application tab on the Property Pages.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;For Visual Basic projects created with the Web Application Projects model, open the project properties, select the Compile tab, and click the Advanced Compile Options button. Select the framework from the Target framework dropdown.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gdJEjGW6I/AAAAAAAAAy4/tKMX5gjV4AI/s1600-h/38741_Figure15.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="305" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gdJEjGW6I/AAAAAAAAAy4/tKMX5gjV4AI/s400/38741_Figure15.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Targeting Framework in VB:&lt;/b&gt; For Visual Basic Web application projects you can specify the target framework on the Advanced Compiler Settings dialog box.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Enhanced Web Designer&lt;/i&gt;&lt;br /&gt;The Split View feature displays the Design View and the HTML source in two different panes at the same time. While in Split View, changes you make in the Design pane automatically updates the source in the HTML pane. You would expect that changes you make in the HTML source pane would automatically be reflected in the Design pane, right? Wrong. You need to either save the page or click the button displayed at the top of the Design pane to synchronize the two panes.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gdYkKvEgI/AAAAAAAAAzA/2c-_wzu0hAk/s1600-h/38741_Figure16.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="337" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gdYkKvEgI/AAAAAAAAAzA/2c-_wzu0hAk/s400/38741_Figure16.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Split Pane:&lt;/b&gt; The Split pane enables you to see the HTML source and Design surface at the same time.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;By default, the two panes are split horizontally with the HTML pane on top and the Design pane on the bottom. To display the two panes side-by-side, from the Tools menu select Options, make sure "Show All Settings" is checked, drill into the HTML Designer option, select General, and check the Split views vertically option.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gdg_mpmhI/AAAAAAAAAzI/whI0RuKUXJQ/s1600-h/38741_Figure17.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="232" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1gdg_mpmhI/AAAAAAAAAzI/whI0RuKUXJQ/s400/38741_Figure17.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Split Pane View Options:&lt;/b&gt; You can specify a vertical or horizontal display for the Split pane.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;While you view the Options dialog box, let me point out a nice addition made to Visual Studio 2008. Select the Text Editor option, drill into the HTML option and select the Validation option. Right out of the box, Visual Studio 2008 is configured to display those pesky HTML, CSS, and JavaScript errors as warnings instead of errors.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S1gd5wa4zlI/AAAAAAAAAzQ/3mYrNxxneaE/s1600-h/38741_Figure18.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="232" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S1gd5wa4zlI/AAAAAAAAAzQ/3mYrNxxneaE/s400/38741_Figure18.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;HTML/CSS Error Options:&lt;/b&gt; Select the option for HTML and CSS warnings to stop getting them listed as errors.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: #990000;"&gt;&lt;br /&gt;JavaScript IntelliSense&lt;/i&gt;&lt;br /&gt;Visual Studio 2008's built-in support for JavaScript IntelliSense.this makes such a difference writing JavaScript code in Visual Studio 2005 versus Visual Studio 2008. Being able to select JavaScript keywords and language features from an IntelliSense list makes building AJAX applications so much easier.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1geIi5C9XI/AAAAAAAAAzY/HOAOmUZzWAY/s1600-h/38741_Figure19.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="292" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1geIi5C9XI/AAAAAAAAAzY/HOAOmUZzWAY/s400/38741_Figure19.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;JavaScript Intellisense:&lt;/b&gt; IntelliSense displays JavaScript keywords and types.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You just need to declare an external JavaScript reference either manually or by dragging the .js file into the  tag and IntelliSense picks up on the functions contained in the external library.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1geTaETVMI/AAAAAAAAAzg/RWjhmUf6MFA/s1600-h/38741_Figure20.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="170" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1geTaETVMI/AAAAAAAAAzg/RWjhmUf6MFA/s400/38741_Figure20.jpg" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt; &lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;Intellisense for External JavaScript Libraries:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt; IntelliSense picks up the members of an external JavaScript library.&lt;/span&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i style="color: #990000;"&gt;JavaScript Debugging&lt;/i&gt;&lt;br /&gt;Microsoft dramatically improved this situation because you can now set breakpoints in your JavaScript code located in regular ASP.NET pages (.aspx), external code files (.js), and in your master pages (.master).&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gekwRf86I/AAAAAAAAAzo/JeYfP0m5AJI/s1600-h/38741_Figure21.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1gekwRf86I/AAAAAAAAAzo/JeYfP0m5AJI/s400/38741_Figure21.jpg" width="310" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;JavaScript Breakpoints:&lt;/b&gt; You can set breakpoints in your JavaScript code.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;In addition, you can now set breakpoints in your client-side JavaScript code and your server-side Visual Basic or C# code on the same page and utilize a single debugger session to step though all the code.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gexBYhEyI/AAAAAAAAAzw/41iueuzVMNY/s1600-h/38741_Figure22.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://4.bp.blogspot.com/_CZVCL91-wHo/S1gexBYhEyI/AAAAAAAAAzw/41iueuzVMNY/s400/38741_Figure22.jpg" width="396" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;JavaScript Debugging:&lt;/b&gt; The runtime debugger displaying a JavaScript breakpoint.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;One of the most significant additions to the JavaScript debugging experience is the improved object inspection support, which provides more detailed object property and property type information.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ge73gRwII/AAAAAAAAAz4/uePgh7Jiav8/s1600-h/38741_Figure23.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ge73gRwII/AAAAAAAAAz4/uePgh7Jiav8/s400/38741_Figure23.jpg" width="298" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;JavaScript Object Inspector:&lt;/b&gt; JavaScript object inspection has been improved.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;CSS Properties Window&lt;/i&gt;&lt;br /&gt;The new CSS Properties window makes keeping track and changing CSS values quick and easy.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/S1ggQkEYnkI/AAAAAAAAA0A/fxW3lgb6mvQ/s1600-h/38741_Figure24.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://1.bp.blogspot.com/_CZVCL91-wHo/S1ggQkEYnkI/AAAAAAAAA0A/fxW3lgb6mvQ/s400/38741_Figure24.jpg" width="237" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt; CSS Properties Window:&lt;/b&gt; The CSS Properties window displays all the CSS properties for the selected item.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;i style="color: #990000;"&gt;Manage Styles Window&lt;/i&gt;&lt;br /&gt;It helps you visually manage the CSS styles used on the page you are currently working with in both Design and Source view. You will find it on the View menu, just after the CSS Properties menu option. When an item is circled it means that rule is currently used somewhere on the current page. Hover over a style to display the rule values for that rule. Select a rule and you'll see a preview of its appearance in the Selected Style Preview section at the bottom of the Manage Styles window. Double-click on a rule to open the style sheet in which it resides.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ggmjH2-bI/AAAAAAAAA0I/ehFaxQjwPF4/s1600-h/38741_Figure26.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ggmjH2-bI/AAAAAAAAA0I/ehFaxQjwPF4/s400/38741_Figure26.jpg" width="233" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;&lt;b&gt;Manage Styles Window:&lt;/b&gt; The Manage Styles window displays all the styles in a CSS file and indicates which elements are in use.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;At the top of the Manage Styles window you will see an option to create new styles and an option to load an additional style sheet into the Manage Styles window if your project utilizes more than a single style sheet. You can click the Options button to display a number of display options.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ggubFDkWI/AAAAAAAAA0Q/HS7on6ypAWg/s1600-h/38741_Figure27.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="400" src="http://3.bp.blogspot.com/_CZVCL91-wHo/S1ggubFDkWI/AAAAAAAAA0Q/HS7on6ypAWg/s400/38741_Figure27.jpg" width="322" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: center;"&gt;&lt;b&gt; &lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;CSS Options:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt; The Options button provides categorizing and display options for the CSS elements.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;All these new features in ASP.NET 3.5 and Visual Studio 2008 should peak your interest and the coverage here should help jumpstart your learning process. I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&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/4414130591562689667-7581636533961485324?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/7581636533961485324/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/whats-new-in-aspnet-35.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7581636533961485324'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7581636533961485324'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/whats-new-in-aspnet-35.html' title='What&apos;s New in ASP.NET 3.5?'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_CZVCL91-wHo/S1gZWe95RwI/AAAAAAAAAxI/I-LPUjjrqG4/s72-c/38741_Figure01.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-4743760349443147992</id><published>2010-01-20T12:38:00.000+05:30</published><updated>2010-01-20T12:40:21.064+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='MVP Pattern in ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C# MVP'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET MVC MVP'/><category scheme='http://www.blogger.com/atom/ns#' term='Difference Between MVC MVP Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='MVC vs MVP'/><category scheme='http://www.blogger.com/atom/ns#' term='MVP Design Patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='MVP Architecture ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Model View Presenter VS Model View Controller'/><title type='text'>Difference Between MVP and MVC</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;If we would compare the diagrams of MVP and MVC patterns&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S1ap_mC7ZOI/AAAAAAAAAww/NQaz-p_SPH0/s1600-h/image_15.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="376" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S1ap_mC7ZOI/AAAAAAAAAww/NQaz-p_SPH0/s400/image_15.png" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;We could see that MVP design pattern implementation has a view totally unaware of model. Presenter is the one exclusively communicating with the model and sending DTO to model or performing direct manipulation with the view UI elements.&lt;br /&gt;&lt;br /&gt;On the other hand, in MVC we have next two "read data" cases:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;A view reading data directly from model and perform "declarative data binding" of its controls or&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li style="font-family: Arial,Helvetica,sans-serif;"&gt;controller retrieving data from model, pass that context data to view while loading the appropriate view and view then binds to that sent context data&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;In most of the "update data" use cases we have a view sending updated context data to controller, where controller&amp;nbsp; performs some validation and/or business logic and updates the model with that data.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Navigation aspects&lt;/b&gt;&lt;br /&gt;In general, MVP pattern is based on standard ASP NET page controller pattern implementation, where Page A performs Response.Redirect("PageB") and that results with page B loading with complete page life cycle events fired etc. MVP adds to that sequence just&amp;nbsp; one additional step: injecting the view to presenter.&lt;br /&gt;&lt;br /&gt;Beside that "default" ASP NET page controller based implementation, there are various ways how the MVP implementation can be enhanced.&lt;br /&gt;&lt;br /&gt;One of them is the utilization of application controller&amp;nbsp; and Page Flow Application Block (which I presented last week on my Web Client Software Factory session) where application controller centralizes flow and navigation concerns and behaves as shared context&amp;nbsp; container for multiple views covering the same use case.&lt;br /&gt;&lt;br /&gt;Page flow application block is a block using the NET 3.0 workflow engine enhanced with additional UI designer used in defining navigation flows. The end result is that you have a separate project with workflow definition describing navigation flow use cases. In a way, that is something very similar to the purpose front controller has.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S1aqf3uaI2I/AAAAAAAAAw4/qyqIyzuyutY/s1600-h/image_thumb_10.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="331" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S1aqf3uaI2I/AAAAAAAAAw4/qyqIyzuyutY/s400/image_thumb_10.png" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;i&gt;MVP summarized: Navigation is handled on a per page basis using page controller pattern approach.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;MVC.NET framework is different - more "web suitable" approach to the same concern of efficient handling navigation. It is based on front controller design pattern driven routing engine, which in general represents intercepting of&amp;nbsp; every http request on a http handler level and checking if there are mapped controller types responsible for handling intercepted Url.&lt;br /&gt;&lt;br /&gt;As we can see on first diagram, the flow in MVC starts with controller class and not with web page - view. When controller is been invocated, it usually:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Retrieves some data from model,&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Performs business logic and&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Picking the appropriate view to which he pass the processed model data&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Loads&amp;nbsp; the view - which then renders without the need of complete page life cycle being executed &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;In a way, that is something similar to what we have in Supervising controller MVP pattern, with a difference that in supervising controller the view (page) is still been loaded first and then the presenter class is been created.&lt;br /&gt;&lt;br /&gt;&lt;i&gt;MVC summarized: The navigation is handled in one centralized configurable place for all the pages&amp;nbsp; based on front controller pattern.&lt;/i&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;i&gt;&amp;nbsp;&lt;/i&gt;&lt;br /&gt;I found one thing important enough to be emphasized here: Front controller (routing engine) is a part of Microsoft MVC.NET framework, but that is its separate part and pattern different then MVC pattern.&lt;br /&gt;&lt;br /&gt;To illustrate how routing engine is important for MVC framework, I'll just mentioned briefly that I've been working on a POC which was supposed to handle on efficient way the need for having various page UI flavors of the same page - based on multiple business conditions.&lt;br /&gt;&lt;br /&gt;I choose to built platform based on MVP pattern where multiple views are sharing the same presenter enhanced with custom routing front controller engine. The end result of this solution based on a front controller + MVP is something which looks very much like what I've seen in MVC.NET framework but just with standard web forms used.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Advantages of the MVP&lt;/b&gt;&lt;br /&gt;All you need to develop the presenter is an interface of the view. That interface of the view in passive view version of MVP represents page UI elements, so in a sense it can be considered as page abstraction or even as page contract between the designers and developers.&lt;br /&gt;&lt;br /&gt;Passive view is very cumbersome to be implemented and sometimes lead to complex presenters, the advantages of its usage are much higher in standard waterfall development process, because it enables tech leads&amp;nbsp; to translate the Functional Requirement Document requirements right at the beginning of development phase and produce sets of view interfaces.&lt;br /&gt;&lt;br /&gt;Communication on relation tech lead-&amp;gt;developer is concentrated to the beginning of development phase with very precise set of artifacts defining requirements. Once the interface of the views would be defined and verified as the one matching the Functional Requirement Document requirements, developers are able to start developing their presenters including the unit tests to verify that Functional Requirement Document functional requirements are fulfilled well.&lt;br /&gt;&lt;br /&gt;The end result of that activity would be a list of unit tests representing Functional Requirement Document requirements. Percentage of successfully "green" test of that list can be used then to track realistic project progress.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S1aq6Sas1kI/AAAAAAAAAxA/G9BbH2d_dio/s1600-h/image_thumb_13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="150" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S1aq6Sas1kI/AAAAAAAAAxA/G9BbH2d_dio/s400/image_thumb_13.png" width="400" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;What we get as the end result is:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Totally decoupled and effective working streams of tech lead, developer and designer&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Set of artifacts useful in tracking the real project implementation progress&amp;nbsp; and as a guidance to developers what requirements they have to met. &lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Summary&lt;/b&gt;&lt;br /&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&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/4414130591562689667-4743760349443147992?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/4743760349443147992/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/difference-between-mvp-and-mvc.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4743760349443147992'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4743760349443147992'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/difference-between-mvp-and-mvc.html' title='Difference Between MVP and MVC'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S1ap_mC7ZOI/AAAAAAAAAww/NQaz-p_SPH0/s72-c/image_15.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-9177635887116762713</id><published>2010-01-11T15:36:00.000+05:30</published><updated>2010-01-11T15:36:11.265+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='MVP'/><category scheme='http://www.blogger.com/atom/ns#' term='Model-View-Presenter framework for .NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Model View Presenter'/><category scheme='http://www.blogger.com/atom/ns#' term='Model-View-Presenter in ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Model View Presenter with ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Model View Presenter Using ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET Model View Presenter'/><title type='text'>Model View Presenter (MVP) With ASP.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Introduction of Model View Presenter&lt;/b&gt;&lt;br /&gt;Model-View-Presenter (MVP) is a variation of the Model-View-Controller (MVC) pattern but specifically geared towards a page event model such as ASP.NET. MVP was originally used as the framework. The primary differentiate of MVP is that the Presenter implements an Observer design of MVC but the basic ideas of MVC remain the same: the model stores the data, the view shows a representation of the model, and the presenter coordinates communications between the layers. MVP implements an Observer approach with respect to the fact that the Presenter interprets events and performs logic necessary to map those events to the proper commands to manipulate the model. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example&lt;/b&gt;&lt;br /&gt;In this example the client wants a page that shows the current time.The ASPX page that will show the time is the "View." The "Presenter" is responsible for determining the current time and giving the Model to the View.&lt;br /&gt;&lt;br /&gt;[TestFixture]&lt;br /&gt;public class CurrentTimePresenterTests &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; [Test]&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void TestInitView() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; MockCurrentTimeView view = new MockCurrentTimeView();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CurrentTimePresenter presenter = new CurrentTimePresenter(view);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; presenter.InitView();&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.IsTrue(view.CurrentTime &amp;gt; DateTime.MinValue);&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private class MockCurrentTimeView : ICurrentTimeView &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public DateTime CurrentTime &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; set { currentTime = value; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // This getter won't be required by ICurrentTimeView,&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // but it allows us to unit test its value.&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; get { return currentTime; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private DateTime currentTime = DateTime.MinValue;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;span style="font-size: small;"&gt; &lt;span id="goog_1263202498938"&gt;&lt;/span&gt;&lt;span id="goog_1263202498939"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/S0r0i0_SJII/AAAAAAAAAwo/bpzY8PucE5g/s1600-h/MvpDiagram.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/S0r0i0_SJII/AAAAAAAAAwo/bpzY8PucE5g/s400/MvpDiagram.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The above unit test, along with the diagram, describes the elements of the MVP relationship.The very first line creates an instance of MockCurrentTimeView. As seen with this unit test, all of the Presenter logic can be unit tested without having an ASPX page, i.e. the View. All that is needed is an object that implements the View interface; accordingly, a mock view is created that stands in place of the "real" view. &lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The Presenter can now manipulate the View. As seen in the diagram, the Presenter only talks to a View interface. It does not work with a concrete implementation directly. This allows multiple Views, implementing the same View interface, to be used by the same Presenter.&lt;br /&gt;&lt;br /&gt;Finally, the Presenter is asked to InitView(). This method will get the current time and pass it to the View via a public property exposed by ICurrentTimeView. A unit-test assertion is then made that the CurrentTime on the view should now be greater than its initial value. A more detailed assertion could certainly be made if needed. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;The View interface&lt;/b&gt;&lt;br /&gt;As a first step towards getting the unit test to compile, ICurrentTimeView.cs should be created. This View interface will provide the conduit of communication between the Presenter and the View. In the situation at hand, the View interface needs to expose a public property that the Presenter can use to pass the current time, the Model, to the View. &lt;br /&gt;&lt;br /&gt;public interface ICurrentTimeView &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DateTime CurrentTime { set; }&lt;br /&gt;} &lt;br /&gt;&lt;br /&gt;The View only needs a setter for the current time since it just needs to show the Model, but providing a getter allows CurrentTime to be checked within the unit test. So instead of adding a getter to the interface, it can be added to MockCurrentTimeView and need not be defined in the interface at all. In this way, the exposed properties of the View can be unit tested without forcing extraneous setters/getters to be defined in the View Interface. The described unit test above shows this technique.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;The Presenter&lt;/b&gt;&lt;br /&gt;The presenter will handle the logic of communicating with the Model and passing Model values to the View. The Presenter, needed to make the unit test compile and pass, is as follows. &lt;br /&gt;&lt;br /&gt;public class CurrentTimePresenter &lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public CurrentTimePresenter(ICurrentTimeView view) &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (view == null)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; throw new ArgumentNullException("view may not be null");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.view = view;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void InitView() &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; view.CurrentTime = DateTime.Now;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; private ICurrentTimeView view;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;Once the above items have been developed -- the unit test, the mock view, the view and the presenter -- the unit test will now compile and pass successfully. The next step is creating an ASPX page to act as the real View.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;b&gt;The View&lt;/b&gt;&lt;br /&gt;The actual View needs to do the following:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The ASPX page needs to provide a means for displaying the current time. As shown below, a simple label will be used for display.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The code-behind must implement ICurrentTimeView.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt; The code-behind needs to create the Presenter, passing itself to the Presenter's constructor.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt; After creating the Presenter, InitView() needs to be called to complete the MVP cycle. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;A drawback to the above example is that MVP seems like a lot of work for such little gain. We've gone from having one ASPX page to having a Presenter class, a View interface and a unit testing class. The gain has been the ability to unit test the Presenter, i.e. the ability to conveniently unit test code that would normally be found in the code-behind page. The advantages&amp;nbsp; of MVP shine when developing and maintaining enterprise web applications, not when writing "hello world"-like samples.&lt;/span&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/4414130591562689667-9177635887116762713?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/9177635887116762713/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/model-view-presenter-mvp-with-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/9177635887116762713'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/9177635887116762713'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2010/01/model-view-presenter-mvp-with-aspnet.html' title='Model View Presenter (MVP) With ASP.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_CZVCL91-wHo/S0r0i0_SJII/AAAAAAAAAwo/bpzY8PucE5g/s72-c/MvpDiagram.gif' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-8773004330269891021</id><published>2009-12-29T10:50:00.000+05:30</published><updated>2009-12-29T10:53:48.594+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='TreeView Control Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='C# NET TreeView Control'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax TreeView Control'/><category scheme='http://www.blogger.com/atom/ns#' term='TreeView Control Data Binding'/><category scheme='http://www.blogger.com/atom/ns#' term='VB NET TreeView Control'/><category scheme='http://www.blogger.com/atom/ns#' term='Tree View Control ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Populate TreeView Control'/><title type='text'>ASP.NET 2.0 TreeView Control</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Introduction of Tree View Control&lt;/b&gt;&lt;br /&gt;ASP.NET 2.0 introduces a new control named TreeView that provides a seamless way to consume information from hierarchical data sources such as an XML file and then display that information. You can use the TreeView control to display information from a wide variety of data sources such as an XML file, site-map file, string, or from a database. In this article, we will discuss this new control in depth and understand how to use this feature rich control in your ASP.NET applications. Apart from statically data binding the TreeView control with the contents of an XML file, we will also demonstrate how to populate this control dynamically by adding nodes at runtime. Finally, we will see how to apply XSL transformation on XML data before displaying that information in a TreeView control. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;Hierarchical Data&lt;/b&gt;&lt;br /&gt;&amp;nbsp;One of the important ways of organizing data which now pervades IT is hierarchical data. ASP.NET has a series of controls that make it both easy and logical to utilize hierarchical data. TreeView is one of the important controls that can be easily bound to data source controls such as SiteMapDataSource, XmlDataSource to display hierarchical information. Before we go onto take a look at the TreeView, let us understand the common types of hierarchical data.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Folders - The way folders are structured in a Windows file system denotes a hierarchical way of storing data.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;XML - XML documents are self-describing meaning that the metadata that is required to qualify the data is actually contained in the XML document itself providing a flexible way of handling XML data.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;SiteMap - Sitemap is nothing but an XML format that provides a consistent way of describing the navigation structure of a web site including all the pages contained in that web site.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Menu system - A menu system can also use an XML document as its input and displays the contents of the XML document in a hierarchical manner.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;XmlDataSource - This control allows you to bind to XML data, which can come from a variety of sources such as an external XML file, a DataSet object and so on. Once the XML data is bound to the XmlDataSource control, this control can then act as a source of data for other data-bound controls such as TreeView and Menu. For example, you can use the asp:XmlDataSource control to represent a hierarchical XML data source.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;SiteMapDataSource - This control basically retrieves the site map information from the web.sitemap file.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The architecture of TreeView control is very similar to the design of controls for tabular data. It is data bound to any of the above hierarchical data source controls to display the information. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;TreeView Control&lt;/b&gt;&lt;br /&gt;The ASP.NET 2.0 TreeView control is a completely new control introduced with ASP.NET 2.0 that is available under the Standard tab in the Toolbox. You can use the TreeView control in any situation in which you need to display hierarchical data. For example, you can use this control when displaying a navigation menu, displaying database records from database tables in a Master/Detail relation, displaying the contents of an XML document, or displaying files and folders from the file system. It is also possible for you to programmatically access the TreeView object model to dynamically create trees, populate nodes, set properties and so on. The TreeView control consists of nodes and there are three types of nodes that you can add to a TreeView control.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Root - A root node is a node that has no parent node. It has one or more child nodes.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Parent - A node that has a parent node and one or more child nodes&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Leaf - A node that has no child nodes&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The easiest way to use the TreeView control is to specify a static set of tree nodes. For example, you can use the TreeView control to display a simple navigational menu for a Web site. Or, you can use the TreeView control to display the table of contents for a help file.&lt;br /&gt;&lt;br /&gt;You specify the appearance of a static TreeView control by declaring one or more TreeNode controls within the TreeView control's [Nodes] tag. The following code demonstrates how to declare a TreeView control and a root node.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmLFfk2QBI/AAAAAAAAAsg/4iFXlTpmEDQ/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmLFfk2QBI/AAAAAAAAAsg/4iFXlTpmEDQ/s640/1.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;As you can see in the above code, the root node is declared using the asp:TreeNode inside the Nodes element. Each node has a Text and a Value property. The value of the Text property is displayed in the TreeView, while the Value property is used to store any additional data about the node, such as data passed to the post back event associated with the node. The text displayed through a node can be in one of two modes: selection mode and navigation mode. By default, a node is in selection mode. To put a node into navigation mode, you can set the node's NavigateUrl property to a value other than an empty string (""). &lt;br /&gt;&lt;br style="color: #783f04;" /&gt;&lt;b&gt;&lt;span style="color: #660000;"&gt;Customizing the Appearance of the TreeView Control&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;The TreeView control provides ImageUrl properties such as RootNodeImageUrl, ParentNodeImageUrl, and LeafNodeImageUrl. These custom images are rendered to the left of the node's text. You can override the default image for the node type using the ImageUrl property. The TreeView control also provides CollapseImageUrl and ExpandImageUrl properties for the expanded and collapsed indicators. These are usually represented by plus and minus icons. There is also a property named NoExpandImageUrl that can be used for rendering an image for nodes which have no children. You can turn off the default image using the ShowExpandCollapseboolean property.&lt;br /&gt;&lt;br /&gt;In addition to custom images, the TreeView control also supports TreeNodeStyle properties for each node types. These style properties override the NodeStyle property, which applies to all node types. A node can also have a different style applied when it is selected. When Selected property is set to true, the node is selected and the SelectedNodeStyle properties overrides any corresponding unselected style properties for the selected node. It is also possible for you to render check boxes between the node and image by setting the ShowCheckBoxes property to a boolean value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Implementation&lt;/b&gt;&lt;br /&gt;Now that we have understood the theory behind the TreeView controls, let us look at the following examples.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;How to use the TreeView control to display site navigation structure&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;How to implement TreeView data binding with an XML file&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;How to dynamically populate nodes in a TreeView control&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;How to perform XSL transformation on XML data before displaying that information through a TreeView control &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Let us start our implementation by discussing the first example in the above list.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #660000;"&gt;Using the TreeView Control to Display Site Navigation Structure&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;In this example, we will use the TreeView control to display hierarchical information about the site structure using the contents of the web.sitemap file. In the web.sitemap file, you specify the list of nodes that specify the navigation structure of the site, which can be completely independent of the site folder layout or other structure. When a SiteMapDataSource is placed on the page, it will specifically look for a file with that name and then read the contents of the web.sitemap file and consume that information. Once the information is available in the data source control, you can then bind a TreeView control to the data source control to display that information in the web page.&lt;br /&gt;&lt;br /&gt;Fire up Visual Studio 2005 and create a new ASP.NET Web Site named TreeView by selecting New Web Site from the File menu. In the New Web Site dialog box, click the Browse button and select Local IIS as the location and click Open. In the New Web Site dialog box, enter http://localhost/MyProjects/15Seconds/TreeView as the location of the web site. Then click OK.&lt;br /&gt;&lt;br /&gt;Once the project is created, add a web.sitemap file by selecting Add New Item from the Web Site menu. In the Add New Item dialog box, select Site Map and click Add. This will result in a new file named web.sitemap being added to the web site.&lt;br /&gt;&lt;br /&gt;Modify the code in the web.sitemap file to look as shown below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmNycSgwYI/AAAAAAAAAso/WaHeqAIKyOU/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmNycSgwYI/AAAAAAAAAso/WaHeqAIKyOU/s640/2.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Now that we have the web.sitemap file created, let us create a new ASP.NET Web Form and name it as SiteNavigation.aspx. To the newly added web form, add a TreeView and SiteMapDataSource controls to it. Set the ExpandImageUrl and CollapseImageUrl properties of the TreeView control to "Images/closed.gif" and "Images/open.gif" respectively. Then set the DataSourceID property of the TreeView to the ID of the SiteMapDataSource control we added earlier. After modification, the code should look like the following.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmN7bTeEjI/AAAAAAAAAsw/LqoY9PrD_dU/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmN7bTeEjI/AAAAAAAAAsw/LqoY9PrD_dU/s400/3.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When you execute the above code, you will see an output that is somewhat similar to the following screenshot.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmODpMkiDI/AAAAAAAAAs4/2L1M0Jlomm8/s1600-h/041117_01.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmODpMkiDI/AAAAAAAAAs4/2L1M0Jlomm8/s400/041117_01.gif" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The advantage of using the TreeView control with a SiteMapDataSource is that Web site navigation information can be maintained in a central location. The default provider for the SiteMapDataSource control is the XmlSiteMapProvider, which retrieves site navigation information from the web.sitemap file. Note that the web.sitemap file must always appear in the root directory of your ASP.NET application.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #660000;"&gt;Implementing TreeView Data Binding with an XML File&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;In this example, we will bind the TreeView control to an XML file. To accomplish this, you need to go through the following two steps.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;Add an XmlDataSource control to the page and set its DataFile property to the name of the XML File&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Then add a TreeView control and set its DataSourceID property to the ID of the XmlDataSource control.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Then map the nodes and their attributes in the XML file to the TreeView nodes by declaring the asp:TreeNodeBinding elements as part of the TreeView declaration. &lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;For the purposes of this example, let us create an XML file named Categories.xml that looks like the following.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmOXHrE0hI/AAAAAAAAAtA/-n0Gw1xoDv0/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmOXHrE0hI/AAAAAAAAAtA/-n0Gw1xoDv0/s400/4.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Once the XML file is created, create a new Web Form named TreeViewDataBinding.aspx and modify its code to look like the following.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmOg7O1S7I/AAAAAAAAAtI/GHYS7wzujhU/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmOg7O1S7I/AAAAAAAAAtI/GHYS7wzujhU/s400/5.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;The above code listing contains a TreeView control that is bound to an XML file through an XmlDataSource control. This is accomplished by setting the DataSourceID property of the TreeView control to the XmlDataSource control. The TreeView associates properties of individual TreeNode objects to attributes of XML nodes in the hierarchy. When you perform data binding, attributes in the individual XML elements are promoted to properties of the data item. Also note that the TreeView hierarchy exactly matches the hierarchy of the source XML. Because of this, you normally construct the XML specifically for binding to the TreeView.&lt;br /&gt;&lt;br /&gt;Executing the above code results in the following output.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmOnTi9ozI/AAAAAAAAAtQ/OAiX-hfbuKQ/s1600-h/041117_02.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmOnTi9ozI/AAAAAAAAAtQ/OAiX-hfbuKQ/s400/041117_02.gif" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Now that we have understood how to statically bind an XML file to a TreeView control, let us now understand the steps involved in dynamically populating the treeview control with contents from a database.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #660000;"&gt;Dynamically Populating Nodes in the TreeView&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;You will dynamically populate the nodes in the TreeView with data from the database. The first level of nodes will represent master data — in this case, authors. When users click a node, the child nodes for that author will be created by making a query to the database that fetches all the titles for that particular author. For this example, let us create a new web form named DynamicTreeView.aspx and modify its code to look like as shown below. &lt;br /&gt;&lt;br /&gt;The above code consists of two utility methods named FillAuthors and FillTitlesForAuthors, which are used to retrieve the list of authors and the list of titles for a specific author respectively. The FillAuthors method starts by retrieving the connection string from the web.config file by invoking the ConnectionString property of the ConnectionStringSettings class. The connection string is defined in the web.config as shown below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmO1wyJYfI/AAAAAAAAAtY/7i4VbvShaGI/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SzmO1wyJYfI/AAAAAAAAAtY/7i4VbvShaGI/s400/6.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmO7CeFvEI/AAAAAAAAAtg/nP3Z_6gxTSY/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmO7CeFvEI/AAAAAAAAAtg/nP3Z_6gxTSY/s400/7.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmO--56ixI/AAAAAAAAAto/nuymYIBIydE/s1600-h/8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmO--56ixI/AAAAAAAAAto/nuymYIBIydE/s400/8.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPEmRDzcI/AAAAAAAAAtw/Pewb-QCd8Og/s1600-h/9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPEmRDzcI/AAAAAAAAAtw/Pewb-QCd8Og/s400/9.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The above code consists of two utility methods named FillAuthors and FillTitlesForAuthors, which are used to retrieve the list of authors and the list of titles for a specific author respectively. The FillAuthors method starts by retrieving the connection string from the web.config file by invoking the ConnectionString property of the ConnectionStringSettings class. The connection string is defined in the web.config as shown below.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmPTznw7-I/AAAAAAAAAt4/fH3d4iBuwJA/s1600-h/10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SzmPTznw7-I/AAAAAAAAAt4/fH3d4iBuwJA/s400/10.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Once the connection string is retrieved, it then creates an instance of the SqlConnection object passing in the connection string as an argument to its constructor. After that it creates SqlCommand, SqlDataAdapter, and DataSet objects. Then it fills the DataSet object with the results of the sql query execution by invoking the Fill method of the DataSet object. Then the code loops through all the rows contained in the DataTable adding them one at a time to the TreeView control. The implementation of the FillTitlesForAuthors is very similar to the FillAuthors method except that it executes a different query in this case. While constructing the query, it also uses the author id value that is retrieved from the currently selected node.&lt;br /&gt;&lt;br /&gt;Now that we have had a look at the code for the methods, let us look at the declaration of the TreeView control. The TreeView control associates the OnTreeNodePopulate method with an event handler named Node_Populate. The Node_Populate method simply checks the depth of the node and it is 0, it invokes the FillAuthors method and if it is 1, it invokes the FillTitlesForAuthors method. As part of the TreeView declaration, we also set the PopulateOnDemand property of the asp:TreeNode element to true. This property allows you to indicate that the node will be populated dynamically through the code.&lt;br /&gt;&lt;br /&gt;If you execute the above code, you will see the following output.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPbBptfHI/AAAAAAAAAuA/wEzASm6HtCM/s1600-h/041117_03.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPbBptfHI/AAAAAAAAAuA/wEzASm6HtCM/s400/041117_03.gif" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #660000;"&gt;Transforming XML Data and Displaying that Information in a TreeView Control&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;It is also possible for you to transform the XML data before it is displayed by the TreeView control. You can do this by setting the TransformFile property of the XmlDataSource control. This is very useful in scenarios when the original XML structure is not suitable for display through the TreeView control. In that case, you can transform the XML data using XSL and then bind that transformed XML to the TreeView control.&lt;br /&gt;&lt;br /&gt;As with the XML data, you typically load the style sheet from a file, indicated by the TransformFile property, but you can also use it in string form directly using the Transform property.&lt;br /&gt;&lt;br /&gt;For the purposes of this example, we will use the Categories.xml file that we used in our previous example. We will transform the categories.xml file using a Stylesheet named categories.xsl. Code for the categories.xsl file is shown below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPl33qduI/AAAAAAAAAuI/9eHL0QukdN4/s1600-h/11.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPl33qduI/AAAAAAAAAuI/9eHL0QukdN4/s400/11.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Now that we have created the XSL, let us create a new page that exercises the above XSL. To this end, create a new page named TreeViewXmlTransformation.aspx and modify its code to look like the following.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPwIuhmGI/AAAAAAAAAuY/frZ98MbOVvQ/s1600-h/12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SzmPwIuhmGI/AAAAAAAAAuY/frZ98MbOVvQ/s400/12.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;As you can see from the above code, the ValueField and TextField attributes of the asp:TreeNodeBinding element are set to the new XML element names that are produced by the XML. If you execute the above code, you will see an output that is somewhat similar to the following screenshot.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmP3FJC7eI/AAAAAAAAAug/P4YUrLqEHwE/s1600-h/041117_04.gif" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SzmP3FJC7eI/AAAAAAAAAug/P4YUrLqEHwE/s400/041117_04.gif" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;As you can see from the above screenshot, the root node is shown as categories-list, which is produced as a direct result of the XSL transformation.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;In this article, we have understood the features of the new ASP.NET 2.0 TreeView control and how to use that in your web applications. We also demonstrated how to consume the site navigation structure from the web.sitemap and then display that information in a TreeView control. We also discussed the implementation of populating treeview nodes dynamically with the contents from the database. We also understood how to apply XSL transformation on XML data before displaying that information in a TreeView control.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: x-small;"&gt;source : &lt;a href="http://www.15seconds.com/issue/041117.htm"&gt;www.15seconds.com&lt;/a&gt;&lt;/span&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/4414130591562689667-8773004330269891021?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/8773004330269891021/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/aspnet-20-treeview-control.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/8773004330269891021'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/8773004330269891021'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/aspnet-20-treeview-control.html' title='ASP.NET 2.0 TreeView Control'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/SzmLFfk2QBI/AAAAAAAAAsg/4iFXlTpmEDQ/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-3894406032006416208</id><published>2009-12-19T13:44:00.000+05:30</published><updated>2009-12-19T13:47:20.380+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='WCF WPF Interview Questions'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Dot Net'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Samples'/><category scheme='http://www.blogger.com/atom/ns#' term='DOT NET WCF'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Example'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Interview questions'/><category scheme='http://www.blogger.com/atom/ns#' term='Windows Communication Foundation'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF Service'/><title type='text'>WCF Interview questions</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;What is WCF?&lt;/b&gt;&lt;br /&gt;Windows Communication Foundation (WCF) is an SDK for developing and deploying services on Windows. WCF provides a runtime environment for services, enabling you to expose CLR types as services, and to consume other services as CLR types.&lt;br /&gt;&lt;br /&gt;WCF is part of .NET 3.0 and requires .NET 2.0, so it can only run on systems that support it.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is three major points in WCF?&lt;/b&gt;&lt;br /&gt;We Should remember ABC.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Address&lt;/b&gt; --- Specifies the location of the service which will be like http://Myserver/MyService.Clients will use this location to communicate with our service.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Binding&lt;/b&gt; --- Specifies how the two paries will communicate in term of transport and encoding and protocols&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Contract&lt;/b&gt; --- Specifies the interface between client and the server.It's a simple interface with some attribute.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Difference between WCF and Web services?&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Web Services&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;1.It Can be accessed only over HTTP&lt;br /&gt;2.It works in stateless environment&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #4c1130;"&gt;WCF&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;WCF is flexible because its services can be hosted in different types of applications. The following lists several common scenarios for hosting WCF services:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;IIS&lt;br /&gt;WAS&lt;br /&gt;Self-hosting&lt;br /&gt;Managed Windows Service&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What are various ways of hosting WCF Services?&lt;/b&gt;&lt;br /&gt;There are three major ways of hosting a WCF services&lt;br /&gt;&lt;br /&gt;1). Self-hosting the service in his own application domain. This we have already covered in the first section. The service comes in to existence when you create the object of Service Host class and the service closes when you call the Close of the Service Host class.&lt;br /&gt;&lt;br /&gt;2). Host in application domain or process provided by IIS Server.&lt;br /&gt;&lt;br /&gt;3). Host in Application domain and process provided by WAS (Windows Activation Service) Server. &lt;br /&gt;&lt;br /&gt;&lt;b&gt;What was the code name for WCF?&lt;/b&gt;&lt;br /&gt;The code name of WCF was Indigo .&lt;br /&gt;&lt;br /&gt;WCF is a unification of .NET framework communication technologies which unites the following technologies:-&lt;br /&gt;&lt;br /&gt;NET remoting&lt;br /&gt;MSMQ&lt;br /&gt;Web services&lt;br /&gt;COM+&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What are the main components of WCF?&lt;/b&gt;&lt;br /&gt;The main components of WCF are&lt;br /&gt;&lt;br /&gt;1. Service class&lt;br /&gt;2. Hosting environment&lt;br /&gt;3. End point &lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to deal with operation overloading while exposing the WCF services?&lt;/b&gt;&lt;br /&gt;By default overload operations (methods) are not supported in WSDL based operation. However by using Name&amp;nbsp; property of OperationContract&amp;nbsp; attribute, we can deal with operation overloading scenario.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;[ServiceContract]&lt;br /&gt;&lt;br /&gt;interface ICalculator&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; [OperationContract(Name = "AddInt")]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; int Add(int arg1,int arg2);&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; [OperationContract(Name = "AddDouble")]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; double Add(double arg1,double arg2);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is Transport and Message Reliability?&lt;/b&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Transport&lt;/b&gt; reliability (such as the one offered by TCP) offers point-to-point guaranteed delivery at the network packet level, as well as guarantees the order of the packets. Transport reliability is not resilient to dropping network connections and a variety of other communication problems.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Message&lt;/b&gt; reliability deals with reliability at the message level independent of how many packets are required to deliver the message. Message reliability provides for end-to-end guaranteed delivery and order of messages, regardless of how many intermediaries are involved, and how many network hops are required to deliver the message from the client to the service.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is Proxy and how to generate proxy for WCF Services?&lt;/b&gt;&lt;br /&gt;The proxy is a CLR class that exposes a single CLR interface representing the service contract. The proxy provides the same operations as service's contract, but also has additional methods for managing the proxy life cycle and the connection to the service. The proxy completely encapsulates every aspect of the service: its location, its implementation technology and runtime platform, and the communication transport.&lt;br /&gt;&lt;br /&gt;The proxy can be generated using Visual Studio by right clicking Reference and clicking on Add Service Reference. This brings up the Add Service Reference dialog box, where you need to supply the base address of the service (or a base address and a MEX URI) and the namespace to contain the proxy.&lt;br /&gt;&lt;br /&gt;Proxy can also be generated by using SvcUtil.exe command-line utility. We need to provide SvcUtil with the HTTP-GET address or the metadata exchange endpoint address and, optionally, with a proxy filename. The default proxy filename is output.cs but you can also use the /out switch to indicate a different name.&lt;br /&gt;&lt;br /&gt;SvcUtil http://localhost/MyService/MyService.svc /out:Proxy.cs&lt;br /&gt;&lt;br /&gt;When we are hosting in IIS and selecting a port other than port 80 (such as port 88), we must provide that port number as part of the base address:&lt;br /&gt;&lt;br /&gt;SvcUtil http://localhost:88/MyService/MyService.svc /out:Proxy.cs&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What are contracts in WCF?&lt;/b&gt;&lt;br /&gt;In WCF, all services expose contracts. The contract is a platform-neutral and standard way of describing what the service does.&lt;br /&gt;&lt;br /&gt;WCF defines four types of contracts.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Service contracts&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Describe which operations the client can perform on the service.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;There are two types of Service Contracts.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;ServiceContract - This attribute is used to define the Interface.&lt;br /&gt;OperationContract - This attribute is used to define the method inside Interface.&lt;br /&gt;&lt;br /&gt;[ServiceContract]&lt;br /&gt;&lt;br /&gt;interface IMyContract&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; [OperationContract]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; string MyMethod( );&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;class MyService : IMyContract&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; public string MyMethod( )&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return "Hello World";&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Data contracts&lt;/b&gt;&lt;br /&gt;Define which data types are passed to and from the service. WCF defines implicit contracts for built-in types such as int and string, but we can easily define explicit opt-in data contracts for custom types.&lt;br /&gt;&lt;br /&gt;There are two types of Data Contracts.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;DataContract - attribute used to define the class&lt;br /&gt;DataMember - attribute used to define the properties.&lt;br /&gt;&lt;br /&gt;[DataContract]&lt;br /&gt;&lt;br /&gt;class Contact&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp; [DataMember]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; public string FirstName;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; [DataMember]&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp; public string LastName;&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;If DataMember attributes are not specified for a properties in the class, that property can't be passed to-from web service.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Fault contracts&lt;/b&gt;&lt;br /&gt;Define which errors are raised by the service, and how the service handles and propagates errors to its clients.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Message contracts&lt;/b&gt;&lt;br /&gt;Allow the service to interact directly with messages. Message contracts can be typed or untyped, and are useful in interoperability cases and when there is an existing message format we have to comply with.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How to define a service as REST based service in WCF?&lt;/b&gt;&lt;br /&gt;WCF 3.5 provides explicit support for RESTful communication using a new binding named WebHttpBinding.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The below code shows how to expose a RESTful service&lt;br /&gt;&lt;br /&gt;[ServiceContract]&lt;br /&gt;&lt;br /&gt;interface IStock&lt;br /&gt;{&lt;br /&gt;&lt;br /&gt;[OperationContract]&lt;br /&gt;&lt;br /&gt;[WebGet]&lt;br /&gt;&lt;br /&gt;int GetStock(string StockId);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;By adding the WebGetAttribute, we can define a service as REST based service that can be accessible using HTTP GET operation.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Where we can host WCF services?&lt;/b&gt;&lt;br /&gt;Every WCF services must be hosted somewhere. There are three ways of hosting WCF services.&lt;br /&gt;&lt;br /&gt;They are&lt;br /&gt;&lt;br /&gt;1. IIS&lt;br /&gt;2. Self Hosting&lt;br /&gt;3. WAS (Windows Activation Service)&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is address in WCF and how many types of transport schemas are there in WCF?&lt;/b&gt;&lt;br /&gt;Address is a way of letting client know that where a service is located. In WCF, every service is associated with a unique address. This contains the location of the service and transport schemas.&lt;br /&gt;&lt;br /&gt;WCF supports following transport schemas&lt;br /&gt;&lt;br /&gt;HTTP&lt;br /&gt;TCP&lt;br /&gt;Peer network&lt;br /&gt;IPC (Inter-Process Communication over named pipes)&lt;br /&gt;MSMQ &lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is endpoint in WCF?&lt;/b&gt;&lt;br /&gt;Every service must have Address that defines where the service resides, Contract that defines what the service does and a Binding that defines how to communicate with the service. In WCF the relationship between Address, Contract and Binding is called Endpoint.&lt;br /&gt;&lt;br /&gt;The Endpoint is the fusion of Address, Contract and Binding.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is binding and how many types of bindings are there in WCF?&lt;/b&gt;&lt;br /&gt;A binding defines how an endpoint communicates to the world. A binding defines the transport (such as HTTP or TCP) and the encoding being used (such as text or binary). A binding can contain binding elements that specify details like the security mechanisms used to secure messages, or the message pattern used by an endpoint.&lt;br /&gt;&lt;br /&gt;WCF supports nine types of bindings.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Basic binding&lt;/b&gt;&lt;br /&gt;Offered by the BasicHttpBinding class, this is designed to expose a WCF service as a legacy ASMX web service, so that old clients can work with new services. When used by the client, this binding enables new WCF clients to work with old ASMX services.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;TCP binding&lt;/b&gt;&lt;br /&gt;Offered by the NetTcpBinding class, this uses TCP for cross-machine communication on the intranet. It supports a variety of features, including reliability, transactions, and security, and is optimized for WCF-to-WCF communication. As a result, it requires both the client and the service to use WCF.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Peer network binding&lt;/b&gt;&lt;br /&gt;Offered by the NetPeerTcpBinding class, this uses peer networking as a transport. The peer network-enabled client and services all subscribe to the same grid and broadcast messages to it.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;IPC binding&lt;/b&gt;&lt;br /&gt;Offered by the NetNamedPipeBinding class, this uses named pipes as a transport for same-machine communication. It is the most secure binding since it cannot accept calls from outside the machine and it supports a variety of features similar to the TCP binding.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Web Service (WS) binding&lt;/b&gt;&lt;br /&gt;Offered by the WSHttpBinding class, this uses HTTP or HTTPS for transport, and is designed to offer a variety of features such as reliability, transactions, and security over the Internet.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Federated WS binding&lt;/b&gt;&lt;br /&gt;Offered by the WSFederationHttpBinding class, this is a specialization of the WS binding, offering support for federated security.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;Duplex WS binding&lt;/b&gt;&lt;br /&gt;Offered by the WSDualHttpBinding class, this is similar to the WS binding except it also supports bidirectional communication from the service to the client.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;MSMQ binding&lt;/b&gt;&lt;br /&gt;Offered by the NetMsmqBinding class, this uses MSMQ for transport and is designed to offer support for disconnected queued calls.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #4c1130;"&gt;MSMQ integration binding&lt;/b&gt;&lt;br /&gt;Offered by the MsmqIntegrationBinding class, this converts WCF messages to and from MSMQ messages, and is designed to interoperate with legacy MSMQ clients.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;What is service and client in perspective of data communication?&lt;/b&gt;&lt;br /&gt;A service is a unit of functionality exposed to the world.&lt;br /&gt;The client of a service is merely the party consuming the service.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&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/4414130591562689667-3894406032006416208?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/3894406032006416208/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/wcf-interview-questions.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3894406032006416208'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/3894406032006416208'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/wcf-interview-questions.html' title='WCF Interview questions'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-8320179102490818007</id><published>2009-12-07T17:44:00.000+05:30</published><updated>2009-12-07T17:46:37.958+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='View State Hidden Field'/><category scheme='http://www.blogger.com/atom/ns#' term='Use of View State'/><category scheme='http://www.blogger.com/atom/ns#' term='Disable Viewstate in ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='View State ASP NET C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Understanding ASP NET View State'/><category scheme='http://www.blogger.com/atom/ns#' term='Encrypt View State'/><category scheme='http://www.blogger.com/atom/ns#' term='View State Variable'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP NET Session State'/><title type='text'>Understanding View State in ASP.NET</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;What is ViewState and what it is not?&lt;/b&gt;&lt;br /&gt;There are some common misconceptions about ViewState.&amp;nbsp; Let me discuss these points here for the benefit of the readers.&amp;nbsp; ViewState does not hold the controls, rather it holds the values of the form controls and their corresponding ID's that would otherwise be lost due to a post back because they do not post with the form.&amp;nbsp; ViewState is not used to hold session data or to transmit data between pages.&amp;nbsp; ViewState does not recreate the dynamically created controls of a page.&amp;nbsp; It does not restore the values to the controls after a post back operation.&amp;nbsp; Taken aback? Yes, it is true.&amp;nbsp; Even when the ViewState for a control is disabled, still the value would be retained after a post back of the page occurs, for input controls like TextBox or DropDownList.&amp;nbsp; So then, what is ViewState?&amp;nbsp; ViewState represents the state of a page when it was last processed on the web server. It holds the values of a control that has been dynamically changed.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;How does ViewState work?&lt;/b&gt;&lt;br /&gt;All server controls have a property called ViewState.&amp;nbsp; If this is enabled, the ViewState for the control is also enabled.&amp;nbsp; Where and how is ViewState stored?&amp;nbsp; When the page is first created all controls are serialized to the ViewState, which is rendered as a hidden form field named __ViewState.&amp;nbsp; This hidden field corresponds to the server side object known as the ViewState.&amp;nbsp; ViewState for a page is stored as key-value pairs using the System.Web.UI.StateBag object.&amp;nbsp; When a post back occurs, the page de-serializes the ViewState and recreates all controls.&amp;nbsp; The ViewState for the controls in a page is stored as base 64 encoded strings in name - value pairs.&amp;nbsp; When a page is reloaded two methods pertaining to ViewState are called, namely the LoadViewState method and SaveViewState method.&amp;nbsp; The following is the content of the __ViewState hidden field as generated for a page in my system.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxztAFNMFVI/AAAAAAAAAqk/VYVpZk3UvB4/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxztAFNMFVI/AAAAAAAAAqk/VYVpZk3UvB4/s400/1.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Enabling and Disabling ViewState&lt;/b&gt;&lt;br /&gt;By default, ViewState is enabled for all server controls.&amp;nbsp; ViewState can be enabled and disabled in any of the following ways.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Page Level&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Control Level&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Application Level&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Machine Level&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;To enable or disable ViewState in the Page Level, use the following in the Page directive of the ASP.NET page.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxztcntRYzI/AAAAAAAAAqs/Qkko5npcy4k/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxztcntRYzI/AAAAAAAAAqs/Qkko5npcy4k/s400/2.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To enable or disable ViewState at the Control Level, use the following:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/Sxzt1W8VsbI/AAAAAAAAAq0/BH2hb9Wsul0/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/Sxzt1W8VsbI/AAAAAAAAAq0/BH2hb9Wsul0/s400/3.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;To enable or disable ViewState in the Application Level, use the following:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt; &amp;nbsp;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzuAz70OnI/AAAAAAAAAq8/hlFyD2-ivDQ/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzuAz70OnI/AAAAAAAAAq8/hlFyD2-ivDQ/s400/4.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;To enable ViewState in the Machine Level, use the following:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SxzuHi9A86I/AAAAAAAAArE/rGL6x6-T1dU/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SxzuHi9A86I/AAAAAAAAArE/rGL6x6-T1dU/s400/5.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Saving and Restoring Values to and from the ViewState&lt;/b&gt;&lt;br /&gt;ViewState works with the following types.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Primitive types&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Arrays of primitive types&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;ArrayList and Hashtable&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Any other serializable object&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;To add an ArrayList object to the ViewState use the following statements.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxzue4olNvI/AAAAAAAAArM/9vm-pgeOGzA/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxzue4olNvI/AAAAAAAAArM/9vm-pgeOGzA/s400/6.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp; &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;To retrieve the object later use:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SxzuoGCKerI/AAAAAAAAArU/hcfMeTJD3os/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SxzuoGCKerI/AAAAAAAAArU/hcfMeTJD3os/s400/7.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Performance Issues&lt;/b&gt;&lt;br /&gt;The size of the ViewState for a page should be minimal for a better performance in page rendering.&amp;nbsp; Remember that the data in the ViewState makes a round trip and incurs more network bandwidth usage.&amp;nbsp; Therefore, ViewState should always be used judiciously.&amp;nbsp; For pages and controls that do not require a post back at all, set the EnableViewState property of the page or the control of the page to false.&amp;nbsp; It is always preferable to keep the ViewState out of the aspx page for performance improvements of the web application.&amp;nbsp; To accomplish this, the methods SavePageStateToPersistenceMedium and LoadPageStateFromPersistenceMedium can be used.&amp;nbsp; Use the following in the web.config or the machine.config file to disable ViewState for all the pages in a particular application or for all applications.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/Sxzu1J--scI/AAAAAAAAArc/Tf_BOLxkBAY/s1600-h/8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/Sxzu1J--scI/AAAAAAAAArc/Tf_BOLxkBAY/s400/8.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Note that only controls contained within a form tag in the .aspx page can store ViewState.&amp;nbsp; Further, even if ViewState for a page is disabled, still the page itself saves about 20 bytes of information into ViewState to distribute post back data and ViewState values to the correct controls on post back.&amp;nbsp; So, for pages that do not post back at all, remove the runat="server" tag completely for a reduction of the page size by an amount of 20 bytes.&amp;nbsp; This reduction can be substantial for a number of such pages of the application running over the network.&amp;nbsp; ViewState should only be enabled for pages and controls that use it.&amp;nbsp; Avoid using ViewState for controls like the DataGrid and the DataRepeater as the ViewState size for these controls is quite huge.&amp;nbsp; Setting the EnableViewState properties or these controls to false would result in a huge reduction of the size of the rendered html and hence the bandwidth.&lt;br /&gt;&lt;br /&gt;During the testing phases of an application, the ViewState size should be tested.&amp;nbsp; I am giving a code below that can detect the size of the ViewState of a page with ease.&amp;nbsp; I have created a MasterPageBase class that all the other pages in the application need to inherit.&amp;nbsp; The code for the class is as shown below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzvEpodnMI/AAAAAAAAArk/vWO5__0M8Kg/s1600-h/9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzvEpodnMI/AAAAAAAAArk/vWO5__0M8Kg/s400/9.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Security Issues&lt;/b&gt;&lt;br /&gt;For security measures (to ensure that the ViewState is not tampered) one of the following two measures can be adopted.&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Use the EnableViewStateMac property&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Use Encryption of ViewState content&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The EnableViewStateMac property ensures a Machine Authentication Check (MAC).&amp;nbsp; This should be set at the page level or in the application’s web.config file.&amp;nbsp; When set, this property appends a hash code to the ViewState before rendering.&amp;nbsp; Whenever a post back occurs, this hash code is recalculated and checked with the one that is stored in the __ViewState hidden field of the form.&amp;nbsp; It they do not match, the page is rejected, thus ensuring that the ViewState is not tampered.&lt;br /&gt;&lt;br /&gt;To encrypt the contents of the ViewState, use the following in the machine.config file.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzvS23Md4I/AAAAAAAAArs/nBxGdyO8ytc/s1600-h/10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxzvS23Md4I/AAAAAAAAArs/nBxGdyO8ytc/s400/10.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;When to use the ViewState&lt;/b&gt;&lt;br /&gt;View state is a good way to store data in between postbacks, because it doesn't take up any memory on the server side and it doesn't impose any arbitrary usage limits (such as a timeout). So, what might force you to abandon view state for another type of state management? Here are three possible reasons:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;You need to store mission-critical data that the user cannot be allowed to tamper with. (An ingenious user could modify the view state information in a postback request.) In this case, consider session state.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;You need to store information that will be used by multiple pages. In this case, consider session state, cookies, or the query string.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;You need to store an extremely large amount of information, and you don't want to slow down page transmission times. In this case, consider using a database, or possibly session state.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt; &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;ViewState Errors&lt;/b&gt;&lt;br /&gt;There is a common ViewState error that is often encountered when transferring the control from one aspx page to another.&amp;nbsp; Let there be two aspx pages, first.aspx and second.aspx.&amp;nbsp; Let there be a text box and a submit button in the first.aspx page.&amp;nbsp; If we now use the Server.Transfer in the handler for the submit button click event in the first.aspx page to transfer the control from the page first.aspx to the page second.aspx, a ViewState error would occur.&amp;nbsp; This is because the EnableViewStateMac property of the second.aspx page is set to true by default, just as it is in all other aspx pages.&amp;nbsp; This problem can be overcome by setting the property to false in the second.aspx page.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;ASP.NET ViewState is a great feature for web developers.&amp;nbsp; It maintains a state of a page as it moves back and forth. However, when using ViewState one should be well aware of the performance considerations of its usage.&amp;nbsp; It is preferable to enable tracing for a page to know the size of the ViewState for a page in the development cycle of a project.&amp;nbsp; The ViewState size should be optimized well before the application goes to deployment to avoid lengthy operations in the page load cycles of the pages of your application.&lt;br /&gt;&lt;/span&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/4414130591562689667-8320179102490818007?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/8320179102490818007/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/understanding-view-state-in-aspnet.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/8320179102490818007'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/8320179102490818007'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/understanding-view-state-in-aspnet.html' title='Understanding View State in ASP.NET'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/SxztAFNMFVI/AAAAAAAAAqk/VYVpZk3UvB4/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-1995626869984765985</id><published>2009-12-04T15:58:00.000+05:30</published><updated>2009-12-04T16:23:28.283+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='DataPager'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView Example'/><category scheme='http://www.blogger.com/atom/ns#' term='DataPager in ASP.NET 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET 3.5 Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='DataPager Example'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView and DataPager in ASP.NET 3.5'/><category scheme='http://www.blogger.com/atom/ns#' term='ListView in ASP.NET 3.5'/><title type='text'>ASP.NET 3.5 ListView &amp; DataPager</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;ASP. NET 3.5 introduced two new data bound controls ListView &amp;amp; DataPager . ListView Web server control enables us to display&amp;nbsp; the data from a data source and if a DataPager is attached then it enables paging in the&amp;nbsp; ListView.&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;ListView is a data bound control similar to DataList and DataRepeater controls but it provides&amp;nbsp; edit, insert, and delete&amp;nbsp; , sort operations on the&amp;nbsp; data that it bounded&amp;nbsp; like a GridView control. Unlike GridView control ListView gives the user full control over the rendering of the page. using templates and styles(CSS) the user can generate clean HTML UI according to his needs.&lt;br /&gt;&lt;br /&gt;DataPager Web control&amp;nbsp; is used to page data and&amp;nbsp; display navigation controls for data-bound controls that implement the IPageableItemContainer interface.ListView implements the IPageableItemContainer and will use DataPager to support Paging.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjhAe_r1iI/AAAAAAAAAnw/wLT-pSbm8Gc/s1600-h/DataList-Pager-UI.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjhAe_r1iI/AAAAAAAAAnw/wLT-pSbm8Gc/s400/DataList-Pager-UI.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Binding ListView to a DataSource.&lt;/b&gt;&lt;br /&gt;We can use any ASP.NET datasource control&amp;nbsp; to bind to the ListView control by setting the DataSourceID property of the ListView control to the name of the Datasource control.&lt;br /&gt;&lt;br /&gt;This sample is using AccessDataSource&amp;nbsp; control to bind to the ListView control.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjnDOM9IWI/AAAAAAAAAn4/pWn4bLv3vUU/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjnDOM9IWI/AAAAAAAAAn4/pWn4bLv3vUU/s640/1.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;asp:listview datasourceid="AccessDataSource1" id="ListView1" onsorting="ListView1Sorting" runat="server"&gt;&lt;br /&gt;ListView provides built in support for sort functionality. It has a sort event, which can be specified by setting the commandName property of the control, which is part of the ListView control to the 'Sort'. The Sort event supports command argument which can be used to identify which control raised the sort event. The handler for sort event is registered by setting the OnSorting property of the ListView to the handler name.&lt;/asp:listview&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Specifying the Sort Event on the control's&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjnVwWUceI/AAAAAAAAAoA/UsFVdP6j4r8/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjnVwWUceI/AAAAAAAAAoA/UsFVdP6j4r8/s640/2.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;asp:linkbutton commandargument="Body" commandname="Sort" id="LinkButton5" runat="server" text="Body"&gt;&lt;/asp:linkbutton&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;b&gt;Handling the raised sort event&lt;/b&gt;&lt;br /&gt;protected void ListView1Sorting(Object sender, ListViewSortEventArgs e)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; String strImage;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.SortDirection == SortDirection.Ascending)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strImage = "asc.gif";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; strImage = "desc.gif";&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image sortSender = (Image)ListView1.FindControl("Image1");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image sortSubject = (Image)ListView1.FindControl("Image2");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image sortRecdate = (Image)ListView1.FindControl("Image3");&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Image sortBody = (Image)ListView1.FindControl("Image4");&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (e.SortExpression == "From")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.ImageUrl = strImage;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.Visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortRecdate.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (e.SortExpression == "Subject")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.ImageUrl = strImage;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.Visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortRecdate.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (e.SortExpression == "recdate")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.ImageUrl = strImage;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortRecdate.Visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else if (e.SortExpression == "Body")&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.ImageUrl = strImage;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortRecdate.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.Visible = true;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; else&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSender.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortSubject.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortRecdate.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sortBody.Visible = false;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;}&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Specifying ListView Templates&lt;/b&gt;&lt;br /&gt;ListView provides various templates which we can use to display the data. The templates are:&lt;br /&gt;&lt;br /&gt;- LayoutTemplate&lt;br /&gt;&lt;br /&gt;- ItemTemplate&lt;br /&gt;&lt;br /&gt;- ItemSeparatorTemplate&lt;br /&gt;&lt;br /&gt;- GroupTemplate&lt;br /&gt;&lt;br /&gt;- GroupSeparatorTemplate&lt;br /&gt;&lt;br /&gt;- EmptyItemTemplate&lt;br /&gt;&lt;br /&gt;- EmptyDataTemplate&lt;br /&gt;&lt;br /&gt;- SelectedItemTemplate&lt;br /&gt;&lt;br /&gt;- AlternatingItemTemplate&lt;br /&gt;&lt;br /&gt;- EditItemTemplate&lt;br /&gt;&lt;br /&gt;- InsertItemTemplate&lt;br /&gt;&lt;br /&gt;The display hierarchy of the various templates in ListView are shown below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg6D61fpI/AAAAAAAAAnI/dbcP2BFnK3w/s1600-h/DataList-Pager-Hierarchy.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg6D61fpI/AAAAAAAAAnI/dbcP2BFnK3w/s400/DataList-Pager-Hierarchy.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;The main layout of a ListView control is created by defining a LayoutTemplate. The LayoutTemplate will include controls that acts as a placeholder for the data like Table, Panel, Label or HTML controls like table, div, or span elements that have a runat attribute set to "server". Item template is the main template which will show the data bounded to the ListView in a repeated manner. This template typically contains controls that are data-bound to data columns or other individual data elements. These two templates are mandatory.&lt;br /&gt;&lt;br /&gt;GroupTemplate will be used to group the items. The EditItemtemplate, SelectedItemTemplate, InsertItemTemplate are shown at that particular operation like insert, edit, select. ItemSeparatorTemplate, GroupSeparatorTemplate are used to separate the individual items and group Items Separately.&lt;br /&gt;&lt;br /&gt;We will use each template to embed the necessary HTML controls like table, tr, td, div, span or server controls to display the UI according to our needs.&lt;br /&gt;&lt;br /&gt;The following example shows the basic structure of a ListView with mandatory templates...&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjnjAc4h2I/AAAAAAAAAoI/KZkd4eJ9-XQ/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjnjAc4h2I/AAAAAAAAAoI/KZkd4eJ9-XQ/s640/3.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;asp:listview id="ListView1" runat="server"&gt;&amp;nbsp; &lt;layouttemplate&gt;&lt;br /&gt;&lt;/layouttemplate&gt;&lt;/asp:listview&gt;&lt;/span&gt;&lt;br /&gt;&lt;table id="table1" runat="server"&gt;&lt;tbody&gt;&lt;tr id="itemPlaceholder" runat="server"&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; An item placeholder must be specified on ListView. It will be specified in LayoutTemplate or GroupTemplate.&lt;br /&gt;&lt;br /&gt;In order to specify a item placeholder set a control's ID property to "itemPlaceholder". The item placeholder control must also specify runat="server". If you want to provide a different ID, you can specify it using the ItemPlaceholderID attribute of the ListView control.&lt;br /&gt;&lt;br /&gt;If Grouping is used, GroupTemplate will act as place holder for ItemTemplate. In this case a Groupplaceholder must be specified in ListView. An Groupplaceholder can be specified in LayoutTemplate by setting a control's ID property to "groupPlaceholder" or setting the GroupPlaceholderID attribute of the ListView control to a control which is specified in LayoutTemplate.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Example code for setting ID properties of control's to "itemPlaceholder", "groupPlaceholder"&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjn2srKL8I/AAAAAAAAAoQ/r3wSf8Lc_0I/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjn2srKL8I/AAAAAAAAAoQ/r3wSf8Lc_0I/s640/4.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Example code for setting itemPlaceholderID, groupPlaceholderID properties to control's ID's.&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjoChwf1gI/AAAAAAAAAoY/SH-6M1ZSPkA/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjoChwf1gI/AAAAAAAAAoY/SH-6M1ZSPkA/s400/5.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;asp:listview id="ListView1" runat="server"&gt;&lt;/asp:listview&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Preparing the LayoutTemplate for the Email Viewer&lt;/b&gt;&lt;br /&gt;We need to create the LayoutTemplate as shown below using the necessary HTML controls like table, tr, td (with styles) for formatting and the ASP.Net Server Controls (Buttons, LinkButtons, DataPager) for displaying the Headers as well as footers. We need to use a itemplaceholder for displaying the items from data source.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg76_GWvI/AAAAAAAAAnY/MKGJQJZj7wU/s1600-h/DataList-Pager-ItemTemplate.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg76_GWvI/AAAAAAAAAnY/MKGJQJZj7wU/s400/DataList-Pager-ItemTemplate.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjoQSvOrII/AAAAAAAAAog/dabX2ucIJUQ/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjoQSvOrII/AAAAAAAAAog/dabX2ucIJUQ/s400/6.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjolyUstGI/AAAAAAAAAow/JCsKMLo1Cgc/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxjolyUstGI/AAAAAAAAAow/JCsKMLo1Cgc/s400/7.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjojPEBp0I/AAAAAAAAAoo/5QLFj3LVfKU/s1600-h/8.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxjojPEBp0I/AAAAAAAAAoo/5QLFj3LVfKU/s400/8.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Preparing DataPager&lt;/b&gt;&lt;br /&gt;The DataPager control is used to page data and to display navigation controls for data-bound controls that implement the IPageableItemContainer interface.&lt;br /&gt;&lt;br /&gt;A DataPager control can be associated to the data-bound control by using the PagedControlID property. Alternatively, the DataPager control can be placed inside the data-bound control hierarchy.&lt;br /&gt;&lt;br /&gt;DataPager control will display navigation controls by adding the pager fields to the control. DataPager supports following types of pager fields.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #741b47;"&gt;NextPreviousPagerField:&lt;/span&gt; Enables to navigate through pages one page at a time, or to jump to the first or last page. It shows first, prev, next, last buttons. The button type may be of Button, Image, LinkButton.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #741b47;"&gt;NumericPagerField:&lt;/span&gt; enables to navigate through pages by displaying page numbers on the datapager.&lt;br /&gt;&lt;br /&gt;&lt;span style="color: #741b47;"&gt;TemplatePagerField:&lt;/span&gt; we can create custom UI by using TemplatePagerField. We can use Labels, buttons, images to create custom UI as well as programmatic control of the DataPager.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg5acTZzI/AAAAAAAAAnA/exIEFG4NfVc/s1600-h/DataList-Pager-Field.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg5acTZzI/AAAAAAAAAnA/exIEFG4NfVc/s400/DataList-Pager-Field.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;In order to create the DataPager according to the above image we need to use NumericPagerField as well as TemplatePagerField as part of the DataPager Fields. We can use DataPager control's properties like PageSize, TotalRowCount, StartRowIndex to create the TemplatePagerField.&lt;br /&gt;&lt;br /&gt;PageSize gives the no of the pages currently displayed in DataPager.&lt;br /&gt;&lt;br /&gt;TotalRowCount is the no of rows presented in the datasource attached to the DataPager.&lt;br /&gt;&lt;br /&gt;StartRowIndex is the current first row's index in the data source .&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/Sxjo57Gwq5I/AAAAAAAAAo4/QVhNsLTxfSk/s1600-h/9.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/Sxjo57Gwq5I/AAAAAAAAAo4/QVhNsLTxfSk/s400/9.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;asp:datapager id="ItemDataPager" pagedcontrolid="ListView1" pagesize="12" runat="server"&gt;&lt;fields&gt;&lt;asp:nextpreviouspagerfield buttontype="Link"&gt;&lt;asp:templatepagerfield&gt;&lt;pagertemplate&gt;&lt;/pagertemplate&gt;&lt;/asp:templatepagerfield&gt;&lt;/asp:nextpreviouspagerfield&gt;&lt;/fields&gt;&lt;/asp:datapager&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;b&gt;Preparing ItemTemplate &amp;amp; Alternative ItemTemplate&lt;/b&gt;&lt;br /&gt;We need to embed the necessary HTML tags as well as Server controls like checkboxes, labels, buttons in order to get the following look for the ItemTemplates as well as AlternativeItemTemplates. The data will be bounded to the properties of the control's by using inline ASP.Net code &amp;lt;%#Eval("datafieldname")%&amp;gt;, where datafiledname is the column name in the datasoure.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg6jEuCnI/AAAAAAAAAnQ/TIWpwf-BgY4/s1600-h/DataList-Pager-Item.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg6jEuCnI/AAAAAAAAAnQ/TIWpwf-BgY4/s400/DataList-Pager-Item.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;itemtemplate&gt;&lt;/itemtemplate&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SxjpDlKg9TI/AAAAAAAAApA/pDhv08zcrzI/s1600-h/10.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SxjpDlKg9TI/AAAAAAAAApA/pDhv08zcrzI/s400/10.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Preparing EditItemTemplate &amp;amp; InsertItemTemplate&lt;/b&gt;&lt;br /&gt;Similarly we can create EditItemTemplate as well as InsertItemTemplate, but instead of labels we will use TextBoxes like below.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg8tQ-S4I/AAAAAAAAAng/wYglEdLsI0Y/s1600-h/DataList-Pager-Read.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Sxjg8tQ-S4I/AAAAAAAAAng/wYglEdLsI0Y/s400/DataList-Pager-Read.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjpNI_cn0I/AAAAAAAAApI/MgS_Aml-298/s1600-h/11.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjpNI_cn0I/AAAAAAAAApI/MgS_Aml-298/s400/11.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg-xEK3VI/AAAAAAAAAno/TT-kWuEMjC0/s1600-h/DataList-Pager-Send.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/Sxjg-xEK3VI/AAAAAAAAAno/TT-kWuEMjC0/s400/DataList-Pager-Send.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjpSdxDQGI/AAAAAAAAApQ/q4VLaDN0nVE/s1600-h/12.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxjpSdxDQGI/AAAAAAAAApQ/q4VLaDN0nVE/s400/12.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; &lt;insertitemtemplate&gt; &lt;asp:textbox enabled="true" id="tbFrom" runat="server" text="&amp;lt;%#Bind(&amp;quot;From&amp;quot;)%&amp;gt;"&gt; &lt;asp:textbox enabled="true" id="tbSubject" runat="server" text="&amp;lt;%#Bind(&amp;quot;subject&amp;quot;)%&amp;gt;"&gt; &lt;asp:textbox enabled="false" id="tbrecdate" runat="server" text="&amp;lt;%#Bind(&amp;quot;recdate&amp;quot;)%&amp;gt;"&gt; &lt;asp:textbox enabled="true" id="tbBody" runat="server" text="&amp;lt;%#Bind(&amp;quot;Body&amp;quot;)%&amp;gt;"&gt; &lt;asp:button commandname="Insert" id="InsertButton" runat="Server" text="Send"&gt; &lt;/asp:button&gt;&lt;/asp:textbox&gt;&lt;/asp:textbox&gt;&lt;/asp:textbox&gt;&lt;/asp:textbox&gt;&lt;/insertitemtemplate&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;br /&gt;DataPager is nice control for some scenarios, but it should be much better. It looks like DataPager always select complete data source (it just use data source of ListView). That is not efficient, even not acceptable if you have more than 100 pages. In that case it is better to select only page you want to show, instead of selecting all rows from large table. Also, DataPager works only with ListView. It cannot use Repeater or DataList.&lt;/span&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/4414130591562689667-1995626869984765985?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/1995626869984765985/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/aspnet-35-listview-datapager.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/1995626869984765985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/1995626869984765985'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/aspnet-35-listview-datapager.html' title='ASP.NET 3.5 ListView &amp; DataPager'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/SxjhAe_r1iI/AAAAAAAAAnw/wLT-pSbm8Gc/s72-c/DataList-Pager-UI.jpg' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-4464900265246299565</id><published>2009-12-04T10:51:00.000+05:30</published><updated>2009-12-04T15:09:21.694+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='XML Schema'/><category scheme='http://www.blogger.com/atom/ns#' term='Extensible Markup Language'/><category scheme='http://www.blogger.com/atom/ns#' term='XML Parsing'/><category scheme='http://www.blogger.com/atom/ns#' term='XSL'/><category scheme='http://www.blogger.com/atom/ns#' term='XML Example'/><category scheme='http://www.blogger.com/atom/ns#' term='XML Tutorial'/><category scheme='http://www.blogger.com/atom/ns#' term='XML'/><category scheme='http://www.blogger.com/atom/ns#' term='XML Defination'/><category scheme='http://www.blogger.com/atom/ns#' term='What is XML?'/><category scheme='http://www.blogger.com/atom/ns#' term='XSLT'/><title type='text'>XML</title><content type='html'>&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;What is XML ?&lt;/b&gt;&lt;br /&gt;XML stands for eXtensible Markup Language is not really a language but a framework for defining and using markup languages. Markup languages are used for creating units of information called XML documents, which have two standard representations: as a linear text with markup and as a tree data structure.&lt;br /&gt;&lt;br /&gt;A tree is a connected set of nodes and a parent-child relationship defined on them. One special node is called the root. Every node except the root has exactly one parent node, and the root is the only node that doesn’t have a parent.&lt;br /&gt;&lt;br /&gt;Trees are always drawn upside down, with the root on top and leaves at the bottom. If you start from any node that is not a root, go up to its parent, and continue up the tree, sooner or later you get to the root.&lt;br /&gt;&lt;br /&gt;The nodes you encounter along the way are called the ancestors of the node you started from. The root is an ancestor of all nodes in the tree, and all nodes in the tree are its descendants. If node P is the parent of node C, then C is usually called a child of P. Children of the same node are called siblings. Nodes that have no children are called leaves.&lt;br /&gt;&lt;br /&gt;A program that takes a text and checks the correctness of its syntax is called a parser. A parser does not simply return a Boolean answer (“correct” or “not correct”): if the text is grammatically correct, it builds an internal representation of its syntactical structure. Such internal representations are called syntax diagrams. For XML documents (as well as computer programs), syntax diagrams form a tree structure.&lt;br /&gt;&lt;br /&gt;An XML document consists of text data and markup. The markup indicates the syntactical structure of the document.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SxiaTwmfKdI/AAAAAAAAAmo/9yGvO1Rp5Eg/s1600-h/12.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SxiaTwmfKdI/AAAAAAAAAmo/9yGvO1Rp5Eg/s400/12.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;document contains three elements: encounter, greeting, and response. Here is the greeting element.An element consists of a start tag, the element’s content (which can be empty), and an end tag. A start tag minimally consists of the “&amp;lt;” character, a tag name, and the “&amp;gt;” character. The tag name can be followed by attribute declarations. An end tag consists of the character sequence “&lt;br /&gt;&lt;br /&gt;An element consists of a start tag, the element’s content (which can be empty), and an end tag. A start tag minimally consists of the “&amp;lt;” character, a tag name, and the “&amp;gt;” character. The tag name can be followed by attribute declarations. An end tag consists of the character sequence “&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxiaUpxS3ZI/AAAAAAAAAmw/rPIyHktYqcc/s1600-h/13.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxiaUpxS3ZI/AAAAAAAAAmw/rPIyHktYqcc/s400/13.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;What is the tree structure of the document shown . In XML, the parent-child tree relationship corresponds to how elements are nested within each other in the linear text. In our example, encounter properly contains greeting and response; therefore, in the tree, encounter is the parent of greeting and response, whereas greeting and response are children of encounter and siblings to each other. Leaf elements are either empty or contain only text.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxiaV5nudKI/AAAAAAAAAm4/zCHKTeT6Qno/s1600-h/14.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxiaV5nudKI/AAAAAAAAAm4/zCHKTeT6Qno/s400/14.png" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;XML Parsing&lt;/b&gt;&lt;br /&gt;A parser for a programming language knows only that one programming language. to parse a program, the parser has to consult the grammar of the language. But XML parsers are different on both counts. The same parser can do all XML languages, and, to parse a document, the parser does not need to know the grammar of its markup language. A general XML requirement is that the elements of an XML document must form a tree and that the tree structure of elements must be clearly shown in markup.&lt;br /&gt;&lt;br /&gt;Tree conditions must be met in XML parsing is :&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;There must be an element that contains all other elements. This is the root of the element tree.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Start and end tags must be properly nested; overlapping elements are not allowed.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;All elements, including empty elements, must have both the start tag and the end tag.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;All the parser needs to construct the syntactical tree is a stack to push a start tag on and pop it off when the matching end tag is found. If in the end the stack is empty, the document is well formed.&lt;br /&gt;&lt;br /&gt;Procedure :&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Start by creating the root node and make it the current node.&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;When a start tag is encountered, create a child of the current node and make it the current node. Put the start tag name on stack.&lt;/li&gt;&lt;li&gt; When an end tag is encountered, check to see that its tag name is the same as the name on top of the stack. If it is not the same, declare failure and exit. If it is the same, close the current node (that is, pop the tag name off the stack) and make its parent the current node.&lt;/li&gt;&lt;li&gt;If in the end the stack is empty, declare success, and return the tree. If it is not empty, declare failure and exit.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;XML parsers within XML-aware browsers follow this procedure.&lt;br /&gt;&lt;br /&gt;Why Is XML Great ?&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;XML makes it easy to agree on a common language or data format. A common language is the main prerequisite for cooperation.&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li style="font-family: Arial,Helvetica,sans-serif;"&gt;Iit is very easy to switch between the linear text and the syntax tree view of an XML document. XML parsers are standard, high quality, ubiquitous, and free, and they can perform the switch both ways without any loss of significant information.&lt;/li&gt;&lt;li style="font-family: Arial,Helvetica,sans-serif;"&gt;With XML, it is easy to construct networks of cooperating computer programs that receive XML text over the network, parse it into its internal representation, perform some computations on it, convert it back into linear text and send it over the network to another program for further processing.&lt;/li&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;XML is a major enabling technology for cooperation, both between human agents and between computer programs (interoperability).&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;Problems with programming language parsers :&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Parsers for programming languages are difficult to write.&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;The resulting binary objects are parser and platform specific.&lt;/li&gt;&lt;li&gt;Transition from binary to textual form (disassembly) is hard and frequently illegal; certainly, no standard APIs are available for doing that.&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;But simple XML parsers that only check for well-formedness and construct a syntax tree are easy to write, and their output is standard, platform independent, and easy to convert back to linear text form.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&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/4414130591562689667-4464900265246299565?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/4464900265246299565/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/xml.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4464900265246299565'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/4464900265246299565'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/12/xml.html' title='XML'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_CZVCL91-wHo/SxiaTwmfKdI/AAAAAAAAAmo/9yGvO1Rp5Eg/s72-c/12.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-7946610657656330063</id><published>2009-11-28T14:03:00.000+05:30</published><updated>2009-11-28T14:03:33.567+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Reporting Services ASP NET C#'/><category scheme='http://www.blogger.com/atom/ns#' term='C# Reporting Services'/><category scheme='http://www.blogger.com/atom/ns#' term='Integrating Reporting Services With Web Application'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL Server 2005 Reporting Services ASP NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Reporting Services in Web Application'/><title type='text'>Integrating Reporting Services 2005 Into a Web Application</title><content type='html'>&lt;div style="text-align: justify;"&gt;&lt;b&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif;"&gt;Introduction&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Microsoft has made it much easier to integrate its SQL Reporting Services into ASP.NET web applications. Most desired functionality of Reporting Services can be achieved through its ReportViewer control, which is the focus of this article. For those of you who need very fine and detailed customization of embedding RS reports into applications.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Instructions&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Go ahead and start up Visual Studio 2005. Click on the New \ New Website item in the file menu. In the dialog box select the ASP.NET Website, your language preference (C# is used in this article), and where you would like your website to be built. Click on OK.&lt;br /&gt;&lt;br /&gt;One of most difficult tasks in embedding the ReportViewer control is ensuring that it fills 100% of the space you want it to fill, no more, no less. You also want the ReportViewer to use its own scroll bars, not the browser's.&lt;br /&gt;&lt;br /&gt;The code I have written is basically a template that you can use which sets an area for a header, a custom control bar, and the report itself.&lt;br /&gt;&lt;br /&gt;Since the ReportViewer has difficulty taking up 100% of the space in a table (probably not 100% XHTML), you are going need to remove any XHTML settings.&lt;br /&gt;&lt;br /&gt;In the ASP.NET code, you will need to delete (or change) this line:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxDcMJLYLwI/AAAAAAAAAlw/fUdT0SdDUgQ/s1600/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxDcMJLYLwI/AAAAAAAAAlw/fUdT0SdDUgQ/s640/1.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;You may also probably need to change the validation from a non-XHTML setting to a setting such as HTML 4.01.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcSrFrT9I/AAAAAAAAAmg/K-85IbwNp-w/s1600/validation.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcSrFrT9I/AAAAAAAAAmg/K-85IbwNp-w/s400/validation.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;If your target audience will only be using the IE browser, change the body tag so it looks like this:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SxDcNtWu3MI/AAAAAAAAAl4/jnlOlqFfJPc/s1600/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SxDcNtWu3MI/AAAAAAAAAl4/jnlOlqFfJPc/s640/2.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;If any of the users will also using the Mozilla browser, change the body tag so that the height is 99.3%. This is to avoid a double vertical scroll bar effect where you see both the ReportViewer's scroll bar and the browser's scroll bar. There will be an almost unnoticeable space at the bottom of Mozilla browser. Take note, that the contents within the ReportViewer may not display correctly (nor will they in Report Manager). So develop reports for Mozilla at your own risk at this time.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcOGKhrDI/AAAAAAAAAmA/hjEWdek1qKE/s1600/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcOGKhrDI/AAAAAAAAAmA/hjEWdek1qKE/s640/3.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Next go ahead and replace any existing code between the &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;form&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt; tags with the below code:&amp;nbsp;&lt;/span&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxDcPr4hZmI/AAAAAAAAAmI/2wq4BvQE5_A/s1600/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxDcPr4hZmI/AAAAAAAAAmI/2wq4BvQE5_A/s640/4.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Go ahead and switch to the Design view since it is now time to add the ReportViewer control.&lt;br /&gt;&lt;br /&gt;In the Data section within the Toolbox, drag the ReportViewer control onto the last row of your table, which should be taking up most of the page. Next you want to set the control's properties so that it points to the right server and the right report. Under properties, go to the Server Report section. Right above the section you should see a property called ProcessingMode. In most cases you are going to want use an instance of a Report Server. So for the purposes of this tutorial, set this property to Remote, even if the Report Server instance is on the same computer as your web app. Next, you want to set the ServerReport settings.&lt;br /&gt;&lt;br /&gt;First, type in address of the Report server in the ReportSeverUrl field.&lt;br /&gt;&lt;br /&gt;The syntax is: &lt;br /&gt;&lt;br /&gt;http:// NameOfServer / reportserver&lt;br /&gt;&lt;br /&gt;i.e. http://ServerOne/reportserver&lt;br /&gt;&lt;br /&gt;Next type in the location of the report in the ReportPath field.&lt;br /&gt;&lt;br /&gt;i.e. /MyReports/TheReport&lt;br /&gt;&lt;br /&gt;The location is easy to know since it is the same path structure that you see in the Report Manager. Also, always be sure the put a forward slash first before the actual path.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcR_xCGNI/AAAAAAAAAmY/609pVPOkpxM/s1600/properties.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SxDcR_xCGNI/AAAAAAAAAmY/609pVPOkpxM/s400/properties.jpg" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Unless you want the ReportViewer to be an absolute size, go ahead and set the height and width settings under the Layout section to be 100%. The ReportViewer will by default show controls to set the parameters for the report. These often look a little ugly, and I would recommend most developers to create their own parameter controls. This can be done in the control bar row of the template provided above. To get rid of the ReportViewer's parameter controls set the ShowParameterPrompts in the properties underneath Appearance to false.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Those should be all the settings you need to make for the ReportViewer to display correctly, unless your version of Visual Studio has other default settings. Double check to make sure the ASP.NET looks similar to this code:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SxDcQRL6-II/AAAAAAAAAmQ/Hx8way4trFo/s1600/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SxDcQRL6-II/AAAAAAAAAmQ/Hx8way4trFo/s640/5.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;Now, the report is ready to be processed. You can go ahead and preview your website and the report should generate just fine.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Displaying a Report through the C#/VB Code&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;In many cases, you may need to pass parameters to a report or your code (or the end users) may need to have control over which report is generated. For example you may have a Drop-Down-List that lets the user select which report they wish to view. They can then click on a button that generates the report that accepts a parameter for the current time. (The Button and Drop-Down-List can be placed in the custom control bar section of the template.)&lt;br /&gt;&lt;br /&gt;So the code inside the Click-Button-Event-Handler function is where we will need to put in our custom ReportViewer code. The code in this article is C#, but the VB code shouldn't be too much different.&lt;br /&gt;&lt;br /&gt;First, if you didn't set the Report Server Url via the visual designer, you can do it here.&lt;br /&gt;&lt;br /&gt;this.ReportViewer1.ServerReport.ReportServerUrl = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Uri("http://ServerOne/reportserver");&lt;br /&gt;&lt;br /&gt;One problem/bug that is rather common in the ReportViewer control is when you change to a different report via the website itself coming from a drill-through report, an ASP.NET error can occur. This is because the ReportServer is thinking that the new report is still a drill-through when it is not. To get around this problem use the following code:&lt;br /&gt;&lt;br /&gt;while (this.ReportViewer1.ServerReport.IsDrillthroughReport)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.ReportViewer1.PerformBack();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;This code will set whichever report you want to display next to be the parent.&lt;br /&gt;&lt;br /&gt;Next you want to set the new report path:&lt;br /&gt;&lt;br /&gt;// Could also be set to the selection of a ListBox.&lt;br /&gt;&lt;br /&gt;string strReport = "/MyReports/TheReport";&lt;br /&gt;this.ReportViewer1.ServerReport.ReportPath = strReport;&lt;br /&gt;&lt;br /&gt;If parameters are needed, you are going need to first declare an array of ReportParameter objects.&lt;br /&gt;&lt;br /&gt;Microsoft.Reporting.WebForms.ReportParameter[] RptParameters = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Microsoft.Reporting.WebForms.ReportParameter[1];&lt;br /&gt;&lt;br /&gt;In this case, we only need one parameter.&lt;br /&gt;&lt;br /&gt;Next, assign the first index (0) of the RptParameters array to a new ReportParameter object where the constructor function takes the syntax:&lt;br /&gt;&lt;br /&gt;ReportParameter(ReportParameterName, Value);&lt;br /&gt;&lt;br /&gt;i.e.&lt;br /&gt;&lt;br /&gt;string strTime = System.DateTime.Now.ToShortTimeString();&lt;br /&gt;&lt;br /&gt;RptParameters[0] = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Microsoft.Reporting.WebForms.ReportParameter("CurrentTime", strTime);&lt;br /&gt;&lt;br /&gt;Then, you need set the RptParameters object to the ReportViewer control.&lt;br /&gt;&lt;br /&gt;this.ReportViewer1.ServerReport.SetParameters(RptParameters);&lt;br /&gt;&lt;br /&gt;Finally, to put these changes into action, call the Refresh() function:&lt;br /&gt;&lt;br /&gt;this.ReportViewer1.ServerReport.Refresh();&lt;br /&gt;&lt;br /&gt;So in its entirety, the code inside the button-clicked event-handler function should look like this:&lt;br /&gt;&lt;br /&gt;this.ReportViewer1.ServerReport.ReportServerUrl = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new System.Uri("http://serverone/reportserver");&lt;br /&gt;&lt;br /&gt;while(this.ReportViewer1.ServerReport.IsDrillthroughReport)&lt;br /&gt;{&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; this.ReportViewer1.PerformBack();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;// Could also be set to the selection of a ListBox.&lt;br /&gt;&lt;br /&gt;string strReport = "/MyReports/TheReport";&lt;br /&gt;this.ReportViewer1.ServerReport.ReportPath = strReport;&lt;br /&gt;Microsoft.Reporting.WebForms.ReportParameter[] RptParameters = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Microsoft.Reporting.WebForms.ReportParameter[1];&lt;br /&gt;&lt;br /&gt;string strTime = System.DateTime.Now.ToShortTimeString();&lt;br /&gt;RptParameters[0] = &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; new Microsoft.Reporting.WebForms.ReportParameter("CurrentTime", strTime);&lt;br /&gt;&lt;br /&gt;this.ReportViewer1.ServerReport.SetParameters(RptParameters);&lt;br /&gt;this.ReportViewer1.ServerReport.Refresh();&lt;br /&gt;&lt;br /&gt;If you like you can delete the ReportPath from the properties in the visual designer. This will ensure that a report does not load until your own code loads a report itself. However, this will also remove the ReportViewer control bar, which you may wish to keep so that the website looks more structured. What I usually do is set the default ReportPath to point to a report that is basically a welcome screen. From there, the end user can choose parameters from my selection controls, and then when ready, the user can click on a view button that generates the desired report.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;/form&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4414130591562689667-7946610657656330063?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/7946610657656330063/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/integrating-reporting-services-2005.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7946610657656330063'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7946610657656330063'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/integrating-reporting-services-2005.html' title='Integrating Reporting Services 2005 Into a Web Application'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_CZVCL91-wHo/SxDcMJLYLwI/AAAAAAAAAlw/fUdT0SdDUgQ/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-7605988676873409678</id><published>2009-11-23T16:29:00.000+05:30</published><updated>2009-11-23T16:30:18.566+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Comparison for VB.NET and C#'/><category scheme='http://www.blogger.com/atom/ns#' term='VB Net and ASP Net'/><category scheme='http://www.blogger.com/atom/ns#' term='VB Net Object Oriented'/><category scheme='http://www.blogger.com/atom/ns#' term='C Sharp Vb Net'/><category scheme='http://www.blogger.com/atom/ns#' term='Difference Between VB.NET and C#'/><title type='text'>Comparison for VB.NET and C#</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b style="color: #660000;"&gt;Introduction&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;Some people like VB.NET's natural language, case-insensitive approach, others like C#'s terse syntax. But both have access to the same framework libraries. We will discuss about the differences in the following topics:&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #660000;"&gt;Advantages of both languages&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;VB.NET&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Support for optional parameters - very handy for some COM interoperability.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Support for late binding with Option Strict off - type safety at compile time goes out of the window, but legacy libraries which don't have strongly typed interfaces become easier to use.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Support for named indexers.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Various legacy VB functions (provided in the Microsoft.VisualBasic namespace, and can be used by other languages with a reference to the Microsoft.VisualBasic.dll). Many of these can be harmful to performance if used unwisely, however, and many people believe they should be avoided for the most part.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The with construct: it's a matter of debate as to whether this is an advantage or not, but it's certainly a difference.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Simpler (in expression - perhaps more complicated in understanding) event handling, where a method can declare that it handles an event, rather than the handler having to be set up in code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The ability to implement interfaces with methods of different names. (Arguably this makes it harder to find the implementation of an interface, however.)&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Catch ... When ... clauses, which allow exceptions to be filtered based on runtime expressions rather than just by type.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt; The VB.NET parts of Visual Studio .NET compiles your code in the background. While this is considered as an advantage for small projects, people creating very large projects have found that the IDE slows down considerably as the project gets larger.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;XML documentation generated from source code comments. (This is coming in VB.NET with Whidbey (the code name for the next version of Visual Studio and .NET), and there are tools which will do it with existing VB.NET code already.)&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Operator overloading - again, coming to VB.NET in Whidbey.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Language support for unsigned types (you can use them from VB.NET, but they aren't in the language itself). Again, support for these is coming to VB.NET in Whidbey.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The using statement, which makes unmanaged resource disposal simple.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Explicit interface implementation, where an interface which is already implemented in a base class can be re-implemented separately in a derived class. Arguably this makes the class harder to understand, in the same way that member hiding normally does.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Unsafe code. This allows pointer arithmetic etc, and can improve performance in some situations. However, it is not to be used lightly, as a lot of the normal safety of C# is lost (as the name implies). Note that unsafe code is still managed code, i.e., it is compiled to IL, JITted, and run within the CLR.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b style="color: #660000;"&gt;New Features of both languages in 2005 version &lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;VB.NET&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;Visual Basic 2005 has many new and improved language features -- such as inheritance, interfaces, overriding, shared members, and overloading -- that make it a powerful object-oriented programming language. As a Visual Basic developer, you can now create multithreaded, scalable applications using explicit multithreading. This language has following new features,&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Continue Statement, which immediately skips to the next iteration of a Do, For, or While loop.&lt;/span&gt; &lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;IsNot operator, which you can avoid using the Not and Is operators in an awkward order.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Using...End. Using statement block ensures disposal of a system resource when your code leaves the block for any reason.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Public Sub setbigbold(ByVal c As Control)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Using nf As New System.Drawing.Font("Arial",12.0F, FontStyle.Bold)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Font = nf&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; c.Text = "This is 12-point Arial bold"&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Using&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; End Sub&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Explicit Zero Lower Bound on an Array, Visual Basic now permits an array declaration to specify the lower bound (0) of each dimension along with the upper bound.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Unsigned Types, Visual Basic now supports unsigned integer data types (UShort, UInteger, and ULong) as well as the signed type SByte.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Operator Overloading, Visual Basic now allows you to define a standard operator (such as +, &amp;amp;, Not, or Mod) on a class or structure you have defined.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Partial Types, to separate generated code from your authored code into separate source files.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Visual Basic now supports type parameters on generic classes, structures, interfaces, procedures, and delegates. A corresponding type argument specifies at compilation time the data type of one of the elements in the generic type.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Custom Events. You can declare custom events by using the Custom keyword as a modifier for the Event statement. In a custom event, you specify exactly what happens when code adds or removes an event handler to or from the event, or when code raises the event.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Compiler Checking Options, The /nowarn and /warnaserror options provide more control over how warnings are handled. Each one of these compiler options now takes a list of warning IDs as an optional parameter, to specify to which warnings the option applies.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;There are eight new command-line compiler options:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;The /codepage option specifies which codepage to use when opening source files.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /doc option generates an XML documentation file based on comments within your code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /errorreport option provides a convenient way to report a Visual Basic internal compiler error to Microsoft.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /filealign option specifies the size of sections in your output file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /noconfig option causes the compiler to ignore the Vbc.rsp file.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /nostdlib option prevents the import of mscorlib.dll, which defines the entire System namespace.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /platform option specifies the processor to be targeted by the output file, in those situations where it is necessary to explicitly specify it.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;The /unify option suppresses warnings resulting from a mismatch between the versions of directly and indirectly referenced assemblies.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;C#&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;With the release of Visual Studio 2005, the C# language has been updated to version 2.0. This language has following new features:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Generics types are added to the language to enable programmers to achieve a high level of code reuse and enhanced performance for collection classes. Generic types can differ only by arity. Parameters can also be forced to be specific types.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Iterators make it easier to dictate how a for each loop will iterate over a collection's contents.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; // Iterator Example&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; public class NumChar&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string[] saNum = {"One", "Two", "Three","Four", "Five", "Six","Seven", "Eight", "Nine",&amp;nbsp;&amp;nbsp; "Zero"};&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; System.Collections.IEnumerator &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GetEnumerator()&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string num in saNum)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; yield return num;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Create an instance of &lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // the collection class&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NumChar oNumChar = new NumChar();&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // Iterate through it with foreach&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; foreach (string num in oNumChar)&lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Console.WriteLine(num);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Partial type definitions allow a single type, such as a class, to be split into multiple files. The Visual Studio designer uses this feature to separate its generated code from user code.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Nullable types allow a variable to contain a value that is undefined.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Anonymous Method is now possible to pass a block of code as a parameter. Anywhere a delegate is expected, a code block can be used instead: There is no need to define a new method.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; button1.Click += delegate { MessageBox.Show("Click!") };&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;The namespace alias qualifier (::) provides more control over accessing namespace members. The global :: alias allows to access the root namespace that may be hidden by an entity in your code.&lt;/span&gt;&lt;span style="font-size: small;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Static classes are a safe and convenient way of declaring a class containing static methods that cannot be instantiated. In C# v1.2 you would have defined the class constructor as private to prevent the class being instantiated.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;There are eight new compiler options:&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;/langversion option: Can be used to specify compatibility with a specific version of the language.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt; /platform option: Enables you to target IPF (IA64 or Itanium) and AMD64 architectures.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;#pragma warning: Used to disable and enable individual warnings in code.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;/linkresource option: Contains additional options.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;/errorreport option: Can be used to report internal compiler errors to Microsoft over the Internet.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt; /keycontainer and /keyfile: Support specifying cryptographic keys.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b style="color: #660000;"&gt;Conclusion&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;I think that this article will help you understand both language features and also you can choose a language based on your taste.&lt;/span&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/4414130591562689667-7605988676873409678?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/7605988676873409678/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/comparison-for-vbnet-and-c.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7605988676873409678'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/7605988676873409678'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/comparison-for-vbnet-and-c.html' title='Comparison for VB.NET and C#'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-372853225248241852</id><published>2009-11-21T12:10:00.000+05:30</published><updated>2009-11-21T12:12:26.416+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Introduction of Asp.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp.Net Introduction'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='An Overview of ASP.NET'/><title type='text'>ASP.NET INTRODUCTION</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div id="body" style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;div style="color: #990000;"&gt;&lt;b&gt;&lt;span style="font-size: small;"&gt;Introduction&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;&lt;span style="font-size: small;"&gt; &lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Unlike the ASP runtime, ASP.NET uses the Common Language Runtime (CLR) provided by the .NET Framework. The CLR is the .NET runtime, which manages the execution of code. The CLR allows the objects, which are created in different languages, to interact with each other and hence removes the language barrier. CLR thus makes Web application development more efficient.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In addition to simplifying the designing of Web applications, the .NET CLR offers many advantages. Some of these advantages are listed as follows.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;1). Improved performance&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The ASP.NET code is a compiled CLR code instead of an interpreted code. The CLR provides just-in-time compilation, native optimization, and caching. Here, it is important to note that compilation is a two-stage process in the .NET Framework. First, the code is compiled into&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;the Microsoft Intermediate Language (MSIL).&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Then, at the execution time, the MSIL is compiled into native code. Only the portions of the code that are actually needed will be compiled into native code. This is called Just In Time compilation. These features lead to an overall improved performance of ASP.NET applications.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2). Flexibility&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The entire .NET class library can be accessed by ASP.NET applications. You can use the language that best applies to the type of functionality you want to implement, because ASP.NET is language independent.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;3). Configuration settings&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;The application-level configuration settings are stored in an Extensible Markup Language (XML) format. The XML format is a hierarchical text format, which is easy to read and write. This format makes it easy to apply new settings to applications without the aid of any local administration tools.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;4). Security&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;ASP.NET applications are secure and use a set of default authorization and authentication schemes. However, you can modify these schemes according to the security needs of an application.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In addition to this list of advantages, the ASP.NET framework makes it easy to migrate from ASP applications.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #990000;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Creating an ASP.NET Application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;1).Use a text editor&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In this method, you can write the code in a text editor, such as Notepad, and save the code as an ASPX file. You can save the ASPX file in the directory C:inetpubwwwroot. Then, to display the output of the Web page in Internet Explorer, you simply need to type http://localhost/&lt;filename&gt;.aspx in the Address box. If the IIS server is installed on some other machine on the network, replace "localhost" with the name of the server. If you save the file in some other directory, you need to add the file to a virtual directory in the Default &lt;/filename&gt;WebSite directory on the IIS server. You can also create your own virtual directory and add the file to it.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;2).Use the VS.NET IDE&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;In this method, you use the IDE of Visual Studio .NET to create a Web page in a WYSIWYG manner. Also, when you create a Web application, the application is automatically created on a Web server (IIS server). You do not need to create a separate virtual directory on the IIS server.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;From the preceding discussion, it is obvious that the development of ASP.NET Web applications is much more convenient and efficient in Visual Studio .NET.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;ASP.NET Web pages consist of HTML text and the code. The HTML text and the code can be separated in two different files. You can write the code in Visual Basic or C# . This separate file is called the code behind file. In this section, you'll create simple Web pages by using VB as well as C#.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Before you start creating a Web page, you should be familiar with basic ASP.NET syntax. At the top of the page, you must specify an @ Page directive to define page specific attributes, such as language.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;To specify the language as VB for any code output to be rendered on the page.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;This line indicates that any code in the block, &amp;lt;% %&amp;gt;, on the page is compiled by using VB.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;To render the output on your page, you can use the Response.Write() method.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Creating a Visual Basic Web Application&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;You can create an ASP.NET application using Visual Basic by creating a Visual Basic&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;Web Application project.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-size: small;"&gt;To do so, complete the following steps:&lt;/span&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Select File ® New ® Project. The New Project dialog box appears.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Select Visual Basic Projects from the Project Types pane.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Select ASP.NET Web Application from the Templates pane.&amp;nbsp;&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size: small;"&gt;The Name box contains a default name of the application. The Location box contains the name of a Web server where the application will be created. However, you can change the default name and location. In this case, the name of the sample application is SampleVB.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div id="body" style="text-align: justify;"&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #990000; font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Deploying an ASP.NET Web Application&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;After creating and testing your ASP.NET Web applications, the next step is deployment.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;Deployment is the process of distributing the finished applications (without the source code) to be installed on other computers.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;In Visual Studio .NET, the deployment mechanism is the same irrespective of the programming language and tools used to create applications. In this section, you'll deploy the "Hello World" Web application that you created. You can deploy any of the application that was created by using VB or C#. Here, you'll deploy the application created by using VB.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;To do so, follow these steps:&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Open the Web application project that you want to deploy. In this case, open the SampleVB project.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Select File ® Add Project ® New Project to open the Add New Project dialog box.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;From the Project Types pane, select Setup and Deployment Projects.From the Templates pane, select Web Setup Project.&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Change the default name of the project. In this case, change it to "SampleVBDeploy."&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;Click OK to complete the process. The project is added in the Solution Explorer window.&lt;/span&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="color: #990000;"&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&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/4414130591562689667-372853225248241852?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/372853225248241852/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/aspnet-introduction.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/372853225248241852'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/372853225248241852'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/11/aspnet-introduction.html' title='ASP.NET INTRODUCTION'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-5901420725937185772</id><published>2009-10-06T12:25:00.000+05:30</published><updated>2009-10-06T12:31:40.147+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Reading Email Address'/><category scheme='http://www.blogger.com/atom/ns#' term='Reading Address Book'/><category scheme='http://www.blogger.com/atom/ns#' term='Address Book Scripts'/><category scheme='http://www.blogger.com/atom/ns#' term='Reading Contacts'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX'/><category scheme='http://www.blogger.com/atom/ns#' term='Imap Address Book'/><category scheme='http://www.blogger.com/atom/ns#' term='Email'/><category scheme='http://www.blogger.com/atom/ns#' term='Email Reading'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.Net'/><category scheme='http://www.blogger.com/atom/ns#' term='Contacts'/><title type='text'>Reading Address Book from Yahoo, Gmail, MSN</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;When we are developing a scoal networking websites or Some Referal websites, when the user registration completed then we have to provide an interface to invite the registerd user friends. For this purpose we have to provide option to get AddressBook from various Email Providers.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SsroZtrlAfI/AAAAAAAAAjc/N80gVRmDh2s/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SsroZtrlAfI/AAAAAAAAAjc/N80gVRmDh2s/s400/1.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Here I am taking some popular Email Providers like Yahoo, Google, MSN, In order to Read the Address book of Yahoo, Google, MSN we have access the API which provided by them itself.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Few days before I download one dll from net. Its provided by Ideabubling. It contains all API of Yahoo,Google, MSN which is ready to use. Here In this application I use the dll.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;The Core Functionality is, when user provides Email Address and Password, If these details are valid then we will call getContact method and these details are stored in DataTable. You can see the sample code here.. &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="-moz-background-clip: -moz-initial; -moz-background-inline-policy: -moz-initial; -moz-background-origin: -moz-initial; background: white none repeat scroll 0% 0%; border: 1px solid black; color: black; font-family: Arial,Helvetica,sans-serif; overflow: scroll; white-space: nowrap;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;DataTable dtContatct = new DataTable();&lt;br /&gt;&lt;br /&gt;MailType mt = FindTheMailType();&lt;br /&gt;&lt;br /&gt;MailClient.GetContacts(mt, strUserid, strPassword, out boolIsOK, out dtContatct, out strError);&lt;br /&gt;&lt;br /&gt;dtContatct = MailClient.GetFormat(mt, dtContatct);&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Here “mt” is the mail type. It will check what type of Email Address It is. Either Yahoo, Gmail, etc.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;Then this DataTable is binded with GridView, so that User can able to see his contcats and he can select some of the or all to send a mail.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;You can see the Screen Shot..&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SsrlCp7eKpI/AAAAAAAAAjU/3IRfoHPnVtQ/s1600-h/conatct3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SsrlCp7eKpI/AAAAAAAAAjU/3IRfoHPnVtQ/s400/conatct3.png" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;Download Complete Application.. &lt;b&gt;&lt;a href="http://www.4shared.com/file/62826389/b198ff/ContactReader.html"&gt;Click Here..! &lt;/a&gt;&lt;/b&gt;&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: left;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="color: black;"&gt;&lt;span style="font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;br /&gt;&lt;/span&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/4414130591562689667-5901420725937185772?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/5901420725937185772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/10/reading-address-book-from-yahoo-gmail.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/5901420725937185772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/5901420725937185772'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/10/reading-address-book-from-yahoo-gmail.html' title='Reading Address Book from Yahoo, Gmail, MSN'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_CZVCL91-wHo/SsroZtrlAfI/AAAAAAAAAjc/N80gVRmDh2s/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-2678147797388322386</id><published>2009-09-24T17:46:00.000+05:30</published><updated>2009-09-24T17:46:15.487+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Ajax ToggleButton Control Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net Ajax Extender Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='Discovering Ajax Extender Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Control Toolkit Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax TextBoxWatermark Control Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Tab Control Extender'/><title type='text'>Tab Control Extender, TextBoxWatermark Control Extender, ToggleButton Control Extender</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b style="color: #741b47;"&gt;1). Tab Control Extender&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;AJAX Tab Control Extender also belongs to ASP.Net AJAX Control toolkit library provided by Microsoft’s official open source community. AJAX Tab control extender provides the functionality to display the multiple things on a single web page in the form of tabs. AJAX Tab control extender is a set of two types of toolkit controls: one is AJAX TabContainer and other is TabPanel. AJAX TabContainer extender control holds the set of TabPanel to create a set of tabs along with their related content. AJAX TabPanel further provides two types of Templates to create the tabs and their content. HeaderTemplate of AJAX TabPanel creates the tab with specified text as its heading and ContentTemplate creates the content view for the associated TabPanel.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ASP.Net AJAX Tab Extender Control Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CssClass:&lt;/b&gt; accepts the name of CSS class that could override the styles of default CSS class styles to display the AJAX Tabs. You can customize the look and feel of Tabs using CssClass property.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Height:&lt;/b&gt; sets the height of AJAX Tab Container excluding the Tabs section.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Width:&lt;/b&gt; sets the width of AJAX Tab Container. It sets the width of body section of the AJAX TabContainer containing content.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ScrollBars:&lt;/b&gt; Accepts the different types of values to display the scrollbars. ScrollBars property of AJAX Tab Extender control supports the following set of values:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;Auto&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;Both&lt;/li&gt;&lt;li&gt;Horizontal&lt;/li&gt;&lt;li&gt;None&lt;/li&gt;&lt;li&gt;Vertical&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;onClientActiveTabChanged:&lt;/b&gt; Accepts the name of a client-side javascript function to fire it for tabChanged client-side event.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;onActiveTabChanged:&lt;/b&gt; This event executes at server side when postback occurs after tab changed event.&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;OnClientClick:&lt;/b&gt; Accepts the name of a client-side javascript function to fire it for onclick client-side event for tabs.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HeaderText:&lt;/b&gt; Sets the text to be displayed on Tabs.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HeaderTemplate:&lt;/b&gt; Header template provides a container for AJAX TabPanel to render the Tab with specified text.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ContentTemplate:&lt;/b&gt; Content template provides a container for AJAX TabPanel to render the content body with specified text.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;HTML Code for ASP.Net AJAX Tab Control Extender&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/Srtg173zGjI/AAAAAAAAAik/W6k6ehBTiKU/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/Srtg173zGjI/AAAAAAAAAik/W6k6ehBTiKU/s400/1.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;Tab Extender CSS Class Styles&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;You can change the look and feel of ASP.Net AJAX Tab extender control by overriding the CSS class names and styles. AJAX Control Toolkit has a predefined set of CSS class styles specially created for different sections of AJAX Tab extender control e.g.: active tab style, style for on mouse over state (hover), inactive style etc. Each state of Tab extender has been associated with CSS class styles in AJAX Control Toolkit that can be used for customizing the theme of AJAX Tabs control. While working with AJAX Tab extender control if you will not apply any CssClass style to it then it will render the Tabs with default CSS rules and styles.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Default Look of AJAX Tab Extender Control&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/Srtg8EhdRkI/AAAAAAAAAjE/pu3_rM0rTCg/s1600-h/image.axd" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/Srtg8EhdRkI/AAAAAAAAAjE/pu3_rM0rTCg/s400/image.axd" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;CSS Class Names for ASP.Net AJAX Tab Extender Control&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_header:&lt;/b&gt; this CSS class has been associated with tab header container of AJAX TabContainer that wraps all the tabs at the top.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_outer:&lt;/b&gt; this CSS class controls the style of left edge of a tab.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_inner:&lt;/b&gt; this CSS class controls the style of right edge of a tab.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_tab:&lt;/b&gt; it applies the style to the center portion of a tab containing the text.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_hover:&lt;/b&gt; this CSS class applies its styles while mouse over state of a tab.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_active:&lt;/b&gt; this CSS class applies its styles on the currently selected tab.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;.ajax__tab_body:&lt;/b&gt; it applies the CSS styles on the TabPanel content container associated with each tab.&lt;br /&gt;&lt;br /&gt;&lt;b style="color: #741b47;"&gt;2). TextBoxWatermark Control Extender&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The TextBoxWatermark extender control of ASP.Net 2.0 AJAX control toolkit is attached to the Textbox server control of ASP.Net. TextboxWatermark extender control is managed by CSS styles to display the watermarked message inside the Textbox control. TextBoxWatermark control allows you to display the Hint inside the user input fields i.e. Textbox that disappears as soon as the user sets focus into the Textbox. You can pass the Hint Text that you want to display inside the Textbox control. TexboxWatermark extender control is very easy to use due to its very few properties to provide the desired functionality.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TextboxWatermarkExtender Control Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TargetControlID:&lt;/b&gt; ID of Textbox control in which watermarked text will appear.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WatermarkText:&lt;/b&gt; Text that will appear inside the associated Textbox control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WatermarkCssClass:&lt;/b&gt; CSS class name that will adjust the style, look and feel of watermarked Textbox.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;Sample Code for TextboxWatermarkExtender Control&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/Srtg3aNHYXI/AAAAAAAAAis/4MuS9AwstBg/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/Srtg3aNHYXI/AAAAAAAAAis/4MuS9AwstBg/s400/2.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;b&gt;&amp;nbsp;&lt;/b&gt;&lt;br /&gt;&lt;b style="color: #741b47;"&gt;3). ToggleButton Control Extender&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;ToggleButton AJAX extender control provides the functionality to use the ASP.Net 2.0 checkbox with new look. Custom images hide the checkboxes with images to show the checked and unchecked state of the attached checkbox control. You can specify the image URL for each different state of the checkbox control e.g.: checked and unchecked state of checkbox when its enabled property is true, checked and unchecked state of checkbox when its enabled property is false.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AJAX ToggleButton Control Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TargetControlID:&lt;/b&gt; ID of the checkbox control to attach it with AJAX toggle button extender control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CheckedImageUrl:&lt;/b&gt; URL of the image to display as the checked state of toggle button checkbox control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UncheckedImageUrl:&lt;/b&gt; URL of the image to display the unchecked state of target togglebutton checkbox control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CheckedImageOverUrl:&lt;/b&gt; URL of the image for mouse over event when the attached togglebutton checkbox control is in checked state.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UncheckedImageOverUrl:&lt;/b&gt; URL of the image for mouse over event when the attached togglebutton checkbox control is in unchecked state.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;DisabledCheckedImageUrl:&lt;/b&gt; URL of the image to display the checked state of the associated togglebutton checkbox control when its Enable property is false.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;DisabledUncheckedImageUrl:&lt;/b&gt; URL of the image to display the unchecked state of the togglebutton checkbox control when its Enable property is false.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CheckedImageAlternateText:&lt;/b&gt; Alt text attribute for the checked image, when togglebutton is in the checked state.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;UncheckedAlternateText:&lt;/b&gt; Alt text attribute for the unchecked image, when togglebutton is in the unchecked state.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ImageHeight/ImageWidth:&lt;/b&gt; Height and width of the images used for displaying the states of togglebutton checkbox.&lt;br /&gt;&lt;br /&gt;Sample Code for ToggleButton Control Extender&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/Srtg5EDu-NI/AAAAAAAAAi0/bEbnLPm86do/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/Srtg5EDu-NI/AAAAAAAAAi0/bEbnLPm86do/s400/3.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&amp;nbsp;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/Srtg6mBiwpI/AAAAAAAAAi8/N1z_CZqi9-o/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/Srtg6mBiwpI/AAAAAAAAAi8/N1z_CZqi9-o/s400/4.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="color: #990000; font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;span style="font-size: small;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt; &lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&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/4414130591562689667-2678147797388322386?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/2678147797388322386/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/09/tab-control-extender-textboxwatermark.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2678147797388322386'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/2678147797388322386'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/09/tab-control-extender-textboxwatermark.html' title='Tab Control Extender, TextBoxWatermark Control Extender, ToggleButton Control Extender'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_CZVCL91-wHo/Srtg173zGjI/AAAAAAAAAik/W6k6ehBTiKU/s72-c/1.JPG' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-5433938236531324556</id><published>2009-09-24T11:19:00.000+05:30</published><updated>2009-09-24T11:19:15.322+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='Asp Net Ajax Extender Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax RoundedCorners Control Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Slider Control Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Star Rating Extender Control'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Extender Controls'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Slideshow Extender Control'/><title type='text'>RoundedCorners Control Extender, Slider Control Extender, Slideshow Extender Control, Star Rating Extender Control</title><content type='html'>&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;/span&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;&lt;span style="color: #741b47;"&gt;1). RoundedCorners Control Extender&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The AJAX RoundedCorners extender control displays the targeting Panel with round shaped edges. You can set the color of the edges same as the background color of the associated Panel control. RoundedCornersExtender also provides the feature to set the edges with alternate styles such as round corners for BottomLeft, TopLeft etc.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AJAX RoundedCornersExtender Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TargetControlID:&lt;/b&gt; ID of the target Panel Control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Radius:&lt;/b&gt; Radius of the round edges of the targeting Panel control. Default value is 5. Greater value for Radius property generates the broader round corners.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Color:&lt;/b&gt; Adjusts the color of the corners associated with extender.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Corners:&lt;/b&gt; This property provides the combinations for the corners of the associated Panel. Following are the different combinations or values for Corners property that generates the round edges at the specified value for this property:&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size: small;"&gt;All&lt;/span&gt;&amp;nbsp;&lt;/li&gt;&lt;li&gt;Bottom&lt;/li&gt;&lt;li&gt;BottomLeft&lt;/li&gt;&lt;li&gt;BottomRight&lt;/li&gt;&lt;li&gt;Left&lt;/li&gt;&lt;li&gt;None&lt;/li&gt;&lt;li&gt;Right&lt;/li&gt;&lt;li&gt;Top&lt;/li&gt;&lt;li&gt;TopLeft&lt;/li&gt;&lt;li&gt;TopRight&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;b&gt;Sample Code for AJAX RoundedCornersExtender Control&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;/span&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCkRp1sdI/AAAAAAAAAg8/8ULzQ1S6yFw/s1600-h/1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCkRp1sdI/AAAAAAAAAg8/8ULzQ1S6yFw/s400/1.JPG" /&gt;&lt;/a&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCmPikHCI/AAAAAAAAAhE/pAumntBDJ1A/s1600-h/2.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCmPikHCI/AAAAAAAAAhE/pAumntBDJ1A/s400/2.JPG" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When I use Corners property "All" then&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCzzxRjdI/AAAAAAAAAh8/xT7yV_uLL_4/s1600-h/roundcornerAllsmall.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCzzxRjdI/AAAAAAAAAh8/xT7yV_uLL_4/s400/roundcornerAllsmall.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;span id="goog_1253769309376"&gt;&lt;/span&gt;&lt;span id="goog_1253769309377"&gt;&lt;/span&gt;&lt;br /&gt;When I use Corners property ="Bottom" then&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SrsC2odxIdI/AAAAAAAAAiE/eDPFrthOZOM/s1600-h/roundcornerBottomsmall.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SrsC2odxIdI/AAAAAAAAAiE/eDPFrthOZOM/s400/roundcornerBottomsmall.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When I use Corners property ="Left" then&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://1.bp.blogspot.com/_CZVCL91-wHo/SrsC4rdhtUI/AAAAAAAAAiM/uiox-tR1M0s/s1600-h/roundcornerLeftsmall.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SrsC4rdhtUI/AAAAAAAAAiM/uiox-tR1M0s/s400/roundcornerLeftsmall.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;When I use Corners property ="Right" then&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsC6Dno58I/AAAAAAAAAiU/0uBzkKnaLwE/s1600-h/roundcornerritesmall.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsC6Dno58I/AAAAAAAAAiU/0uBzkKnaLwE/s400/roundcornerritesmall.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;&lt;span style="color: #741b47;"&gt;2). Slider Control Extender&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;The AJAX Slider extender control provides the functionality of slider bar rider that targets the ASP.Net 2.0 Textbox server control. It gets and sets the property of attached asp:textbox control that changes the position of slide extender control as well.&lt;br /&gt;&lt;br /&gt;AJAX Slider control also displays the current position value in other textbox or label control if its ID is passed into the BoundControlID property of the Slider extender control. You can also specify the orientation of slider control as horizontal or vertical. Just define the maximum and minimum value for the AJAX slider extender it moves to and fro and changes the return value.&lt;br /&gt;&lt;br /&gt;Precision point can also be specified if you want decimal point values using the slider control position.&lt;br /&gt;&lt;br /&gt;Slider moves on the slider rail with a smooth moving effect it its animation property is set enabled. Default values for the slider extender are 0 to 100; if user does not specify these values then slider extender control uses the default set. You can also display the tool tip of slider control using {0} string format that dynamically changes the tool tip value according to the current position of the AJAX slider extender control.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;AJAX Slider Extender Control Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TargetControlID:&lt;/b&gt; ID of the target textbox control, it stores the position state of slider extender control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;BoundControlID:&lt;/b&gt; ID of the textbox or label control, to display the current position value of slider control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Decimals:&lt;/b&gt; number of precision point places required after decimal point.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Maximum:&lt;/b&gt; maximum value for the slider extender control position.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Minimum:&lt;/b&gt; minimum value for the slider control position.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Length:&lt;/b&gt; Height or width of the slider control according to the orientation of extender.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Steps:&lt;/b&gt; Number step division to cover the complete slider rail path.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;EnableHandleAnimation:&lt;/b&gt; to enable or disable the animated movement feature of slider extender control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Orientation:&lt;/b&gt; Changes the direction of slider rail to Horizontal or Vertical direction.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TooltipText:&lt;/b&gt; It displays the text as tooltip for mouse hover action. You can use {0} placeholder to display the current value of the slider extender control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample Code for AJAX Slider Extender Control&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCnXMnM8I/AAAAAAAAAhM/6LvC0SL6kDE/s1600-h/3.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCnXMnM8I/AAAAAAAAAhM/6LvC0SL6kDE/s400/3.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b style="color: #741b47;"&gt;3). Slideshow Extender Control&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;ASP.Net 2.0 AJAX Slideshow extender is becoming popular these days due to its feature to display the set of images in the form of powerpoint slideshow style. AJAX SlideShow extender takes the ID of image control of ASP.Net 2.0 to display the images in it according to the time interval fixed for it. You can also specify the auto start event to change the images in SlideShow extender when the page loads. Also you can enable the loop to run the SlideShow in continuous manner that loads the first image again after displaying the last image and plays the SlideShow repeatedly.&lt;br /&gt;&lt;br /&gt;The AJAX SlideShow extender also has features to associate Label and Button controls of ASP.Net 2.0 to display the Image Name, Description and button controls to stop/play or viewing the next and previous image in the slide show. Associated button controls allow the users to stop the automated running Slide show and view the images manually by using next/ previous buttons.&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b&gt;AJAX SlideShowExtender Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;TargetControlID:&lt;/b&gt; ID of the Image control to display the images of SlideShow program.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AutoPlay:&lt;/b&gt; Enables the feature to start to SlideShow automatically when page loads.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ImageTitleLabelID:&lt;/b&gt; ID of the Label control to display the Title/Name of the image.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ImageDescriptionLabelID:&lt;/b&gt; ID of the Label control to display the Description of the image.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NextButtonID:&lt;/b&gt; ID of the Button control to view the next image.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PlayButtonID:&lt;/b&gt; ID of the Button to play the SlideShow. Play Button performs the two functions. When user clicks on play button it plays the slide show and changes the text of the Play Button according to the property of AJAX SlideShow extender StopButtonText. When user again clicks on the PlayButton it stops the SlideShow.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PlayButtonText:&lt;/b&gt; Text to be displayed on the PlayButton e.g.: Play&lt;br /&gt;&lt;br /&gt;&lt;b&gt;StopButtonText:&lt;/b&gt; Text to be displayed on the PlayButton to stop the SlideShow. By Default PlayButton displays the PlayButtonText when user clicks the PlayButton to view the Slide Show then its Text changes to StopButtonText.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;PreviousButtonID:&lt;/b&gt; ID of the Button to view the previous image.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Loop:&lt;/b&gt; If Loop is set to true then it plays the SlideShow in repeat/continuous order.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;SlideShowServiceMethod:&lt;/b&gt; Name of the page script web service method to pass the array of Slide Show images.&lt;br /&gt;&lt;br /&gt;You can use any method name for WebMethod but its return type should be of AjaxControlToolkit.Slide[].&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SrsCphHrWuI/AAAAAAAAAhU/71olyVIMI2g/s1600-h/4.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SrsCphHrWuI/AAAAAAAAAhU/71olyVIMI2g/s400/4.JPG" /&gt;&lt;/a&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCsHEOiJI/AAAAAAAAAhc/mLnoPtySL_0/s1600-h/5.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCsHEOiJI/AAAAAAAAAhc/mLnoPtySL_0/s400/5.JPG" /&gt;&lt;/a&gt;&lt;a href="http://3.bp.blogspot.com/_CZVCL91-wHo/SrsCuT70hoI/AAAAAAAAAhk/S6upzAw_nE4/s1600-h/6.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SrsCuT70hoI/AAAAAAAAAhk/S6upzAw_nE4/s400/6.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;span id="goog_1253769309398"&gt;&lt;/span&gt;&lt;span id="goog_1253769309399"&gt;&lt;/span&gt;Output: when you run this application you will get the following result and image will be change automatically&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCxo5S45I/AAAAAAAAAh0/MvmY1PS-Hvw/s1600-h/Image1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/_CZVCL91-wHo/SrsCxo5S45I/AAAAAAAAAh0/MvmY1PS-Hvw/s400/Image1.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;br /&gt;&lt;b style="background-color: #741b47; color: #741b47;"&gt;&lt;/b&gt;&lt;b style="color: #741b47;"&gt;4). Star Rating Extender Control&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;ASP.Net AJAX star rating extender control provides the functionality to rate the items such as pictures, articles or stories published on ASP.Net web pages. AJAX star rating control is very commonly used on community based ASP.Net web sites that allow the users to express their interest and satisfaction towards the associated item in terms of number of stars he/she gives to it using rating control. You can customize the look and feel of ASP.Net AJAX rating extender control using CSS styles. You can also adjust the behavior and display type of AJAX rating control using its different types of properties such as RatingAlign, RatingDirection, CurrentRating, Direction, HorizontalAlign etc. CSS styles based properties of AJAX star rating extender control allows you to set the CSS class styles to customize the different states of rating control e.g.: filled, saved and empty.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ASP.Net AJAX Star Rating Control Properties&lt;/b&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;CurrentRating:&lt;/b&gt; this property allows setting the default rating value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;MaxRating:&lt;/b&gt; Maximum value for rating that user can set using AJAX rating extender control. Default is 5&lt;br /&gt;&lt;br /&gt;&lt;b&gt;AutoPostBack:&lt;/b&gt; to allow the web page postback when user clicks the rating item.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;ReadOnly:&lt;/b&gt; to enable or disable the rating control. If true then user can rate the items else not.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;RatingAlign:&lt;/b&gt; this property supports two types of values: Horizontal, Vertical. By default it works with Horizontal alignment. This property changes the orientation of rating control whether to display the rating items vertically or horizontally.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;RatingDirection:&lt;/b&gt; this property also supports two types of values: LeftToRightTopToBottom and RightToLeftBottomToTop. Rating direction property changes the way, how a user can set the value for rating. LeftToRightTopToBottom value for this property allows the user to select the rating value from left to right direction if RatingAlign="Horizontal" and top to bottom if RatingAlign="Vertical". RightToLeftBottomToTop value works similarly.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;StarCssClass:&lt;/b&gt; Allows setting the common styles for different states of rating control items.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;WaitingStarCssClass:&lt;/b&gt; Allows setting the style for rating control item while it is saving the selected value.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;FilledStarCssClass:&lt;/b&gt; sets the style for active star items of rating control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;EmptyStarCssClass:&lt;/b&gt; sets the style for inactive stars of rating control.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;OnChanged:&lt;/b&gt; calls the ClientCallBack event when the rating is changed by the user.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Tag:&lt;/b&gt; Optional. Passes the custom parameter to the ClientCallBack event&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Sample HTML Code for ASP.Net AJAX Rating Control&lt;/b&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; font-family: Arial,Helvetica,sans-serif; text-align: justify;"&gt;&lt;span style="font-size: small;"&gt;&lt;a href="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCv6kLn7I/AAAAAAAAAhs/qrMPbZW496A/s1600-h/7.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCv6kLn7I/AAAAAAAAAhs/qrMPbZW496A/s400/7.JPG" /&gt;&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="text-align: justify;"&gt;&lt;span style="font-family: Arial,Helvetica,sans-serif; font-size: small;"&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="color: #990000; font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%; font-weight: bold;"&gt;Summary&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="font-size: 100%;"&gt;&lt;span style="color: black;"&gt;I hope this article fulfills its purpose. I would like to have feedback from my blog readers.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&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/4414130591562689667-5433938236531324556?l=dotnetcompletehelp.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://dotnetcompletehelp.blogspot.com/feeds/5433938236531324556/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/09/roundedcorners-control-extender-slider.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/5433938236531324556'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4414130591562689667/posts/default/5433938236531324556'/><link rel='alternate' type='text/html' href='http://dotnetcompletehelp.blogspot.com/2009/09/roundedcorners-control-extender-slider.html' title='RoundedCorners Control Extender, Slider Control Extender, Slideshow Extender Control, Star Rating Extender Control'/><author><name>Sr. Software Engineer</name><uri>http://www.blogger.com/profile/01279050512032303106</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_CZVCL91-wHo/SrsCkRp1sdI/AAAAAAAAAg8/8ULzQ1S6yFw/s72-c/1.JPG' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4414130591562689667.post-2914673009657201033</id><published>2009-09-07T15:06:00.000+05:30</published><updated>2009-09-07T16:00:54.566+05:30</updated><category scheme='http://www.blogger.com/atom/ns#' term='AJAX PopupControl Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Ajax Control Toolkit'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX Resizable Control Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='AJAX Password Strength Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Password Strength Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='PopupControl Extender'/><category scheme='http://www.blogger.com/atom/ns#' term='Resizable Control Extender'/><title type='text'>Password Strength Extender, PopupControl Extender, Resizable Control Extender</title><content type='html'>&lt;div style="text-align: justify; font-family: arial;"&gt;&lt;span style="font-size:100%;"&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;1). Password Strength Extender Control&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;ASP.Net AJAX Password strength extender control provides the functionality to show the required composition of password for creating the strong and secure password. AJAX password strength extender control targets the attached ASP.Net textbox server control in which user enters his password. AJAX password strength control displays the strength indicator when user enters his first character. It displays the strength indicator until focus is inside the targeted textbox and hides the indicator as soon as the textbox loses its focus. There are two types of modes of ASP.Net AJAX password strength extender control, one is text mode that displays the indicator as text message and other type of mode is bar indicator that displays the strength indication in the form of progress bar. You can customize the password strength indicator text message or bar indicator using CSS styles very easily. You can also adjust the composition of password to indicate the user for building a strong password using specified composition e.g.: 2 lower case characters, 2 upper case characters, 2 numeric characters and 2 symbol characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Properties of ASP.Net AJAX Password Strength Extender Control&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TargetControlID:&lt;/span&gt; ID of the Textbox to attach the password strength extender control.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;StrengthIndicatorType:&lt;/span&gt; Accepts the value to specify the indicator type i.e. Text or BarIndicator.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;DisplayPosition:&lt;/span&gt; Accepts the values to display the password strength indicator status at the specified position relative to the TargetControl. It accepts the values such as: AboveLeft, AboveRight, BelowLeft, BelowRight, LeftSide, RightSide.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PreferredPasswordLength:&lt;/span&gt; Accepts the integer value to specify the preferred length of password.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MinimumNumericCharacters:&lt;/span&gt; preferred number of numeric characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MinimumSymbolCharacters:&lt;/span&gt; preferred number of symbol characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MinimumLowerCaseCharacters:&lt;/span&gt; preferred number of lower case characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;MinimumUpperCaseCharacters:&lt;/span&gt; preferred number of upper case characters.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;RequiresUpperAndLowerCaseCharacters:&lt;/span&gt; Accepts value as true or false. MinimumLowerCaseCharacters and MinimumUpperCaseCharacters work only if the value of this property is true.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PrefixText:&lt;/span&gt; This property specifies the prefix text string that is to be displayed with strength indicator text message.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TextStrengthDescription:&lt;/span&gt; Accepts the semi-colon separated values to specify the descriptions. This property works when StrengthIndicatorType is Text. E.g.: good;better;best. Order varies from weakest to strongest. You can specify minimum of 2 descriptions and maximum of 10 descriptions.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CalculationWeightings:&lt;/span&gt; Accepts the 4 numeric values separated with semi-colon. Constituents of this property specify the weightage for length of password, numeric characters, lower case or upper case characters and symbol characters. E.g.: 25;25;15;35. This example set shows that password length is 25% of strength calculation, numeric characters also comprise 25%, lowercase or uppercase comprises 15% of the strength calculation and last symbol characters constitutes the 35% of the strength.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HelpStatusLabelID:&lt;/span&gt; ID of the Label to attach the password strength extender control to display the help text messages.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;HelpHandlePosition:&lt;/span&gt; Accepts the values to display the password strength help text at the specified position relative to the TargetControl. It accepts the values such as: AboveLeft, AboveRight, BelowLeft, BelowRight, LeftSide, RightSide.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;A). PasswordStrength Control using Bar Meter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AJAX PasswordStrength control provides the functionality to display the indication about password composition along with special instructions to create a secure password. You can specify the strong password composition properties of AJAX PasswordStrength control such as minimum number of Uppercase letters and special characters required to create a secure password. In this sample we have used CSS styles to generate a bar meter indicating the status of password strength.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Properties of AJAX PasswordStrength control&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;TargetControlID&lt;/span&gt;&lt;/li&gt;&lt;li&gt;StrengthIndicatorType&lt;/li&gt;&lt;li&gt;DisplayPosition&lt;/li&gt;&lt;li&gt;PreferredPasswordLength&lt;/li&gt;&lt;li&gt;MinimumNumericCharacters&lt;/li&gt;&lt;li&gt;MinimumSymbolCharacters&lt;/li&gt;&lt;li&gt;MinimumLowerCaseCharacters&lt;/li&gt;&lt;li&gt;MinimumUpperCaseCharacters&lt;/li&gt;&lt;li&gt;RequiresUpperAndLowerCaseCharacters&lt;/li&gt;&lt;li&gt;PrefixText&lt;/li&gt;&lt;li&gt;TextStrengthDescription&lt;/li&gt;&lt;li&gt;CalculationWeightings&lt;/li&gt;&lt;li&gt;HelpStatusLabelID&lt;/li&gt;&lt;li&gt;HelpHandlePosition&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:100%;"&gt;You can use the following set of CSS class styles to customize the look and feel of ASP.Net AJAX password strength as bar indicator meter. To display the password strength indication meter BarBorderCssClass, BarIndicatorCssClass or StrengthStyles CSS based properties are used to change the look and feel of strength indicator. Here we will use BarBorderCssClass and StrengthStyles properties to display the password strength indication meter:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CSS Code for AJAX Password strength meter&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_CZVCL91-wHo/SqTYWWilL8I/AAAAAAAAAgU/ut1tXGzOj6A/s1600-h/1.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 340px; height: 400px;" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SqTYWWilL8I/AAAAAAAAAgU/ut1tXGzOj6A/s400/1.JPG" alt="" id="BLOGGER_PHOTO_ID_5378661733506559938" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;B). PasswordStrength Control using Text Description&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;AJAX PasswordStrength control also provides the functionality to display the text indication about password composition along with special instructions to create a secure password. You can specify the strong password composition properties of AJAX PasswordStrength control such as minimum number of Uppercase letters, special characters required to create a secure password along with their calculation weightings and text description. In this sample we have used CSS styles and text description to generate a descriptive text indicator showing the status of password strength.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Properties of AJAX PasswordStrength control&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-size:100%;"&gt;TargetControlID&lt;/span&gt;&lt;/li&gt;&lt;li&gt;StrengthIndicatorType&lt;/li&gt;&lt;li&gt;DisplayPosition&lt;/li&gt;&lt;li&gt;PreferredPasswordLength&lt;/li&gt;&lt;li&gt;MinimumNumericCharacters&lt;/li&gt;&lt;li&gt;MinimumSymbolCharacters&lt;/li&gt;&lt;li&gt;MinimumLowerCaseCharacters&lt;/li&gt;&lt;li&gt;MinimumUpperCaseCharacters&lt;/li&gt;&lt;li&gt;RequiresUpperAndLowerCaseCharacters&lt;/li&gt;&lt;li&gt;PrefixText&lt;/li&gt;&lt;li&gt;TextStrengthDescription&lt;/li&gt;&lt;li&gt;CalculationWeightings&lt;/li&gt;&lt;li&gt;HelpStatusLabelID&lt;/li&gt;&lt;li&gt;HelpHandlePosition&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;span style="font-size:100%;"&gt;You can use the following set of CSS class styles to customize the look and feel of ASP.Net AJAX password strength as text message. To display the password strength indication text message TextIndicatorCssClass, TextStrengthDescriptionStyles or StrengthStyles CSS based properties are used to change the look and feel of strength indicator.&lt;br /&gt;&lt;br /&gt;Here we will use TextStrengthDescriptionStyles property to display the password strength indication text message:&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CSS Code for AJAX Password strength text&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_CZVCL91-wHo/SqTYfx6LRhI/AAAAAAAAAgc/eWyzcO-waw8/s1600-h/2.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 399px; height: 414px;" src="http://1.bp.blogspot.com/_CZVCL91-wHo/SqTYfx6LRhI/AAAAAAAAAgc/eWyzcO-waw8/s400/2.JPG" alt="" id="BLOGGER_PHOTO_ID_5378661895472104978" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_CZVCL91-wHo/SqTYgRH3SaI/AAAAAAAAAgk/VfAveHKMOYw/s1600-h/3.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 186px;" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SqTYgRH3SaI/AAAAAAAAAgk/VfAveHKMOYw/s400/3.JPG" alt="" id="BLOGGER_PHOTO_ID_5378661903851014562" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: rgb(153, 0, 0);"&gt;2). PopupControl Extender Control&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The AJAX PopupControlExtender provides a new and very interactive way to display the collection of list type options using different ASP.Net controls. Instead of using drop downs or list boxes you can use PopupControlExtender to display the collection of options in any other ASP.Net server control e.g.: radio button list, checkbox list etc...&lt;br /&gt;&lt;br /&gt;You can display the popup populated with values retrieved from the database and set the value for targeted Textbox by selecting a value from the popup. All this functionality can be provided with more interactive way using AJAX UpdatePanel. UpdatePanel will bind and update the values using Partial Rendering feature of AJAX that works for individual controls without affecting rest of web page.&lt;br /&gt;&lt;br /&gt;PopupControlExtender controls both server side and client side events based on the values specified in its properties.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PopupControl Extender Properties&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;TargetControlID:&lt;/span&gt; ID of the textbox that will capture the return values.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;PopupControlID:&lt;/span&gt; ID of the control that will appear as popup.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Position:&lt;/span&gt; You can specify the position for the popup to appear. It accepts the positions as Bottom, Top, Center, Left and Right.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;OffesetX:&lt;/span&gt; It assigns margin to the popup in horizontal direction from the position defined in Position property.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;OffsetY:&lt;/span&gt; It assigns margin to the popup in vertical direction corresponding to the specified Position.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CommitProperty:&lt;/span&gt; It adds a new attribute/property to the target control that you can access and use at client side scripting.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CommitScript:&lt;/span&gt; Client side script that executes after retrieving the popup value.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;CSS code&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_CZVCL91-wHo/SqTZkDkMfZI/AAAAAAAAAgs/daYvBuy59lY/s1600-h/4.JPG"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 272px;" src="http://3.bp.blogspot.com/_CZVCL91-wHo/SqTZkDkMfZI/AAAAAAAAAgs/daYvBuy59lY/s400/4.JPG" alt="" id="BLOGGER_PHOTO_ID_5378663068442852754" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Above sample code will help you to learn the use of CommitProperty and CommitScript property of the PopupControlExtender.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; color: r
