Você está na página 1de 52

IITM\BCA-303

UNIT-III

Lecture-35
ASP.NET INTRODUCTION ASP.NET is also a Microsoft product which is used to develop dynamic websites. It is basically a successor of ASP. The extension used for ASP.NET web page is .aspx. Its first version was released on January 2002 (.NET framework 1.0) and latest version was released on August 2010 (.NET framework 4.0). Microsoft .NET framework constitutes of code libraries that enable software and websites to be developed and run very easily in the .NET environment. ASP.NET runs in the Internet Information Services/Server (IIS) web server developed by Microsoft which provides lots of power and flexibility to the web pages. ASP .NET is a framework which provides a rich development environment for developing powerful websites. We can develop these websites using any .NET compliant language like VB.NET, C# etc. It has lots of built-in validation, server controls and security controls. These controls run on the server. User can access their properties, methods and events. On the server, the controls expose an object-oriented programming model that brings the richness of object-oriented programming to the developer. ASP .NET also provides state management which reduces the amount of code a developer must write and increase application reliability. HOW TO CREATE A NEW WEBSITE USING ASP.NET Step 1: Choose a new website from file menu and then choose first option ASP.NET Website.

DEFAULT TEMPLATE TYPES AVAILABLE IN ASP.NET Visual Web Developer includes several templates for new Web applications, as listed in the following table:TEMPLATE ASP.NET Web Site DESCRIPTION Creates a new Web application that includes a folder to contain the Web application files. It comprises a default Web page called Default.aspx, a data folder known as app_data folder. Creates a new Web application that contains no files. Visual Web Developer creates a folder for the site, and if user is creating a local IIS Web application or a remote IIS site, it creates the IIS Web application.

Empty Web Site

ASP.NET Web Service Creates a new Web application that includes a default Web service called

IITM\BCA-303

UNIT-III Sevice.asmx, which contains a sample Web method, a code folder where you can keep the source code for Web services and for components called by Web services and a data folder to contain database or other data.

ASP.NET Crystal Reports Web Site

Creates a new Web application that allows you to produce and display Crystal Reports.

Step2: Choose Location to save a new website. It comprises two things. First has three options; File System, HTTP and FTP. These options are used for specific reasons which are mention below. Second field requires user to specify complete path to save a website. File System: Using this option, Visual Studio opens / creates the web application as a folder, and uses the built-in ASP.NET Development Server to host the Web site. This option may be sufficient for basic testing of ASP.NET applications. A Web application in a folder on your local or a remote computer is not associated with an Internet Information Services (IIS) application unless the user creates an IIS virtual directory to point to them. FTP Site: Using this option, Visual Studio supports editing your application files if they are shared through FTP. You can still use Visual Studio to debug your applications by configuring the URL of your application in project start settings. HTTP Site: Using this option, Visual Studio can connect to a remote IIS server. To use this option, you need to have Front Page Server Extensions installed on the remote server and configure your Web site to use FPSE. The files are stored under the Web application root (typically, Inetpub/Wwwroot). If you are creating a local application using HTTP, you must have IIS installed on your computer. If you are creating an IIS application on a remote computer, the computer must be configured with FrontPage Server Extensions from Microsoft, and user should have permissions to create folders on that computer.

After choosing the location type you can browse to the location where you wish to store the website.

IITM\BCA-303

UNIT-III

PROGRAMMING ASP.NET WEB PAGES User can create the server code for any ASP.NET Web pages using a variety of languages in the .NET Framework, including Visual Basic, C#, and J#. ASP.NET Web pages can contain client script like java script that runs within the browser.

Step3: Choose a language for coding a website.

The first page (web page) which gets open when a website is created is default.aspx. It supports two view; Design and Source view. Third view is Split view which is actually a integration of source and design view.

IITM\BCA-303

UNIT-III

IITM\BCA-303

UNIT-III

IITM\BCA-303

UNIT-III

@ DIRECTIVES ASP.NET pages usually contain directives that allow you to specify page properties and configuration information for the page. The directives are used by ASP.NET as instructions for how to process the page, but they are not rendered as part of the markup that is sent to the browser. The most commonly used directive is the @ Page directive, which allows you to specify many configuration options for the page. For e.g., it includes the server programming language for code in the page, whether the page is a page with server code directly in the page, which is called a single-file page, or whether it is a page with code in a separate class file, which is called a code-behind page, debugging and tracing options, master page etc. If the user doesnt include @ Page directive in the page, or if the directive does not include any specific setting then that setting is inherited from the configuration file for the Web application (Web.config file) or from the site configuration file (the Machine.config file). In addition to including @ Page directive, user can include other directives that support additional page-specific options. For e.g., @ Import directive can be used which allow to specify the namespaces that you want to refer in your code, @ Implements directive to specify any .NET interface which is to be implemented.

IITM\BCA-303 COMMENTS <%-- Content of comments --%>

UNIT-III

FILE TYPES MANAGED BY ASP.NET File types that are managed by ASP.NET are mapped to the Aspnet_isapi.dll (ASP.NET Application server) FILE TYPE .asax .ascx .asmx .aspx .browser .config .cs, .jsl, .vb .master .mdb, .ldb .mdf .resources, .resx .sitemap DESCRIPTION This file represents the application and contains optional methods that run at the start or end of the application lifetime. A Web user control file that defines a custom, reusable control. An XML Web services file that contains classes and methods that are available to other Web applications. An ASP.NET Web forms file (page) that can contain Web controls and presentation and business logic. A browser definition file used to identify the features of client browsers. A configuration file (typically Web.config) containing XML elements that represent settings for ASP.NET features. A code-behind file for an ASP.NET page or a stand-alone class file containing application logic. A master page that defines the layout for other Web pages in the application. An Access database file. SQL database file for use with SQL Server Express. A resource file that contains resource strings that refer to images, localizable text, or other data. A site-map file that contains the structure of the Web site. ASP.NET comes with a default site-map provider that uses site-map files to easily display a navigational control in a Web page. A skin file containing property settings to apply to Web controls for consistent formatting. A solution file for a Visual Web Developer project. Style sheet files used to determine the formatting of HTML elements.

.skin .sln .css

FOLDERS AVAILABLE IN ASP.NET ASP.NET recognizes certain folder names that you can use for specific types of content. The table below lists the reserved folder names and the type of files that the folders typically contain. FOLDER App_Browsers App_Code DESCRIPTION Contains browser definitions (.browser files) that ASP.NET uses to identify individual browsers and determine their capabilities. Contains source code for utility classes and business objects (for example, .cs, .vb, and .jsl files) that you want to compile as part of your application. ASP.NET compiles the code in the App_Code folder on the initial request to the user application. Items in this

IITM\BCA-303

App_Data

UNIT-III folder are then recompiled when any changes are detected. Code in the App_Code folder is referenced automatically in your application. In addition, the App_Code folder can contain subdirectories of files that need to be compiled at run time. Contains application data files including MDF files, XML files, as well as other data store files. The App_Data folder is used to store membership and role information.

App_GlobalResources Contains resources (.resx and .resources files) that are compiled into assemblies with global scope. These are strongly typed and can be accessed programmatically. App_LocalResources Contains resources (.resx and .resources files) that are associated with a specific page, user control, or master page in an application. App_Themes App_WebReferences Contains a collection of files (.skin and .css files, as well as image files and generic resources) that define the appearance of ASP.NET Web pages and controls. Contains reference contract files (.wsdl files), schemas (.xsd files), and discovery document files (.disco and .discomap files) defining a Web reference for use in an application. Contains compiled assemblies (.dll files) for controls, components, or other code that you want to reference in your application.

Bin

PAGE AND APPLICATION CONTEXT IN ASP.NET WEB APPLICATIONS OBJECT NAME Response Request DESCRIPTION Provides access to the output stream for the current page. User can use this class to inject text into the page, to write cookies and many more. Provides access to the current page request, including cookies, query string, and so on. User can use this class to read what the browser has sent. ASP.NET CLASS HttpResponse HttpRequest

CODE TO PRINT SOMETHING ON SCREEN (Page_Load event)


Response.Write("<h1> HELLO WORLD</h1>")

You can use the Redirect method of the HttpResponse object associated with the page to display a form other than the one thats currently displayed. To refer to this object, you use the Response property of the page.
Response.Redirecrt("default2.aspx")

PAGE DEVELOPMENT IN ASP AND ASP.NET In an ASP page, declarative tags (HTML, ASP directives, server controls and static text) are combined with the code. ASP allows you to perform some code separation, but it is difficult to cleanly separate code from the tags. In ASP .NET, code either can be stored on the same page as the tags or on a separate page known as the code behind page. This code separation allows applications to be cleanly structured and to perform much faster than the traditional ASP. The server controls are programmable in that for use in your

IITM\BCA-303 ASP (Single File) Code <Tags> Form1.asp

UNIT-III ASP.NET (Separate files) <Tags> Form1.aspx Code Form1.vb

