SP.NET is a server-side Web application framework designed for Web development to produce dynamic Web pages. It was developed by Microsoft to allow programmers to build dynamic web sites, web applications and web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages (ASP) technology. ASP.NET is built on the Common Language Runtime (CLR), allowing programmers to write ASP.NET code using any supported .NET language. The ASP.NET SOAP extension framework allows ASP.NET components to process SOAP messages.
Scaling API-first – The story of a global engineering organization
The complete ASP.NET (IIS) Tutorial with code example in power point slide show
1. Web Server (IIS)
Information Services (IIS) 6.0 is a powerful Web
server that provides a highly reliable, manageable,
and scalable Web application infrastructure for all
versions of Windows
◦
◦
◦
◦
◦
◦
◦
Compatibility with Microsoft and Other Products
Rapid Installation and Configuration
Easy Service Management
Effortless Performance Monitoring
Easy to Implement Security
Foundation for ASP.NET
IIS pass the request from client to application
2. Web Server
Server Machine
ASP (.Net)
Web server (IIS)
http request
http request
http request
Client
Client
Machine
Machine
Client
Client
Machine
Machine
Client
Client
Machine
Machine
3. Web Server
Port Nos.
80
(Default Port)
IIS
Web
1525
Server
8899
192.168.0.12
Server IP
http://192.168.0.12/myfoler/WebForm1.aspx
http://192.168.0.12:8899/index.html
4. ASP .Net
Is the platform that we use to create Web
applications and Web services that run under IIS
At a high level, ASP.NET is a collection of .NET
classes that collaborate to process an HTTP
request and generate an HTTP response
It provides high level of consistency across web
applications
We have components like web development tools,
◦ System.web namespace
◦ Server and HTML controls
5. ASP .Net Frame Work
ASP.NET is a managed server-side framework
◦ For building applications based on HTTP, HTML, XML and SOAP
◦ ASP.NET relies on IIS for an HTTP entry point
ASP.NET supports building HTML-based Web applications
◦ Based on ASP.NET pages, Web forms and server-side controls
ASP.NET supports building Web services
◦ Based on Web service classes and WebMethods
Web Application
client
Web Service
client
HTML over HTTP
IIS
XML/SOAP over HTTP
ASP.NET
CLR
Windows 2000 or Windows .NET Server
6.
Executable portion of a web application are compiled
Enriched tool support
ASP.NET applications are based on CLR, so therefore
they are powerful and flexible.
On the fly updates deployed without restarting server
Better session management
Integration with ADO.NET
Built in features for caching
XML Web services let you create distributed Web
applications
Browser-independent
Language-independent
7. ASP.NET
programming model is based
on applications
◦ Each application is based on IIS virtual
directory
◦ Each application is contained within a
physical directory
◦ Each application runs in its own isolated
AppDomain
8.
AssemblyInfo.cs
◦ All the information about assembly including version
company name etc
Webform1.aspx
◦ The visual description of a Web form.
Webform1.aspx.cs/vb
◦ The code that responds to events on the Web form
Global.asax
◦ The global events that occur in web application are here
9.
Web.config
◦
It is a XML file that web server uses when processing this
application
References
◦
◦
◦
◦
System
System.Data
System.Drawing
System.XML
10.
Webform Views
◦ Design view
The design View represents the user interface.
◦ HTML view.
Represents ASP.NET syntax for the webpage
12. Component
Examples
Server controls
TextBox
Label
Button
ListBox
DropDownList
DataGrid
HTML controls
Text Area
Table
Image
Submit Button
Reset Button
Data controls
SqlConnection
SqlCommand,
OleDbConnection,
OleDbCommand
DataSet
Description
These controls respond to user events
by running event procedures on the
server. Server controls have built-in
features for saving data that the user
enters between page displays.
These represent the standard visual
elements provided in HTML. HTML
controls are useful when the more
complete feature set provided by
server controls is not needed.
Data controls provide a way to connect
to, perform commands on, and
retrieve data from SQL and OLE
databases and XML data files.
13.
ASP.NET stores items added to a page’s ViewState
property as hidden fields managed by the ASP.NET
page framework.
As soon as form is submitted for processing, all
information relevant to the view state of the page is
stored within this hidden form field.
View state is enabled for every page by default.
14.
Hidden ViewState control of name-value pairs stored in the
Web Form
Adjustable at Web Form and control level
<input type="hidden" name="__VIEWSTATE"
value="dDwtMTA4MzE0MjEwNTs7Pg==" />
<%@ Page EnableViewState="False" %>
<asp:ListBox id="ListName"
EnableViewState="true" runat="server">
</asp:ListBox>
15. The validation controls check the validity of data
entered in associated server controls on the client
before the page is posted back to the server.
Supports validation on client and server
Client-side validation is provided by a JScript
library named WebUIValidation.js
Can force down-level option
<% @ Page Language="c#"
ClientTarget="DownLevel" %>
16. Validation control
Description
RequiredFieldValidator
Check whether a control contains data
CompareValidator
Check whether an entered item matches an entry in
another control
Check whether an entered item is between two values
RangeValidator
ValidationSummary
Display validation errors in a central location or display a
general validation error description
18. Session State
HTTP is a stateless protocol, which means that it does not automatically indicate whether a sequence of requests is
all from the same client or even whether a single browser instance is still actively viewing a page or site. As a result,
building Web applications that need to maintain some cross-request state information (shopping carts, data scrolling,
and so on) can be extremely challenging without additional infrastructure help.
ASP.NET provides the following support for sessions:
•A session-state facility that is easy to use, familiar to ASP developers, and consistent with other .NET
Framework APIs.
•A reliable session-state facility that can survive Internet Information Services (IIS) restarts and workerprocess restarts without losing session data.
•A scalable session-state facility that can be used in both Web farm (multicomputer) and Web garden
(multiprocess) scenarios and that enables administrators to allocate more processors to a Web application to
improve its scalability.
•A session-state facility that works with browsers that do not support HTTP cookies.
•A throughput equivalent to that of ASP (or better) for core session-state scenarios (50/50 read/write when
putting items into shopping carts, modifying last page visited, validating credit card details, and so on).
19. Session
Server Machine
ASP.Net Progs.
Create Session
Session Name “XX”
Session Value “cmc”
Client Machine
Client Machine
Client Machine
“XX” Session with “cmc”
“XX” Session with “cmc”
“XX” Session with “cmc”
Session “XX” is available till the browser is open, delete automatically when the browser
is closed
21. Session
User Id
Password
stud1
Web Page 2
Login
******
Web Page 1
Login ID
TextBox1
Session.Add(“user_session", TextBox1.Text)
stud1
Label1
Label1.Text=Session.Add(“user_session")
22. Cookie
•A cookie is a small piece of information stored by the browser at local disk.
• Each cookie is stored in a name =value; pair called a crumb
(that is, if the cookie name is "id" and you want to save the id's value as "this", the cookie would
be saved as id=this)
•In a cookie up to 20 name=value pairs can be stored
•Cookie is always returned as a string of all the cookies that apply to the page.
•It stores information in cookie folder.
•It expires when browser is closed if expired time is not set.
23. Cookie
Server Machine
ASP.Net Progs.
Create Cookie
Cookie Name “CC”
Cookie Value “edu”
Client Machine
Client Machine
Client Machine
Create “CC” Cookie
Create “CC” Cookie
Create “CC” Cookie
[CC]
edu
[CC]
edu
Local Disk
[CC]
edu
24. Cookie
TextBox1
Dim MyCookie As New HttpCookie("CMCcookie")
Dim now As DateTime = DateTime.Now
MyCookie.Value = TextBox1.Text
student
MyCookie.Expires = now.AddSeconds(100)
Set Cookie
Response.Cookies.Add(MyCookie)
Dim ck As HttpCookie
ck = Request.Cookies("CMCcookie")
If ck Is Nothing Then
Exit Sub
End If
TextBox1.Text = ck.Name
TextBox2.Text = ck.Value
CMCcookie
TextBox1
student
TextBox2
Show Cookie
25. Cookie
Dim i, j As Integer
Dim arr1() As String
Dim MyCookieColl As HttpCookieCollection
Dim MyCookie As HttpCookie
Display All Cookies
Display All Cookies
From Local
From Local
Machine
Machine
MyCookieColl = Request.Cookies
' Capture all cookie names into a string array.
arr1 = MyCookieColl.AllKeys
For i = 0 To arr1.GetUpperBound(0)
MyCookie = MyCookieColl(arr1(i))
Response.Write("Cookie: " & MyCookie.Name & "<br>")
Response.Write("Value " & MyCookie.Value & "<br>")
Response.Write("Expires: " & MyCookie.Expires & "<br>")
Response.Write("Secure:" & MyCookie.Secure & "<br>")
Next i
26. Application
•Application variables are, in effect, global variables for a given ASP.NET application.
•Client-side application developers, ASP.NET programmers should always consider
the impact of storing anything as a global variable.
•Share information throughout the application by using the Application class
•This class exposes a key-value dictionary of objects that you can use to store both
.NET Framework objects and scalar values related to multiple Web requests from
multiple clients.
•The memory impact of storing something in application state. The memory occupied
by variables stored in application state is not released until the value is either removed
or replaced.
27. Application
Server Machine
ASP.Net Progs.
Create Application
Session Name “My_App”
Session Value “India”
Client Machine
Accessing “My_App”
with value “India”
Client Machine
Accessing “My_App”
with value “India”
Client Machine
Accessing “My_App”
with value “India”
28. Application
Server Machine
Application(“My_App") = “India”
Client 1
India
Client 2
India
Client 3
India
x=Application(“My_App")
y=Application(“My_App")
z=Application(“My_App")
TextBox1.Text=x
TextBox1.Text=y
TextBox1.Text=z
29. Caching
•Caching, use to create high-performance Web applications.
•Caching are Output Caching and Data Caching
•Output Caching allows to store dynamic page and user control responses
•On subsequent requests, the page or user control code is not executed.
•The cached output is used to satisfy the request.
•Data Caching can use to programmatically store arbitrary objects, such as data
sets, to server memory so that your application can save the time and resources it
takes to recreate them.
30. Caching (Output Cache)
<%@ OutputCache Duration="30" VaryByParam="location;count" %>
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm1.aspx.vb" Inherits="cacheing.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<BODY>
------------------------------------------------------------------------------------------------</BODY>
</HTML>
WebForm1.aspx (Html View)
Response.Write("<font size=6>The Page was executed " & DateTime.Now.ToString + "</font>")
If RadioButton1.Checked = True Then
Label1.Text = "You have selected... Red color"
Else
Label1.Text = "You have selected... Blue color"
End If
WebForm1.aspx.vb
31. Caching (Data Cache)
Dim flag As Integer
source = Cache("MyDataCache")
If source Is Nothing Then
flag = 100
cmd = New OleDb.OleDbCommand("select * from dept ", conn)
adp = New OleDbDataAdapter(cmd)
ds = New DataSet()
adp.Fill(ds, “deptX")
source = New DataView(ds.Tables("deptX "))
Cache.Insert("MyDataCache", source, New Caching.CacheDependency(Server.MapPath("datacache")),
DateTime.Now.AddSeconds(20), Cache.NoSlidingExpiration)
End If
DataGrid1.DataSource = source
DataGrid1.DataBind()
If flag = 100 Then
Label1.Text = "Data from Database"
Else
Label1.Text = "Data from Cache"
End If
WebForm1.aspx.vb
32. Ad Rotator Control
•AdRotator control to display a randomly selected advertisement banner on the Web page.
•The displayed advertisement can change whenever the page refreshes.
•Advertisement information is stored in a separate XML file.
•The XML file allows you to maintain a list of advertisements and their associated attributes.
Attributes include the path to an image to display, the URL to link to when the control is
clicked, the alternate text to display when the image in not available, a keyword, and the
frequency of the advertisement.
33. Ad Rotator Control
Ad Rotator Contro
AdvertisementFile=“Ads.xml”
WebForm1.aspx (Design View)
<Advertisements>
<Ad>
Ads.xm
l
<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wing Tip Toys</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic2</Keyword>
</Ad>
</Advertisements>
Image1.jpg, image2.jpg
and other picture file
should be added to the
current project
34. Ad Rotator Control
Ad Rotator Contro
AdvertisementFile=“Ads.xml”
WebForm1.aspx (Design View)
<Advertisements>
<Ad>
Ads.xm
l
<ImageUrl>image1.jpg</ImageUrl>
<NavigateUrl>http://www.microsoft.com</NavigateUrl>
<AlternateText>Microsoft Main Site</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic1</Keyword>
</Ad>
<Ad>
<ImageUrl>image2.jpg</ImageUrl>
<NavigateUrl>http://www.wingtiptoys.com</NavigateUrl>
<AlternateText>Wing Tip Toys</AlternateText>
<Impressions>80</Impressions>
<Keyword>Topic2</Keyword>
</Ad>
</Advertisements>
Image1.jpg, image2.jpg
and other picture file
should be added to the
current project
35. Advanced List Controls
There are some advanced list controls like
Repeater, DataList, and DataGrid
They take collections of data and loop through them
automatically.
They act as containers for other controls that
actually display the data such as labels.
These controls are very powerful and save
developers a lot of manual work.
36. Repeater Control
Provides simple output of a list of items
Templates provide the visual form
It iterates over the bound data, rendering its
ItemTemplate once for each item in the
DataSource collection
Useful to have complete control over how data
from a data source is rendered
No paging
Can provide templates for separators
Does not provide update data
37. Repeater Control
Standard templates for Repeater controls
◦ HeaderTemplate: rendered once before all data bound
rows
◦ ItemTemplate: rendered once for each row in the data
source
◦ AlternatingItemTemplate: like ItemTemplate, but when
present is used for every other row
◦ SeparatorTemplate: rendered between each row
◦ FooterTemplate: rendered once, after all data bound rows
38. Repeater Control
To bind embedded controls to the data source of
the container control DataBinder.Eval() method is
used
DataBinder.Eval() method is provided by .net to
evaluate expression
Syntax
◦ <%# DataBinder.Eval(Container.DataItem,“DataFieldname") %>
◦ Container represents the container for data items
◦ DataField represents the name of data item field
39. DataList Control
Provides list output with editing
Default look is a table
Customized via templates
Directional rendering (horizontal or vertical)
Alternate item
Updateable
No paging
40. DataGrid Control
Full-featured list output
Default look is a grid
Default is to show all columns, though you can
specify a subset of columns to display
Columns can be formatted with templates
Optional paging
Updatable
41. Tracing
ASP.NET supports tracing
◦ Easy way to include “debug” statements
◦ No more messy Response.Write() calls!
Great way to collect request details
◦
◦
◦
◦
Server control tree
Server variables, headers, cookies
Form/Query string parameters
Tracing provides a wealth of information about the page
Can be enabled at page- or application- level
42. Tracing
Methods
◦ Trace.Write: Writes category and text to trace
◦ Trace.Warn: Writes category and text to trace in red
Properties
◦ Trace.IsEnabled: True if tracing is turned on for the
application or just that page
◦ Tracemode = "[SortByTime | SortByCategory
Trace.axd
◦ is an Http Handler( An Http Handler is a coding option
that allows us to handle request/responses at the most
basic level).
44. Error Handling
.NET Common Language Runtime provides
structured Exception handling using try catch
block.
ASP.NET provides declarative application
custom error handling
◦ Automatically redirect users to error page when
unhandled exceptions occur
◦ Prevents ugly error messages from being sent to users
<customErrors
/>
mode="RemoteOnly"
45. Error Handling
Mode attribute is either set into On or
RemoteOnly .
On
◦ Error messages will be displayed in client
and well as server where application is
running
RemoteOnly
◦ Error messages will be displayed only at
client location
46. Error Handling
Custom Error Pages
Can specify error pages for specific HTTP status
codes in web.config
<configuration>
<customerrors mode=“remoteonly”
defaultredirect=“error.htm”>
<error statuscode=“404”
redirect=“adminmessage.htm”/>
<error statuscode=“403”
redirect=“noaccessallowed.htm”/>
</customerrors>
</configuration>
47. Subhas Malik
Software Developer(R&D Web ERP).
Microsoft SQL Server , C# , Ajax , Jquery , WCF , WPF , Telerik , MVP, MVC.
Kolkata, West Bengal, India.
Subhas Malik writes about a wide range of technology and products, but has a
particular focus on internet technology, browsers, software development (both back
end and font end), cyber security, mobile technology and many others related to
Information Technology. He joined blog/tech forum/developer community since 2009
and has also covered blogger, Microsoft, codeplex, stackoverflow, slideshare, linkedin
, codeproject, c-sharpcorner, youtube, quora, stackexchange, soundcloud, Google,
Yahoo, servers, supercomputing, Linux, other open-source software, and science and
many other tech community.
follow in blogger, wordpress , google+, Facebook, twitter, rediff mypage and itimes.
Internet Information Services (IIS) 6.0 is a powerful Web server that provides a highly reliable, manageable, and scalable Web application infrastructure for all versions of Windows Server 2003. IIS helps organizations increase Web site and application availability.
No Cost to Acquire
One of the best things about Internet Information Server-at the time of this writing-is that it is free. You can easily download it using your web browser from the Microsoft.
Compatible with Microsoft and Other Products
Internet Information Server runs only on Microsoft Windows Server. However, it is part of an integrated growing product family known as Microsoft BackOffice. This group includes Microsoft SQL Server, Microsoft Exchange Server, Systems Management Server, and SNA Server. IIS works with all client PC browsers on any platform.
Rapid Installation and Configuration
immediately publish existing files from server or other servers, and in no time, can have own Web site up and running.
Easy Service Management
An IIS feature known as the Internet Service Manager graphically displays all management options in a graphical menu.
Performance Monitoring is easy
You can use the Performance Monitor feature to measure system performance. IIS also logs site management and performance information for you for further analysis.
Easy to Implement Security
IIS uses Windows NT Server directory services to establish secure areas of your Web site. That means you have the ability to require user identification and passwords before a user can access a specified area of your server. You can control access by anonymous users, set document permissions, and audit document access easily with IIS. Additionally, a secure socket layer encrypts conversations between IIS and client browsers that support SSL.
ASP.NET is the platform that we use to create Web applications and Web services that run under IIS.
ASP.NET provides a high level of consistency across Web application development. In a way, this consistency is similar to the level of consistency that Microsoft Office brought to desktop applications. ASP.NET is part of the .NET Framework and is made up of several components.
Visual Studio .NET Web development tools. These include visual tools for designing Web pages and application templates, project management, and deployment tools for Web applications.The System.Web namespaces, are part of the .NET Framework and include the programming classes that deal with Web-specific items such as HTTP requests and responses, browsers, and e-mail.
ASP.NET is a revolutionary programming framework that enables the rapid development of powerful web applications and services. It is a part of the Microsoft .NET Platform, provides the easiest and most scalable way to build, deploy and run web applications that can target any browser or device. ASP.NET is a free download for all Windows 2000 and Windows XP systems.
The primary design goal of ASP.NET was to Remove Dependency on Script Engines enabling pages to be type safe and compiled and also reduce no of lines of code. ASP.NET is compiled common language runtime code running on the server.
All ASP.NET code, including scripts, is compiled, which allows for strong typing, performance optimizations, and early binding, among other benefits. Code once compiled, the CLR further compiles it to native code, providing dramatically improved performance. Since ASP.NET is based on the common language runtime, the benefits of entire platform are available to Web application developers such as power and flexibility of the Framework classes. ASP.NET is Language independent implying that you can code using any .NET Language and also interoperable between different .NET Languages.
Configuration information is stored as plain text in XML format. ASP.NET Framework application is deployed to a server simply by XCOPY method that is just copying the necessary files to the server. Server restart is not required, even to deploy or replace an existing compiled code running on the server.
ASP.NET applications can be run in a clustered or multiprocessor environment ensuring scalability. ASP.NET was built with the knowledge that IIS needs to be restarted. You can create a new process for a particular application programmatically based on either the number of requests or on the time duration thus ensuring that the application is available through out.
Earlier Version of ASP used to be directly intepreted by the ASP engine which was a part of IIS. In case of ASP.NET, it calls the aspwp_exe (ASP.NET Worker Process) which in turn calls the CLR’s appropriate classes.
AssemblyInfo.cs
All of the attributes that are written into the compiled assembly, including version, company name, GUID, and so on.
Global.asax
The global events that occur in your Web application, such as when the application starts or ends. You can have only one Global.asax file per project, and it exists in the root folder of the project.
Global.asax.cs
The code used in Global.asax. This file is not shown in Solution Explorer.
Styles.css
The style definitions to use for the HTML generated by your project. This file appears only in Visual Basic .NET projects. For Visual C# projects, you can add it manually.
Web.config
The settings your Web server uses when processing this project. These settings specify how errors are reported, what type of user authentication to use, and so on.
Every ASP.NET Page is constituted by a collection of controls
– System.Web.UI.Page is itself the top-level control
– System.Web.UI.HTMLControls define server-side equivalents of HTML elements
– System.Web.UI.WebControls define server-side controls that generate HTML in an intuitive, standard way
–– System.Web.UI.Control is the base class for all of these controls, and can be extended to build custom controls
You use the server and HTML controls to create the user interface on a Web form. The data controls and system components appear on the Web form only at design time to provide a visual way for you to set their properties and handle their events. At run-time, data controls and system components do not have a visual representation.
HtmlControls
HtmlControls are server-side representations of standard HTML elements
Any HTML element in an ASPX page marked with the runat=server attribute will become an HTML control on the server
All derived from HtmlControl class
WebControls
Provide a more consistent object model and a higher level of abstraction than HtmlControls
Provide higher-level controls with more functionality than primitive HTML elements
Provide controls for validation,databinding etc
The Web is stateless, and so are ASP.NET Pages. They are instantiated, executed, rendered, and disposed on every round trip to the server.
ASP.NET stores items added to a page’s ViewState property as hidden fields managed by the ASP.NET page framework. As soon as you submit the form for processing, all information relevant to the view state of the page is stored within this hidden form field.
When ASP.NET executes a page, the ViewState values from the page and all of the controls are collected and formatted into a single encoded string, and then assigned to the value attribute of the hidden form field (specifically, <input type=hidden>). Since the hidden form field is part of the page sent to the client, the ViewState value is temporarily stored in the client's browser.
Client-side Validation
– Reduces round-trips to the server by correcting mistakes before submitting them
– Provides user with immediate feedback on data input
– Requires client browser support scripting
– Can be easily subverted to send bad data to the server anyway (should never use client-side validation without server-side validation too)
Server-side Validation
• Data validation should always occur on the server
– Before data is actually used on the server, it should typically be validated
– Even with client-side validation, validation on the server should still occur as a precaution
– If an error is encountered, the form should be presented to the user again for corrections
Repeater
The Repeater control is a very generic shell defined almost entirely by its templates
There are templates like Header Template,ItemTemplate,Alternating Template,Footer Template etc
– It iterates over the bound data, rendering its ItemTemplate once for each item in the DataSource collection
– Useful when you want complete control over how data from a data source is rendered
The DataGrid, Repeater, and DataList controls provide
complete appearance customization through templates
Provide a shell for displaying data
Let you specify exactly how that data should be displayed
using a template
DataList
The DataList control displays data items in a repeating list
The DataList is useful for laying out data items in a list-like format (default rendering is a table with rows and columns)
Similar functionality achievable using DataGrid but DataList is simpler to work with
Requires that you define at least an ItemTemplate describing how to render each item
Each template has its own style (like HeaderStyle and ItemStyle)
DataGrid
The DataGrid provides a spreadsheet-like display of data from a query
Consists of a collection of columns, a header, and a footer
Columns can be auto-generated from the underlying query or you can explicitly declare your own BoundColumns
Extensively customizable appearance properties available
DataGrid Editing
The DataGrid provides a special EditCommandColumn
designed for editing data
DataGrid maintains an EditItemIndex property that
indicates which row of the grid should be editable (-1
indicates no row is being edited)
The EditCommandColumn renders links for firing three
events: EditCommand, UpdateCommand,
CancelCommand
DataGridCommandEventArgs is passed into each
handler, which contains information on the row being edited
DataGrid also maintains a DataKeyField property which
should be set to the primary key
In the event handler for the UpdateCommand, you access
the DataKeys collection of the DataGrid to populate the
primary key value
Tracing with ASP.NET
The new tracing features of ASP.NET allow us use new tracing methods.The Trace object is now an intrinsic page object, similar to Request, Response, Server, etc. It is accessible directly with our page code.
Trace class
Trace is exposed as a public property within ASP.NET pages. When we use the Trace property, we're working with an instance of the TraceContext class defined in the System.Web namespace.The Trace class exposes two overloaded methods and two properties. The two methods, Warn() and Write(), both support two identical prototypes.
Trace.Write: Writes category and text to trace
Trace.Warn: Writes category and text to trace in red
There are four attributes for the trace element:
enabled = "[true/false]"—We can set the enabled option to true or false. Tracing is either enabled at an application level, or it is disabled at the application level. If we set enabled=false, page tracing is still supported using the Trace directive discussed earlier.
requestlimit = "[int]"—The total number of trace requests to keep cached in memory on a per-application basis. Tracing exposes a special resource—Trace.axd, which we'll look at momentarily—that is used to view trace output when pageoutput is set to false.
pageoutput = "[true/false]"—When tracing is enabled through the configuration file, the administrator can either enable or disable tracing on each page. The pageoutput tracing enables tracing details for every page within an application. However, pageoutput tracing may be turned off while application-level tracing is still enabled (enabled = "true"). This keeps trace requests in memory, such that they are available via trace.axd, which we'll look at momentarily, but not displayed within the output of a page.
tracemode = "[SortByTime | SortByCategory]"—The tracemode setting gives us control over how trace detail information is output. Data may be sorted by time or category, where category is differentiated between the settings made by the system and the Trace.Write() settings enabled by the developer.