DIFFERENCES BETWEEN ASP AND ASP.NET ASP It is Interpreted language, i.e. code is interpreted when the page is executed. It has mixed HTML and coding logic. It has limited Object Oriented support. It has limited session and application state management It has Poor exception handling system. It is supported by very few development and debugging tools. It uses less advanced script languages such as VB script, Jscript, PerlScript for coding. ASP uses a technology called ADO to connect and work with databases. The event driven programming was not available. ASP.NET It is Compiled language, i.e. code is compiled to assemblies and loaded at run time. It has code-behind development model to separate business logic from presentation. It is completely Object Oriented. It has complete session and application state management. It has advanced exception handling system. (try-catch blocks) It is supported by a variety of powerful compilers and tools. It uses more advanced and powerful languages such as C#, VB.NET, J# etc. ASP.NET uses the ADO.NET technology. The event driven programming is available.

HOW A WEB PAGE IS GENERATED AT RUNTIME Whenever Client requests for the web page it is send to the Web server with the help of a browser which in turn sends back the requested web pages to the client if he is authorized to access it. A web browser requests for a page to web server by sending it HTTP request message. The HTTP request includes the name of the file being requested and the Internet address of both the browser and the Web server. A user working with a browser can initiate an HTTP request in several ways. One way is to type the address of a web page into the browsers address area. Another way is to click a link that refers to a web page. A web server replies to an HTTP request by sending a message known as an HTTP response back to the browser. The HTTP response contains the addresses of the client browser and the server as well as the HTML document (web page content) for which request was made.

IITM\BCA-303

UNIT-III

WEB
BROWSER

HTTP REQUEST
Internet

HTTP RESPONSE
CLIENT COMPUTER

SERVER COMPUTER (WEB SERVER)

Above diagram shows a case of .HTML page request i.e., a static page request but when a Web server receives a request for a dynamic web page like ASP.NET web page, the server passes the request to an APPLICATION SERVER. The application server executes the Web application, which generates an HTML document. This document is returned to the application server, which passes it back to the web server. The Web server, in turn, sends the document back to the browser. After the page is displayed, the user can interact with it using its controls. Some of those controls let the user POST the page back to the server, so its processed again using the data the user entered. To determine what application server is used to process a request, the Web server looks up the extension of the requested file in a list of APPLICATION MAPPINGS. Each application mapping specifies which application should be run to process files with that extension. If the file extension is aspx, the request is passed to ASP.NET. If the file extension isnt in the list of application mappings, the requested file is returned to the browser without any processing. The process that begins with the user requesting a web page and ends with the server sending a response back to the client is called a ROUND TRIP. After a web application generates an HTML document, it ends. Then, unless the data the application contains is specifically saved, that data is lost. POST BACK AND ROUND TRIP ASP.NET pages run as code on the server. Therefore, for the page to be processed, the page is configured to submit to the server when users click buttons (or optionally, when users select check boxes or interact with other controls in the page). Each time, the page is submitted back to itself so it can run its server code again and then render a new version of itself back to the user. The processing cycle for an ASP.NET Web page is this: The user requests the page. (The page is requested using an HTTP GET method.) The page runs for the first time, performing preliminary processing if you have programmed it to do so. The page dynamically renders markup to the browser, which the user sees as a Web page similar to any other page. The user types information or selects from available choices and then clicks a button. (If users click a link instead of a button, the page might simply navigate to another page, and no further processing takes place on the first page.) The page is posted to the Web server. (The browser performs an HTTP POST method, which in ASP.NET is referred to as a POSTBACK.) Specifically, the page is posted back to itself. For example, if the user is working with the page Default.aspx, clicking a button on the page posts the page back to the server with a target of Default.aspx. On the Web server, the page runs again. The information that the user typed or selected is available to the page. The page performs the processing that you have programmed it to do. The page renders itself back to the browser.

IITM\BCA-303

UNIT-III

This cycle continues as long as the user is working in the page. Each time the user clicks a button, the information in the page is posted to the Web server and the page runs again. Each cycle is referred to as a ROUND TRIP.

WEB SERVERS To test or run ASP.NET Web applications, you need a Web server. The production Web server for Microsoft operating systems is IIS, which includes a Web server, File Transfer Protocol (FTP) server, Simple Mail Transfer Protocol (SMTP) virtual e-mail server, and other facilities. In order to run IIS, you must be working with a version of Windows that is designed to function as a server in a network environment. This includes the Web Edition of Windows Server 2003. THE ASP.NET DEVELOPMENT SERVER If you cannot or do not want to use IIS as your Web server, you can still test your ASP.NET pages by using the ASP.NET Development Server. The ASP.NET Development Server, which is included with Visual Web Developer, is a Web server that runs locally on Windows operating systems, including Windows XP Home Edition. It is specifically built to serve, or run, ASP.NET Web pages under the local host scenario (browsing from the same computer as the Web server). In other words, the ASP.NET Development Server will serve pages to browser requests on the local computer. It will not serve pages to another computer. Additionally, it will not serve files that are outside of the application scope. The ASP.NET Development Server provides an efficient way to test pages locally before you publish the pages to a production server running IIS. PAGE LIFETIME Unlike forms in desktop applications, an ASP.NET Web page does not start up, run while the user works with the form, and then unload only when the user clicks a Close button. This is because the Web is inherently disconnected. When a browser requests a page from a Web server, the browser and the server are connected only long enough to process the request. After the Web server has rendered a page to the browser, the connection is terminated. If the browser makes another request to the same Web server, even for the same page, this request is processed as a new request. If the user clicks a button to perform a POSTBACK, a new instance of the page is created; the page performs its processing, and is again discarded. Thus, each POSTBACK and round trip results in a new instance of the page.

IITM\BCA-303

UNIT-III

ASP.NET ARCHITECTURE PRESENTATION LAYER HTML pages (.aspx files) that define the layout of each web page User controls (.ascx files) that define page elements such as banners, navigation menus, and data entry forms Style sheets (.css files) that control the overall appearance of the pages. BUSINESS RULES LAYER Class files that provide the code-behind functions for each page (.aspx.vb) User control (.ascx.vb) to implement the applications processing requirements Other classes (.vb), such as classes that represent business entities or implement business rules. DATABASE LAYER The database itself (such as Microsoft SQL Server) as well as classes that works directly with the database. .aspx .ascx User controls .css Style sheets

PRESENTATION LAYER

HTML pages

BUSINESS LOGIC LAYER

.aspx.vb Code behind for .aspx files

.ascx.vb Code behind for user controls

DATABASE LAYER

.vb Database classes

Database

Step 0: The Browser Makes an HTTP Request for an ASP.NET Web Page The entire process begins with a Web browser making a request for an ASP.NET Web page. For example, a user might type into their browser's Address window the URL for this article, http://aspnet.4guysfromrolla.com/articles/011404.aspx. The Web browser, then, would make an HTTP request to the 4Guys Web server, asking for the particular file /articles/011404-1.aspx.

IITM\BCA-303 UNIT-III Step 1: The Web Server Receives the HTTP Request The sole task of a Web server is to accept incoming HTTP requests and to return the requested resource in an HTTP response. The 4Guys Web server runs Microsoft's Internet Information Services (IIS) Web server. The first things IIS does when a request comes in is decide how to handle the request. Its decision is based upon the requested file's extension. For example, if the requested file has the .asp extension, IIS will route the request to be handled by asp.dll. There are numerous file extensions that map to the ASP.NET engine, some of which include:

.aspx, for ASP.NET Web pages, .asmx, for ASP.NET Web services, .config, for ASP.NET configuration files,

Step 2: Examining the ASP.NET Engine An initial request for http://aspnet.4guysfromrolla.com/articles/011404.aspx will reach IIS and then be routed to the ASP.NET engine Step 3: Generating the Output ASP.NET engine job it is to generate the output that will be sent back to the requesting browser. For ASP.NET Web pages, this means rendering the Web controls into HTML and returning this HTML. FEATURES OF ASP.NET 1. It follows simplified Programming Model. 2. Code-Behind logic: The main problem with ASP Classic pages is that an .asp page does not yield modularized code. Both HTML and Script are present in a single page. But Microsoft's ASP.NET implementation contains a new-fangled method to break up business logic code from presentation code. 3. ASP.Net is a technology which can be implemented using any .NET language such as VB.net, C# 4. Simplified deployment: ASP.Net supports setup and deployment and hence the web app can be defined with a web set up project which can be easily deployed on to the web server. Where as for ASP CUTE FTP is used for deploying manually we have to upload. 5. Better Performance: As the ASPX pages are complier based the performance of the web application will be faster than the ASP pages as they are interpreter based. 6. Caching: It is a process of maintaining the result or output of a web page temporarily for some period of time. ASP supports Client Side caching where as ASP.Net supports both client side and server side. 7. Security: In ASP security is done by IIS or writing the code manually. Whereas ASP.Net is defined with built in security features such as windows authentication Forms Authentication Passport Authentication Custom Authentication 8. More powerful data access: ASP.net supports ADO.Net as its database connectivity model which will be implemented using the most Powerful OOPS languages like VB.Net and C# and hence the database access using ASPX pages will be very powerful. 9. Web services: it is a code which will be published on the web which can be used by any applications written using any language for a platform or device. 10. Better session Management: Session Management in ASP.Net can be maintained using cookies, session. 11. Simplified Form Validations: ASP.Net provides validation controls using which any type of client side validations are performed without writing any code.

IITM\BCA-303 UNIT-III 12. ASP.NET Pages are compiled: When an ASP.NET page is first requested, it is compiled and cached on the server. This means that an ASP.NET page performs very rapidly. All ASP.NET code is compiled rather than interpreted, which permits early binding, strong typing, and just-in-time (JIT) compiling to native code. 13. XML-Based: ASP.NET configuration settings are stored in XML-based files, which are human readable and writable. Each one of our applications can have a different configuration file and we can extend the configuration scheme according to our necessities. ASP.NET PAGE LIFE CYCLE OVERVIEW When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering. It is important to understand the page life cycle so that you can write code at the appropriate life-cycle stage for the effect you intend. LIFE-CYCLE EVENTS The following table lists the page life-cycle events:PAGE EVENT PreInit TYPICAL USE Use this event for checking the IsPostBack property to determine whether this is the first time the page is being processed, to create or re-create dynamic controls, to set a master page dynamically, to set the Theme property dynamically or to read or set profile property values. Raised after all controls has been initialized and any skin settings have been applied or to read or initialize control properties. Use this event for processing tasks that require all initialization be complete. Use this event if you need to perform processing on your page or control before the Load event. It loads view state for itself and all controls, and then processes any postback data included with the Request instance. The Page calls the OnLoad event method on the Page, then recursively does the same for each child control, which does the same for each of its child controls until the page and all controls are loaded. Use the OnLoad event method to set properties in controls and establish database connections. Use these events to handle specific control events, such as a Button control's Click event or a TextBox control's TextChanged event. Use this event for tasks that require that all other controls on the page be loaded.

Init InitComplete PreLoad

Load

Control events LoadComplete PreRender

The PreRender event occurs for each control on the page. Use the event to make final changes to the contents of the page or its controls. SaveStateComplete Before this event occurs View State has been saved for the page and for all controls. Any changes to the page or controls at this point will be ignored. Render This is not an event. Instead this is a stage of processing. The Page object calls this method on each control. All ASP.NET Web server controls have a Render method that writes out the control's markup that is sent to the browser. This event occurs for each control and then for the page. In controls, use this event to do final cleanup for specific controls, such as closing control-specific database connections.

Unload

IITM\BCA-303 DIFFERENCE BETWEEN WINDOW APPLICATION AND WEB APPLICATION

UNIT-III

WINDOW APPLICATION It is based on connected architecture. State of every control and page is preserved i.e., controls do preserve their values. For e.g., Form2 can use any textbox value of Form1 easily by referring to its text property followed by form name.

WEB APPLICATION It is based on disconnected architecture. State of controls and web page is preserved. Controls do not preserve their values. For e.g., if default2 page wants to refer to default1 textbox then it can do it directly by simply referring to its text property but through any mechanism which comes under state management like with the help of view state, cookies etc. A complete life cycle of events for a page is called every time starting from init event to unload event. So, Form Load event is called every time whenever any event is fired. Foe e.g., when user clicks a button, first form is loaded then button click event is called. Lecture-36

Form Load event is called only once.

OVERVIEW OF HTML HTML which stands for Hypertext Markup Language works as a building block to develop static websites where as ASP (Active Server Pages) is server-side script engine developed and released by Microsoft in December 1996 which is used to create dynamic & interactive web applications. ASP Page is a simple HTML page containing server-side scripts, along with HTML, XML or other text. ASP page has an extension .asp. Default scripting language used in asp is VBScript and other scripting engines (JScript, PerlScript etc) can also be selected. ASP uses the Microsofts web server (Internet Information Services/Server). ASP pages are processed by IIS before being sent to the user's browser. HTML Tags HTML markup tags are usually called HTML tags HTML tags are keywords (tag names) surrounded by angle brackets like <html> HTML tags normally come in pairs like <b> and </b> The first tag in a pair is the start tag, the second tag is the end tag The end tag is written like the start tag, with a forward slash before the tag name Start and end tags are also called opening tags and closing tags An HTML document is an ASCII text file that contains embedded HTML tags. On a UNIX server, it typically has a filename extension of .html. In general, the HTML tags are used to identify the structure of the document and to identify hyperlinks (to be highlighted) and their associated URLs. HTML identifies the structure of the document and it suggests the layout of the document. The display capabilities of the Web browser determine the appearance of the HTML document on the screeen.

IITM\BCA-303 Using HTML we can identify:


UNIT-III

The title of the document The hierarchical structure of the document with header levels and section names Bulleted, numbered, and nested lists Insertion points for graphics Special emphasis for key words or phrases Preformatted areas of the document Hyperlinks and associated URLs

HTML cannot control the:


Typeface used for any document component Point size of any specific font Width or height of the screen Centering, spacing, or line breaks of information, except in preformatted text Background, foreground, or highlight colors

DIFFERENCES BETWEEN HTML AND ASP HTML Used to create only static pages Scripts denoted by delimiters: < > Does not support server-side scripts to be written in HTML pages Cannot access any Database. OVERVIEW OF JAVASCRIPT JavaScript started life as LiveScript, but Netscape changed the name, possibly because of the excitement being generated by Java.to JavaScript. JavaScript made its first appearance in Netscape 2.0 in 1995 with a name LiveScript. JavaScript is a lightweight, interpreted programming language with object-oriented capabilities that allows us to build interactivity into otherwise static HTML pages. JavaScript is: JavaScript is a lightweight, interpreted programming language Designed for creating network-centric applications Complementary to and integrated with Java Complementary to and integrated with HTML Open and cross-platform ASP Dynamic pages can be created Scripts denoted by delimiters: <% %> Support server-side scripts to be written in ASP pages. Can access any Database.

Client-side JavaScript:
Client-side JavaScript is the most common form of the language. The script should be included in or referenced by an HTML document for the code to be interpreted by the browser. It means that a web page need no longer be static HTML, but can include programs that interact with the user, control the browser, and dynamically create HTML content.

IITM\BCA-303 UNIT-III The JavaScript client-side mechanism features many advantages over traditional CGI server-side scripts. For example, we might use JavaScript to check if the user has entered a valid e-mail address in a form field. The JavaScript code is executed when the user submits the form, and only if all the entries are valid they would be submitted to the Web Server. JavaScript can be used to trap user-initiated events such as button clicks, link navigation, and other actions that the user explicitly or implicitly initiates.

Advantages of JavaScript:
The merits of using JavaScript are: Less server interaction: We can validate user input before sending the page off to the server. This saves server traffic, which means less load on your server. Immediate feedback to the visitors: They don't have to wait for a page reload to see if they have forgotten to enter something. Increased interactivity: We can create interfaces that react when the user hovers over them with a mouse or activates them via the keyboard. Richer interfaces: We can use JavaScript to include such items as drag-and-drop components and sliders to give a Rich Interface to your site visitors.

Limitations with JavaScript:


We can not treat JavaScript as a full fledged programming language. It lacks the following important features: Client-side JavaScript does not allow the reading or writing of files. This has been kept for security reason. JavaScript cannot be used for Networking applications because there is no such support available. JavaScript doesn't have any multithreading or multiprocess capabilities. Once again, JavaScript is a lightweight, interpreted programming language that allows us to build interactivity into otherwise static HTML pages.

JavaScript Development Tools:


One of JavaScript's strengths is that expensive development tools are not usually required. We can start with a simple text editor such as Notepad. Since it is an interpreted language inside the context of a web browser, we don't even need to buy a compiler. To make our life simpler, various vendors have come up with very nice JavaScript editing tools. Few of them are listed here:

Microsoft FrontPage: Microsoft has developed a popular HTML editor called FrontPage. FrontPage also provides web developers with a number of JavaScript tools to assist in the creation of an interactive web site. Macromedia Dreamweaver MX: Macromedia Dreamweaver MX is a very popular HTML and JavaScript editor in the professional web development crowd. It provides several handy prebuilt JavaScript components, integrates well with databases, and conforms to new standards such as XHTML and XML. Macromedia HomeSite 5: This provided a well-liked HTML and JavaScript editor, which will manage their personal web site just fine.

IITM\BCA-303 CASCADING STYLE SHEETS(CSS) Cascading style sheets are of following types:A.) inline B.) internal C.) external

UNIT-III

Different ways for implementing CSS are as follows:1. To create a external CSS file, Right click on Website in solution explorer and choose option of CSS file from add new item and then write the code written below and save it with 1.css name.

Then after on default.aspx page add a link of external CSS created file written below in head tag:Explanation: If we will use h1 tag anywhere in default page then text written in h1 tag will get all effects from external CSS file. 2. We can also create CSS in default.aspx page. To write CSS we need to use style tag along with type attribute which should be set to text/css.

Explanation: If we will use h1 tag anywhere in default page then text written in h1 tag will get all effects from internal CSS file. 3. Using class a.) make a style sheet as following:.myclass { font-size:80px; } b.) then, use it in a page like this <h1 class="myclass"> welcome, Student

IITM\BCA-303 </h1> The following example shows usage of CSS file. OUTPUT WITHOUT USAGE OF CASCADING STYLE SHEET

UNIT-III

OUTPUT AFTER APPLYING CASCADING STYLE SHEET

Code to be written on default page is as follows to get above result. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

IITM\BCA-303 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title>Untitled Page</title> <style type="text/css"> .style1 { width: 387px; border: 1px solid #008000; border-style:groove; border-color:Green; border-width:30px; } .style2 { text-align: center; font-size:50px; text-align :center; } .style3 { width: 172px; } .style { } h1 { } </style> </head> <body> <form id="form1" runat="server"> <div> Student Registration Form</div> <table class="style1"> <tr> <td class="style2"> <asp:Label ID="Label1" runat="server" Text="FNAME :"></asp:Label> </td> <td class="style3"> <asp:TextBox ID="txtfname" runat="server" Width="126px"></asp:TextBox> </td> </tr> <tr> <td class="style2">

UNIT-III

IITM\BCA-303 UNIT-III <asp:Label ID="Label2" runat="server" Text="LNAME :"></asp:Label> </td> <td class="style3"> <asp:TextBox ID="txtlname" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="style2"> <asp:Label ID="Label3" runat="server" Text="PASSWORD :"></asp:Label> </td> <td class="style3"> <asp:TextBox ID="txtpassword" runat="server" Height="22px" Width="128px"></asp:TextBox> </td> </tr> <tr> <td class="style2"> <asp:Label ID="Label4" runat="server" Text="RE PASSWORD :"></asp:Label> </td> <td class="style3"> <asp:TextBox ID="txtrepassword" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="style2"> <asp:Label ID="Label5" runat="server" Text="EMAIL :"></asp:Label> </td> <td class="style3"> <asp:TextBox ID="txtemail" runat="server"></asp:TextBox> </td> </tr> <tr> <td class="style2"> <asp:Label ID="Label6" runat="server" Text="HOBBIES :"></asp:Label> </td> <td class="style3"> <asp:DropDownList ID="DropDownList1" runat="server"> </asp:DropDownList> </td> </tr> <tr> <td class="style2" colspan="2"> <asp:Button ID="Button1" runat="server" style="margin-left: 0px" Text="SUBMIT" Width="164px" /> </td> </tr> </table> </form> </body> </html> To include an external style sheet we need to add the following line to web page.

IITM\BCA-303 <link href="1.css" rel="stylesheet" type="text/css" /> Where, 1.css is a file created in notepad saved with .CSS extension.

UNIT-III

Lecture-37
ASP.NET CONTROLS The ASP.NET page framework includes a number of built-in server controls that are designed to provide a more structured programming model for the Web. These controls provide the following features:

Automatic state management. Ability to react to events in server-side code to create applications that are better structured. Common approach to building user interfaces for Web pages. Output is automatically customized based on the capabilities of the browser.

In addition to the built-in controls, the ASP.NET page framework also provides the ability to create user controls. User controls can enhance and extend existing controls to build a much richer user interface. 1. HTML SERVER CONTROLS The HTML server controls are Hypertext Markup Language (HTML) elements that include a runat=server attribute. The HTML server controls have the same HTML output and the same properties as their corresponding HTML tags. In addition, HTML server controls provide automatic state management and server-side events. HTML server controls offer the following advantages:

The HTML server controls map one to one with their corresponding HTML tags. When the ASP.NET application is compiled, the HTML server controls with the runat=server attribute are compiled into the assembly. Most controls include an OnServerEvent . The HTML tags that are not implemented as specific HTML server controls can still be used on the server side When the ASP.NET page is reposted, the HTML server controls keep their values.

IITM\BCA-303 UNIT-III The System.Web.UI.HtmlControls.HtmlControl base class contains all of the common properties. HTML server controls derive from this class. To use an HTML server control, use the following syntax (which uses the HtmlInputText control as an example): <input type="text" value="hello world" runat=server />

HTML CONTROLS INCLUDES:HtmlAnchor Control HtmlButton Control HtmlForm Control HtmlImage Control HtmlInputButton Control HtmlInputCheckBox Control HtmlInputFile Control HtmlInputHidden Control HtmlInputImage Control HtmlInputRadioButton Control HtmlInputText Control HtmlSelect Control HtmlTable Control HtmlTextArea Control

2. WEB SERVER CONTROLS Web controls are very similar to the HTML server controls such as Button, TextBox, and Hyperlink, except that Web controls have a standardized set of property names. These controls allow the user to interact with the page and send information to the server when the page is posted back. Web server controls offer the following advantages:

Make it easier for manufacturers and developers to build tools or applications that automatically generate the user interface. Simplify the process of creating interactive Web forms, which requires less knowledge of how HTML controls work and make the task of using them less prone to errors.

The System.Web.UI.WebControls.WebControl base class contains all of the common properties. Most of the Web server controls derive from this class. To use a Web server control, use the following syntax (which uses the TextBox control as an example): <asp:textbox text="hello world" runat=server /> COMMON SYNTAX FOR ANY WEB SERVER CONTROL: <asp: controltype id=name of the control runat=server //additional properties></asp:controltype>

For e.g. <asp:label id=lb1 runat=server text=user name></asp:label>

IITM\BCA-303 WEB SERVER CONTROLS CAN BE DIVIDED INTO FOUR CATEGORIES: Basic Web Controls Validation Controls List Controls Rich Controls A) BASIC WEB CONTROLS

UNIT-III

Basic Web controls provide the same functionality as their HTML server control counterparts. However, basic Web control includes additional methods, events, and properties against which you can program. 1. Button Web Server Control 2. CheckBox Web Server Control 3. HyperLink Web Server Control 4. Image Web Server Control 5. ImageButton Web Server Control 6. Label Web Server Control 7. LinkButton Web Server Control 8. Literal Web Server Control 9. Panel Web Server Control 10. PlaceHolder Web Server Control 11. RadioButton Web Server Control 12. Table Web Server Control 13. TextBox Web Server Control Autopostback Property Some server control can generate automatic postbacks on selected events. For Example- SelectedIndexChange event of an ListBox werb server control is an event that triggered a postback.To implement this mechanism we have to set AutoPostBack=True in the ListBoxs property.Similarly,TextChanged event of TextBox & CheckedChange event of RadioBoxand,CheckBox also triggered a postback. PostBack is the name given to the process of submitting an ASP.NET page to the server for processing . PostBack is done if certain credentials of the page are to be checked against a database (such as verification of username and password). This is something that a client machine is not able to accomplish and thus these details have to be posted back to the server. A simple example to illustrate the usage of PostBack is a login page. After the user has typed his username and password, he clicks on the Login button. Upon the click, the page is sent to the server to check against the database/XML file to check if the user with supplied details is an authenticated user. Then there arise certain events ( Listbox Index Changed,RadioButton Checked etc..) in an ASP.NET page upon which a PostBack might be needed. Consider the case in which you have 2 ComboBoxes. Let us say the first ComboBox asks you for the Country you reside in and the second one asks you for the State/Province in that country. Based upon the Country you select, the list of States/Provinces must be shown. Thus, in order to fill the values in the second ComboBox, the selection in the first ComboBox must be known to the server. Thus, as and when an item is selected in the first ComboBox, a PostBack must be done and the appropriate list of items must be filled in the second ComboBox. To handle these situations, you need to enable the Auto PostBack property for those controls whose events are going to trigger some kind of server processing (the case of the first ComboBox in the previous example).

IITM\BCA-303

UNIT-III

Lecture-38
AD ROTATOR CONTROL It is used to display advertisements for which images to be displayed are selected from a data source like xml file. ADROTATOR control picks these images randomly. The displayed advertisement changes whenever the page is refreshed.

CONTENT TO WRITE IN XML FILE TO DISPLAY IMAGES IN ADROTATOR CONTROL <?xml version="1.0" encoding="utf-8" ?> <Advertisements> <Ad> <ImageUrl>~/Sunset.jpg</ImageUrl> //used to specify the image to be displayed as the advertisement <AlternateText>Image not found</AlternateText> // used to specify the text to be displayed if the image at the URL doesnt display. <NavigateUrl>~/Default3.aspx</NavigateUrl> // used to specify the Url to be navigated if the user clicks on the advertisement. <Keyword>Banner1</Keyword> //used to filter image on the basis of thif keyword. </Ad> <Ad> <ImageUrl>~/Winter.jpg</ImageUrl> <AlternateText>Image not found</AlternateText> <NavigateUrl>~/Default3.aspx</NavigateUrl> <Keyword>Banner2</Keyword> </Ad> </Advertisements> NOTE:- Althogh xml tags are not predefined but in case if we are using above tags these have specific meaning for adrotator control. Every tag should be defined with first letter in caps like Ad, ImageUrl etc. Every Ad block is used to deal with a image to be displayed in adrotator control. Among thses images adrotator control picks a image o be displayed randomly. PROPERTIES OF ADROTATOR Advertisement File- used to specifies the location of an XML file that contains advertisement information

IITM\BCA-303 UNIT-III Keyword Filter - AdRotator control selects an advertisement image with a matching keyword. For e.g., in above case if Keyword Filter is set to Banner1 then only the associated image will be shown. OUTPUT: Image is being displayed in adroatra control and when user clicks on that image then he navigated to dafult3 page.

XML The extensible Markup Language (XML) is a technique of using a document, such as a text file, to describe information and making that information available to whatever and whoever can take advantage of it. The description is done so the document can be created by one person or company and used by another person or another company without having to know who first created the document or how it works. This is because the document thus created is not a program, it is not an application: it is just a text-based document. Xml uses markup which is an instruction that defines XML. Syntax of Xml markup is <tag>. The combination of a left angle bracket "<", the right angle bracket ">", and inside that we type a symbol is called a markup. XML is very flexible, which can be used in regular Windows applications and in web-based systems. XML has strict rules that defines that how the content of the document must be structured. An XML document can be used by a program that can read that xml document, analyze it, and interpret it. This program is called a parser. The most popular parser used in Microsoft Windows applications is MSXML. XML stands for Extensible Markup Language. It is much like HTML but in XML tags are not predefined. We need to define our own tags for e.g. <?xml version="1.0"> <Menu> <Starters> <Soup/> <Spring_roll/> <Chilli_Chicken/> </Starters> <Main_course> <Dal_makhani> <Nan/> <Pulao/> <Main_course/> </Menu>

IITM\BCA-303 UNIT-III The first line is the XML declaration. It defines the XML version (1.0). The next line describes the root element of the document <Menu> The next line describes first child element of the root. < Starters > First child element (Starters) further has three child elements. <Soup/> <Spring_roll/> <Chilli_Chicken/>

The next line defines the end of the child element. Similarly, one more child element (Main_course) is defined for the root element (Menu) which in turn has three child elements. And finally the last line defines the end of the root element. </Menu> XML is designed to be self-descriptive. It is based on W3C Recommendation. Above example shows a XML document containing a menu of a restaurant which serves soups, Spring roll, Chilli Chicken as starters and Dal makhani, Nan and Pulao as Main course. That is why we say that XML document uses a self-describing and very simple syntax. XML Document forms a Tree Structure. XML document must contain a root element. This element works as the parent of all other elements. All XML Elements should also have a Closing Tag. The tree starts at the root and branches to the lowest level of the tree. All elements can have sub elements (child elements). The terms parent, child, and sibling are used to describe the relationships between elements. Parent elements have children. Children on the same level are called siblings (brothers or sisters). The relationship between root and child elements is shown below: <root> <child> <sub child></sub child> </child> </root> XML document does not do anything actually. It is just pure information wrapped in tags. XML is Just Plain Text. Software that can handle plain text can also handle XML. However, XML-aware applications can handle the XML tags specially. The functional meaning of the tags depends on the nature of the application. Like in example explained above this XML document can be used by the application which deals with restaurant Menu. XML is not a replacement for HTML but it is a complement to HTML. HTML is used to format and display the data whereas XML is used to transport, carry data. With XML, data can easily be exchanged between incompatible systems. XML can be used to Create New Internet Languages for e.g., XHTML, WAP and WML are created using XML.

IITM\BCA-303 THE DIFFERENCE BETWEEN XML AND HTML S.NO 1. XML (Extensible Markup Language) It is Extensible Markup Language which can be used to define our own tags i.e., With XML You Invent Your Own Tags. XML is about carrying information.

UNIT-III

HTML (Hypertext Markup Language) It is Hypertext Markup Language. Using HTML we cannot define our own tags. HTML documents can only use tags defined in the HTML standard. HTML is used to display information.

2. 3. 4.

XML will generate any error if elements don't In HTML, if elements that don't have a closing have a closing tag. tag will not generate any error. XML Tags are Case Sensitive. As well as Opening and closing tags must be written with the same case. HTML Tags are not Case Sensitive.

5.

XML Elements should be Properly Nested for In HTML, we may define improperly nested e.g. elements for e.g. <b><i>This text is bold and italic</i></b> <b><i>This text is bold and italic</b></i> HTML truncates multiple white-space characters to one single white-space.

6.

White-space is preserved in XML. XML do not truncate white-space in a document. XML: Hello my name is Reema. my name is Reema. Output: Hello

HTML: Output:

Hello

my name is Tove

Hello my name is Tove.

XML elements can have attributes just like in HTML. In XML the attribute value must always be quoted for e.g. <Body color= "Red">. <Body color= Red> will generate error. Some characters have a special meaning in XML for e.g. "<". <message>if salary < 1000 then</message> The above syntax will generate an error. To remove this error, we can replace the "<" character with an entity reference &lt;. There are 5 predefined entity references in XML: &lt; &gt; &amp; &apos; < > & ' less than greater than ampersand apostrophe

IITM\BCA-303 &quot; "

UNIT-III quotation mark

Note: The syntax for writing comments in XML is similar to that of HTML. <! -- This is a comment --> NAVIGATION CONTROLS 1. SITEMAPPATH WEB SERVER CONTROL The SiteMapPath displays a navigation path that shows the user the current page location and displays links as a path back to the home page. The SiteMapPath control obtains navigation data from a Web.sitemap file. This FILE stores information about the pages in your Web site, such as the URL, title, description, and location in the navigation hierarchy. Storing navigation data in one place makes it easier to add and remove items in the navigational menus of a Web site. The following code example shows site-map data that is included in a Web.sitemap file. <siteMap> <siteMapNode url="HomePage.aspx" title="Home" description="This is my Home Page"> <siteMapNode url="Parent.aspx" title=" Services" description=" Services we offer "> <siteMapNode url="First Child.aspx" title=" Training" description=" Training classes" /> <siteMapNode url="Second Child.aspx" title=" Consulting" description=" Consulting services" /> </siteMap> Note: - Only pages that are listed in the site map can display navigation data in the SiteMapPath control. If you place a SiteMapPath control on a page that is not listed in the site map, the control will display nothing to the client. You can add a SiteMapPath control to the First Child.aspx page by adding the following code. <asp:SiteMapPath ID="SiteMapPath1" Runat="server"></asp:SiteMapPath> When the First Child.aspx page is viewed in the browser, the SiteMapPath control displays something like the following, with Home and Services rendered as hyperlinks: Home > Services > Training You can use the SiteMapPath control to create site navigation without code and without binding data. The SiteMapPath control enables users to navigate backward. However, the SiteMapPath control does not enable users to navigate forward. For example, you can use the SiteMapPath control in newsgroup or message board applications to enable users to see the path to the article that they are currently browsing. 2. TREEVIEW WEB SERVER CONTROL The TreeView control is used to display hierarchical data, such as a table of contents or file directory, in a tree structure. Features The TreeView control supports the following features:

IITM\BCA-303 UNIT-III 1. Automatic data binding: - which allows the nodes of the control to be bound to hierarchical data, such as an XML document. You can bind a TreeView control to a data source that supports the IHierarchicalDataSource interface, such as the XmlDataSource and SiteMapDataSource controls. 2. Site navigation support through integration with the SiteMapDataSource control. 3. Node text that can be displayed as either text or hyperlinks. The TreeView control can display several different types of data: static data that is specified declaratively in the control, data that is bound to the control, or data that is added to the TreeView control programmatically, in response to user actions that is, dynamically. Displaying Static Data We can display static data in the TreeView control by creating a collection of TreeNode elements that are children of the TreeView control. These child elements are also known as child nodes. The following example shows the markup for a TreeView control that contains three nodes, two of which have child nodes. <asp:TreeView ID="MyTreeView" Runat="server"> <Nodes> <asp:TreeNode Value="Child1" Expanded="True" Text="1"> <asp:TreeNode Value="Grandchild1" Text="A" /> <asp:TreeNode Value="Grandchild2" Text="B" /> </asp:TreeNode> <asp:TreeNode Value="Child2" Text="2" /> <asp:TreeNode Value="Child3" Expanded="True" Text="3"> <asp:TreeNode Value="Grandchild1" Text="A" /> </asp:TreeNode> </Nodes> </asp:TreeView> OUTPUT:-

TreeView Node Types The TreeView control is made up of one or more nodes. Each entry in the tree is called a node and is represented by a TreeNode object. The following table describes the three different node types. Node type 1. Root: A node that has no parent node and one or more child nodes. 2. Parent: A node that has a parent node and one or more child nodes. 3. Leaf: A node that has no child nodes. Each node has a Text property and a Value property. The value of the Text property is displayed in the TreeView control, while the Value property is used to store any additional data about the node. When a node of the TreeView control is clicked, it may navigate to another page if NavigateUrl property is set.

IITM\BCA-303 3. MENU WEB SERVER CONTROL

UNIT-III

The ASP.NET Menu control allows us to develop both statically and dynamically displayed menus for your ASP.NET Web pages. The Menu control has two modes of display: static and dynamic. Static display means that the Menu control is fully expanded all the time. The entire structure is visible, and a user can click on any part. In a dynamically displayed menu, only the portions you specify are static, while their child menu items are displayed when the user holds the mouse pointer over the parent node. We can configure the contents of the Menu control directly in the control, or you can specify the contents by binding the control to a data source. Without writing any code, we can control the appearance, orientation, and content of an ASP.NET Menu control. PROPERTIES 1. Static Display Behavior: We can control static display behavior by using the StaticDisplayLevels property of the Menu control which indicates how many levels to display statically from the root of the menu. For example, if it is set to 3, our menu will be expanded to statically display its first three levels. The minimum static display level is 1, and the control will throw an exception if the value is set to 0 or a negative number. 2. Dynamic Display Behavior: The MaximumDynamicDisplayLevels property specifies how many levels of dynamically appearing menu nodes should be displayed after the static display level. For example, if your menu has a static level of 3 and a dynamic level of 2, the first three levels of your menu would be statically displayed, while the next two levels would be dynamic. If it is set to 0, no menu nodes will be dynamically displayed. 3. Appearance and Behavior: We can adjust the behavior of the Menu control through the Orientation property. To change the Menu orientation from horizontal to vertical, you can set the Orientation property as follows: - Menu.Orientation = Orientation.Vertical 4. We can set individual properties of the Menu control to specify the size, color, font, and other characteristics of its appearance. How to Define Menu Content:We can define content for the Menu control in two ways: by adding individual MenuItem objects and by data binding the control to an XML data source. 1. Adding Menu Items Manually We can add individual menu items to the control by specifying them in the Items property. The Items property is a collection of MenuItem objects. The following example shows the declarative markup for a Menu control with three items, each of which has two child items: <asp:Menu ID="Menu2" runat="server" StaticDisplayLevels="3"> <Items> <asp:MenuItem Text="File" Value="File"> <asp:MenuItem Text="New" Value="New"></asp:MenuItem> <asp:MenuItem Text="Open" Value="Open"></asp:MenuItem> </asp:MenuItem> <asp:MenuItem Text="Edit" Value="Edit"> <asp:MenuItem Text="Copy" Value="Copy"></asp:MenuItem> <asp:MenuItem Text="Paste" Value="Paste"></asp:MenuItem> </asp:MenuItem> <asp:MenuItem Text="View" Value="View"> <asp:MenuItem Text="Normal" Value="Normal"></asp:MenuItem> <asp:MenuItem Text="Preview" Value="Preview"></asp:MenuItem> </asp:MenuItem> </Items> </asp:Menu> Output:

IITM\BCA-303

UNIT-III

Output if StaticDisplayLevels is not set:

2. Data Binding to an XML Data Source Binding to an XML file allows us to control the menu's content through edits to the file, rather than by using the designer. This allows you to update the navigational aspect of your site without revisiting the Menu control or editing any code. If you have a site with changing content, an XML file can be used to organize the content.

IITM\BCA-303

UNIT-III

Lecture-39 FileUpload Control It is another rich web server control used to upload file that can be stored on the server. Write following code in Default.aspx Page:<form id="form1" runat="server"> <asp:FileUpload id="FileUploadControl" runat="server" /> <asp:Button runat="server" id="UploadButton" text="Upload" onclick="UploadButton_Click" /> <br /><br /> <asp:Label runat="server" id="StatusLabel" text="Upload status: " /> </form> Now write given below code in Default.aspx.vb :Imports System.IO Protected Sub UploadButton_Click () Handles UploadButton.Click Dim filename As String If (FileUploadControl1.HasFile) then Try filename=Path.GetFileName(FileUploadControl1.FileName) FileUploadControl1.SaveAs(Server.MapPath(~/)+filename) StatusLabel.Text=Upload Status:File Upload! Catch ex as Exception StatusLabel.Text=Upload Status:The file couldnot be uploaded.The following error occurred +ex.message End Try End If End Sub VALIDATION CONTROLS

IITM\BCA-303 UNIT-III Validation controls are used to validate the values that are entered into other controls of the page. Validation controls perform client-side validation, server-side validation, or both, depending on the capabilities of the browser in which the page is displayed. Validation controls offer the following advantages:

We can associate one or more validation controls with each control that we want to validate. The validation is performed when the page form is submitted. We can specify programmatically whether validation should occur, which is useful if you want to provide a cancel button so that the user can exit without having to fill valid data in all of the fields. The validation controls automatically detect whether validation should be performed on the client side or the server side. A validation control can always be binded to a single control only. A single standard control can be binded with any no of validation controls If the user doesnt specify the input for the binded control then all the validation controls other than required field validator will fail.

NOTE

a.) REQUIRED FIELD VALIDATOR It is used to validate a control in case it is left blank. This property is associated to the ID of the SelectionList or Textbox control to be validated. It shows error message in case if the field is left blank or if no change is being taken place in the control if initial value property is set to some value. PROPERTIES Control To Validate: It is set to the name of the control which has to be validated Error Message or Text: Specify the message to be displayed if the validation control fails. Initial Value: If any initial value is set then this control matches the initial value with the default value of the control to be validated. b.) COMPARE VALIDATOR CONTROL It is used to compare the value of one control with the value of the other control or with a specific value. If they dont match then error message is generated. PROPERTIES Control to compare: Set to the field which is to be compared. For eg, password field Control to validate: Set to the field which is to be validated. For eg, Conform password field Value to compare: In case if the control to be validated on the basis of a value then this property can be used to specify the value that is to be compared with that control. Operator: used to specify the mode to be used for comparing the values of the controls. It can be use to specify the operator like greater than, equal to, less than etc. By Default it is equal. Type: used to specify the data types for the values to be compared. For e.g., Double, Integer, Date etc. Error Message or Text: Used to display error message in case value of compared controls are not matched. c.) RANGE VALIDATOR CONTROL It is used to verify the control for a value on the basis of specified range. This control compares the value of the control to be validated within the rage specified with the help of max and min property. PROPERTIES Control To Validate: It is set to the name of the control which has to be validated Maximum Value: Specify the Upper Range Minimum Value: Specify the lower range

IITM\BCA-303 UNIT-III Type: Specify the data type to be used for comparison. By default it is String Value. Error Message or Text: Specify the message to be displayed if the validation control fails. d.) CUSTOM VALIDATOR CONTROL It is used to validate the given user input based on the requirements of an application. In order to specify the validation code it should be written in server validate event handler. PROPERTIES Control To Validate: It is set to the name of the control which has to be validated. Error Message or Text: Specify the message to be displayed if the validation control fails. Note: if any client side custom validation has to be performed then write the Java Script function and then specify the name of that function for the ClientValidation Function Property of the custom validator. For e.g., if we wish that a field like mobile number should contain a value of length 10 character than we can use this control. The appropriated handling code can be given in default event handler ServerValidate. If user specifies the value to be of more length than expected then error message will be shown. Protected Sub CustomValidator1_ServerValidate(ByVal source As Object, ByVal args System.Web.UI.WebControls.ServerValidateEventArgs) Handles CustomValidator1.ServerValidate If args.Value.Length > 10 Then args.IsValid = False Else args.IsValid = True End If End Sub As

e.) VALIDATION SUMMARY CONTROL It is used to print the summary of all the validation controls. In case if any validation is not meet then this control uses all those validation controls text or error message properties to display error message summary. The error specified for the other validation controls will be considered as the input or text for the validation summary Control. PROPERTIES Show Summary: will display the error messages on the web form f.) REGULAR EXPRESSION VALIDATOR It is used to match the value in the control against a predefined pattern. For e.g., if want that a particular field should contain the value of type email then we can use this control. PROPERTIES: Control To Validate: It is set to the name of the control which has to be validated Validation Expression: - It is used to specify the search pattern. Error Message or Text: Specify the message to be displayed if the validation control fails. C) LIST CONTROLS List controls are special Web server controls that support binding to collections. We can use list controls to display rows of data in a customized format. All list controls uses DataSource and DataMember properties,

IITM\BCA-303 which are used to bind to collections. 1. ListBox Web Server Control 2. CheckBoxList Web Server Control 3. RadioButtonList Web Server Control 4. Repeater Web Server Control 5. DataList Web Server Control 6. DataGrid Web Server Control 7. DropDownList Web Server Control D) RICH CONTROLS

UNIT-III

ASP.NET page framework provides a few, task-specific controls called rich controls. Rich controls are built with multiple HTML elements and contain rich functionality. Examples of rich controls are the Calendar Web Server control, Xml Web Server Control and the AdRotator control.

Lecture-40
ASP.NET LOGIN CONTROLS The ASP.NET login controls provide a robust login solution for ASP.NET Web applications without requiring programming. We can use the ASP.NET Login controls to build a user registration system for a website. We can use the Login controls to display user registration forms, login forms, change password forms, and password reminder forms. When we use the Login controls, we are not required to write any code when performing these tasks.By default, login controls integrate with ASP.NET membership and forms authentication to help automate user authentication for a Web site. 1. LOGIN CONTROL The login control displays a user interface for user authentication. The login control contains text boxes for the user name and password and a check box that allows users to indicate whether they want the server to store their identity using ASP.NET membership and automatically be authenticated the next time they visit the site.

IITM\BCA-303 UNIT-III The login control has properties for customized display, for customized messages, and for links to other pages where users can change their password or recover a forgotten password. If we use the login control with ASP.NET membership, you do not need to write code to perform authentication. <form id="form1" runat="server"> <div> <asp:Login id="Login1" CreateUserText="Register" CreateUserUrl="~/Register.aspx" Runat="server" /> </div> PROPERTIES 1. Adding CreateUserText and CreateUserUrl properties causes the control to display a link to a page that enables a new user to register for your application. 2. You can change the layout of the Login control by modifying the Login control's Orientation property. If you set this property to the value Horizontal, then the Username and Password text boxes are rendered in the same row. 3. Set the DestinationPageUrl property in order to navigate to the next page. 2. LOGIN VIEW CONTROL The loginview control allows us to display different information to anonymous and logged-in users. The control displays one of two templates: the anonymoustemplete or the loggedintemplete. In these templates, we can add markup and controls that display information appropriate for anonymous users and authenticated users, respectively. <asp:LoginView id="LoginView1" Runat="server"> <AnonymousTemplate> This content is displayed to anonymous users. </AnonymousTemplate> <LoggedInTemplate> This content is displayed to authenticated users. </LoggedInTemplate> </asp:LoginView> For e.g. in above case different content will be displayed to different users. In case if an anonymous users visits the web page then he will be shown the This content is displayed to anonymous users content and if an authorized user visits the page then This content is displayed to authenticated users will be shown. Output when anonymous visits the page:-

IITM\BCA-303

UNIT-III

3. LOGIN STATUS CONTROL The loginstatus control displays a login link for users who are not authenticated and a logout link for users who are authenticated. The login link takes the user to a login page. The logout link resets the current user's identity to be an anonymous user. The page also includes a LoginStatus control. You can use this control to log in and log out quickly. You can customize the appearance of the loginstatus control by setting the logintext and loginimageurl properties.

4. LOGIN NAME CONTROL The loginname control displays a user's login name if the user has logged in using ASP.NET membership. Alternatively, if the site uses integrated Windows authentication, the control displays the user's Windows account name.

5. PASSWORDRECOVERY CONTROL The PasswordRecovery control allows user passwords to be retrieved based on the e-mail address that was used when the account was created. The PasswordRecovery control sends an e-mail message containing a password to the user. We can also configure membership to include a security question that the user must answer to recover a password. The PasswordRecovery control asks the question and checks the answer before recovering the password.

IITM\BCA-303 UNIT-III The PasswordRecovery control requires that the application can forward e-mail message to a Simple Mail Transfer Protocol (SMTP) server. You can customize the text and format of the e-mail message sent to the user by setting the maildefinition property. PasswordRecovery Control looks like as follows:-

If the user is a authenticated user then, following screen would appear which will ask answer for security ques.

6. CREATEUSERWIZARD CONTROL The CreateUserWizard control collects information from potential users. By default, this control adds the new user to the ASP.NET membership system. The control gathers the following user information:

User name Password Confirmation of password E-mail address Security question Security answer id="CreateUserWizard1" ContinueDestinationPageUrl="~/SecretFiles/Secret.aspx"

<asp:CreateUserWizard Runat="server" />

CREATE USER WIZARD SUPPORTS 2 VIEWS:1. Signup for new account view

IITM\BCA-303

UNIT-III

2. Complete view

This information is used to authenticate users and recover user passwords, if necessary. The default ASP.NET Membership provider requires you to create a password that contains at least seven characters, and at least one of the characters must be non-alphanumeric (not a letter and not a number). So, secret_ is a valid password, but not secret9. 7. CHANGEPASSWORD CONTROL The ChangePassword control allows users to change their password. The user must first supply the original password and then create and confirm the new password. If the original password is correct, the user password is changed to the new password. The control also includes support for sending an e-mail message about the new password. The ChangePassword control includes two template views that are displayed to the user. The first is the changepasswordtemplete which displays the user interface used to gather the data required to change the user password. The ChangePassword control works with authenticated and non-authenticated users. If a user has

IITM\BCA-303 UNIT-III not been authenticated, the control prompts the user for a login name. If the user is authenticated, the control populates the text box with the user's login. CHANGE PASSWORD TEMPLETE

SUCCESS TEMPLETE The second template is the successtemplete which defines the user interface that is displayed after a user password has been successfully changed.

Lecture-41
OVERVIEW OF STATE MANAGEMENT INTRODUCTION In normal HTTP protocol, the only information that the server has about a page is the information that the user has specified using controls on the page, because the browser sends only that information to the server when the page is posted. Other information, such as variable values and property settings, is discarded. ASP.NET helps preserve other page information in the following ways:-

IITM\BCA-303

UNIT-III

1. ASP.NET saves control settings (properties) between round trips, which is called saving control state. 2. ASP.NET provides state management capabilities so we can save our own variables and application-specific or session-specific information between round trips with the help of following:View state Hidden fields Cookies Query strings Application state Session state CLIENT-BASED STATE MANAGEMENT OPTIONS VIEW STATE The ViewState property provides a dictionary object for retaining values between multiple requests for the same page. This is the default method that the page uses to preserve page and control property values between round trips.When the page is processed, the current state of the page and controls is hashed into a string and saved in the page as a hidden field, when the page is posted back to the server; the page parses the view-state string at page initialization and restores property information in the page. We can store values in view state as well. How to do:Create a web application by taking to web forms (default, and default2). On default1 page take a textbox and button. Set the postbackurl property of button1 present on default page to default2 page. So, when we will give some value to textbox at run time and click button then it will navigate to default2 page.On default2 page take a label control and write the code written below on form load event:On default page Viewstate(id)=textbox1.text //to give value present in textbox1 to view state of default page. On default2 page Texxtebox1.text=viewstate(id) //to retrieve value present in textbox1 of default page. HIDDEN FIELDS ASP.NET allows us to store information in a Hidden Field control, which renders as a standard HTML hidden field. A hidden field does not render visibly in the browser, but we can set its properties just as we can with a standard control. When a page is submitted to the server, the content of a hidden field is sent in the HTTP form collection along with the values of other controls. A hidden field acts as a repository for any page-specific information that you want to store directly in the page. A Hidden Field control stores a single variable in its Value property. To use value of hiddenfield control:Dim i as integer I=hiddenfield1.value // i will get value of hiddenfield control

COOKIES A cookie is a small amount of data that is stored either in a text file on the client file system or in-memory in the client browser session. It contains site-specific information that the server sends to the client along with page output. Cookies can be temporary (with specific expiration times and dates) or persistent.

IITM\BCA-303 UNIT-III You can use cookies to store information about a particular client, session, or application. The cookies are saved on the client device, and when the browser requests a page, the client sends the information in the cookie along with the request information. The server can read the cookie and extract its value. To give value to cookie:Response.cookies(id).value=123 To retrieve value to cookie:Label1.text=Request.cookies(id).value.tostring() QUERY STRING A query string is information that is appended to the end of a page URL. A typical query string might look like as following:http://www.contoso.com/listwidgets.aspx?category=basic&price=100 In the URL path above, the query string starts with a question mark (?) and includes two attribute/value pairs, one called "category" and the other called "price." Query strings provide a simple but limited way to maintain state information. For example, they are an easy way to pass information from one page to another, such as passing a product number from one page to another page where it will be processed. In order for query string values to be available during page processing; we must submit the page using an HTTP GET command. How to do:Create a web application by taking to web forms (default, and default2). On default1 page take a textbox and button. Set the postbackurl property of button1 present on default page to default2 page. So, when we will give some value to textbox at run time and click button then it will navigate to default2 page.On default2 page take a label control and write the code written below on form load event:Label1.text=Request.form(textbox1.text).tostring() //in case of post method Label1.text=Request.querystring (textbox1.text).tostring() //in case of get method Request.form and Request.querystring method are used to request a web page to give value of a particular control which is passed as argument. In this case it is textbox. So, in this way deault2 page can access value of textbox1 of default page. SERVER-BASED STATE MANAGEMENT OPTIONS ASP.NET offers us a variety of ways to maintain state information on the server, rather than persisting information on the client. With server-based state management, we can decrease the amount of information sent to the client in order to preserve state, however it can use costly resources on the server. APPLICATION STATE ASP.NET allows us to save values for each active Web application. Application state is a global storage mechanism that is accessible from all pages in the Web application. Thus, application state is useful for storing information that needs to be maintained between server round trips and between requests for pages. For more information, see ASP.NET Application State Overview. Application state is stored in a key/value dictionary that is created during each request to a specific URL. We can add your application-specific information to this structure to store it between page requests. Once you add your application-specific information to application state, the server manages it. To give value to Application:Application (id).value=123 To retrieve value to Application:-

IITM\BCA-303 Label1.text= Application (id).value.tostring()

UNIT-III

SESSION STATE ASP.NET allows us to save values by using session state for each active Web-application session. Session state is similar to application state, except that it is scoped to the current browser session. If different users are using your application, each user session will have a different session state. In addition, if a user leaves application and then returns later, the second user session will have a different session state from the first. To give value to session:Session (id).value=123 To retrieve value to session:Label1.text= Session (id).value.tostring() DIFFERENCES BETWEEN SESSION & COOKIES It will be maintained in the web server system.So it is called as server side management. Session can represent objects More security for data Accessing will be slow It will be maintained in the client system. So it is called as client side state management. Cookie can represent plain text Less security for data. Accessing would be faster.

USER CONTROLS Often, we may want to reuse the user interface of your Web Form without having to write any extra code. ASP.NET enables us to do this by converting your Web Forms into user controls. User controls, which have the .ascx file extension, can be used multiple times within a single Web Form. To convert a Web Form into a user control, follow these steps: 1. Remove all <html>,<head>, <body> and <form> tags. 2. If the @ Page directive appears in the page, change it to @ Control. 3. Include a className attribute in the @ Control directive so that the user control is typed strongly when you instantiate it. 4. Give the control a descriptive file name, and change the file extension from .aspx to .ascx.

IITM\BCA-303

UNIT-III

Lecture-42 ADO.NET IN ASP.NET


'THIS PROGRAM IS FOR ATTACHING GRIDVIEW AND LISTBOX WITH SQL SERVER WHICH IS ALREADY EMBEDED IN VISUAL STUDIO 2005 'U CAN ALSO COONECT ASP.NET WEBSITE PAGE TO ALREADY CREATED DATABASE IN SQL SERVER 2000 IN SAME MANNER AS DID IN MSACCESS 'TO ACCESS SQL SERVER WHICH IS PRESENT IN VISUAL STDIO 2005 FOLLOW STEPS '1. GO TO SOLUTION EXPLORER->RIGHT CLICK->CHOOSE ADD NEW ITEM->SELECT SQL DATABASE '2. GO TO SERVER EXPLOREE WHERE U CAN SEE YOUR SQL SERVER DATABASEIN DATA CONNECTION FOLDER. '3. TO ADD TABLES IN THIS DATABASE...GOTO DATABASE(IN THIS CASE, Database.mdf)>TABLES->RIGHT CLICK->CHOOSE ADD NEW TABLE '4. SAVE THIS TABLE '5. CREATE FIELDS IN THIS DATABASE AND THEN AFTER ADD DATA INTO DATABASE.RIGHT CLICK ON YOU CREATED TABLE->CHOOSE SHOW TABLE DATA. '6. AFTER PROVIDING DATA INTO DATABASE, SAVE IT. 'IMPORT THIS STATEMENT FOR SQL SERVER 'NOTE:= VISUAL STUDIO 2005 WILL WORK WITH SQL SERVER 2000 VERSION, NOT WITH 2005 VERSION. Imports System.Data.SqlClient Partial Class SqlServer_page Inherits System.Web.UI.Page

Connected Architecture
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click 'for connected arch. you need to open connection and close connection explictly. Dim con As New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Team\My Documents\Visual Studio 2005\WebSites\connectivity\App_Data\Database.mdf;Integrated Security=True;User Instance=True") 'fetch this connection string from properties of your SQL database. 'goto server explorer->goto you database folder(in this case it is DATABASE.MDF) 'right click on database folder(DATABASE.MDF)->RIGHT CLICK->properties->select connection string Dim cmd As New SqlCommand cmd.Connection = con cmd.CommandText = "select * from SQLTABLE" Dim dr As SqlDataReader con.Open() dr = cmd.ExecuteReader()

IITM\BCA-303 GridView1.DataSource = dr GridView1.DataBind() con.Close() End Sub

UNIT-III

Disconnected Architecture
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click Dim con As New SqlConnection con.ConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Shilpa\My Documents\Visual Studio 2005\WebSites\connectivity\App_Data\Database.mdf;Integrated Security=True;User Instance=True" Dim ada As New SqlDataAdapter("select * from SQLTABLE", con) Dim dt As New Data.DataTable() ada.Fill(dt) For i As Integer = 0 To dt.Rows.Count - 1 ListBox1.Items.Add(dt.Rows(i)("ID") + vbTab + dt.Rows(i)("NAME")) Next End Sub End Class Code for dispalying,insert,delete and update data in disconnected architecture in textboxes in windows application(Using access):Imports System.Data.OleDb Public Class Form1 Dim con As OleDbConnection Dim ada As OleDbDataAdapter Dim dt As New DataTable() Dim i As Integer Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim dt As New DataTable() Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) Dim dr As DataRow dr = dt.NewRow() dr("id") = CInt(TextBox1.Text) dr("nam") = TextBox2.Text

IITM\BCA-303 dt.Rows.Add(dr) ada.Update(dt) End Sub

UNIT-III

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim dt As New DataTable() Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) dt.Rows(i).Delete() ada.Update(dt) End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) dt.Rows(i)("Nam") = "zzz" ada.Update(dt) End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click i=1 display() End Sub Sub display() TextBox1.Text = dt.Rows(i)("id") TextBox2.Text = dt.Rows(i)("nam") End Sub Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click i=i-1 display() End Sub Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click i=i+1 display() End Sub Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click i = dt.Rows.Count - 1 display() End Sub

IITM\BCA-303 UNIT-III Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) 'Dim dt As New DataTable() ada.Fill(dt) display() End Sub End Class Code for dispalying,insert,delete and update data in disconnected architecture in textboxes in web application (Using access):-

Imports System.Data.OleDb Partial Class _Default Inherits System.Web.UI.Page Dim con As OleDbConnection Dim ada As OleDbDataAdapter Dim dt As New Data.DataTable Dim i As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load con = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\Webconnectivity\App_Data\database.mdb") ada = New OleDbDataAdapter("select * from stu", con) ada.Fill(dt) GridView1.DataSource = dt GridView1.DataBind() display() End Sub Sub display() TextBox1.Text = dt.Rows(i)(0) TextBox2.Text = dt.Rows(i)(1) HiddenField1.Value = i

IITM\BCA-303 End Sub

UNIT-III

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click i=0 display() End Sub Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click i=i-1 display() End Sub Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click i=i+1 display() End Sub Protected Sub Button4_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button4.Click i = dt.Rows.Count - 1 display() End Sub Protected Sub Button5_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button5.Click Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) Dim dr As Data.DataRow dr = dt.NewRow() dr("id") = TextBox1.Text dr("nam") = TextBox2.Text dt.Rows.Add(dr) ada.Update(dt) End Sub Protected Sub Button7_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button7.Click Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) dt.Rows(i)("Nam") = "zzz" ada.Update(dt) End Sub Protected Sub Button6_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button6.Click

IITM\BCA-303 Dim con As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\Deepa\programs\connectivity\connectivity\database.mdb") Dim ada As New OleDbDataAdapter("select * from stu", con) Dim cmd As New OleDbCommandBuilder(ada) ada.Fill(dt) dt.Rows(i).Delete() ada.Update(dt) End Sub End Class NOTE: GLOBAL.ASAX FILE

UNIT-III

Its a collection of events where the code written in those events will be executed implicitly whenever the relevant event takes place. In order to work with the application and the session objects and to handle the events in a proper manner global.asax file should be used. WEB.CONFIG FILE Configuration settings for the user website are managed in a Web.config file that is located in the site's root folder.

IITM\BCA-303

UNIT-III

Lecture-43 Data Controls The Data Tools Available

The controls divide into 4 camps: data sources, multiple row data controls , single row data controls and other tools. Data Sources The data source controls are: Control Notes AccessDataSource EntityDataSource LinqDataSource ObjectDataSource SqlDataSource XmlDataSource Linking to MS Access data Linking to entity models Use this if you're using LINQ to connect to data Use if you've created your own business objects Linking to SQL Server Linking to data in XML format

SiteMapDataSource Used as a basis for site map control data (eg navigational menus)

IITM\BCA-303 Single Row Data Controls The controls for displaying a single record from a database are: Control Notes FormView Displays a template for all the fields in the underlying record DetailsView A more restricted way to display a single record in table format Other Controls The "other" controls are: Control Notes Pointer Chart Used for selection in Visual Studio Self-explanatory?

UNIT-III

QueryExtender Use this with the entity or LINQ data source controls to simplify filtering of data. Multiple Row Data Controls This leaves the multiple row data controls, the subject of this article. These are: Control Notes Repeater A simple control for displaying data in tabular format DataList ListView Allows you to display data in non-table format (such as columns) Like a DataList, but again giving you much more control over how the data looks and behaves GridView Like a Repeater, but giving you much more control over the the table of data appears and behaves

Você também pode gostar