Library tutorials & articles
In Depth ASP.NET using ADO.NET
- Introduction
- Developing a Templated DataBound Control
- Table, TableRow, and TableCell Web Server Controls
- Adding Rows and Cells to a Table Web Server Contro
- Data Binding Button, TextBox and DropDownList cont
- Data Binding Expressions
- Exploring with Web Based Address Database
- Adding CheckBox Control to DataGrid Control
- Data Navigation Form with Unbound Controls
Introduction
In this article we will discuss a number of ways to retrieve, show, and update data with ASP.NET forms using ADO.NET. Also, we will have a clear idea about the most common server controls in ASP.NET. In particular, with this article we will cover ASP.NET server controls, ADO.NET DataSource, and creating Templated DataBound Controls, ASP.NET forms, using data with controls. We will review each of the proceeding server controls in detail. We will learn how to raise and handle some of the controls events, how to retrieve attributes from the control programmatically on the server, and finally we will demonstrate how to bind to control to a data source. Finally, we will have a complete example of retrieving, showing and updating by using server controls of ASP.NET.
Characteristically, when working with information or data from users we need to validate the data they provide us. For instance, if we have a field in our form where the user must enter his date of birth, we probably will want to control that user so that he enters a valid date. In this article we will not be validating the data collected, but we will use several server controls to handle data.
Construction Data with ASP.NET and ADO.NET
An ASP.NET server control derives directly or indirectly from System.Web.UI.Control. This base class belongs to the System.Web.UI namespace, which contains the elements common to all ASP.NET server controls. Three commonly used controls Page, UserControl, and LiteralControl are belong to System.Web.UI.Control developers generally do not instantiate Page or derive from Page. Page is important because every ASP.NET page is compiled to a Page control by the ASP.NET page framework,. Control developers also usually do not work with UserControl. User controls are developed using the same programming model as ASP.NET pages and are saved as .ascx text files. As it allows text to be encapsulated as a control, Control developers use LiteralControl widely.
IIS needs to be properly configured with FrontPage extensions for ASP.NET pages to execute. The required version of FrontPage extensions needs to be installed during the .NET SDK install or the Visual Studio .NET install. To verify this, open the Internet Information Services Manager and right-click the default Web site, and select Check Server Extensions from the All Task menu.
By extending an existing Web server control, by combining existing Web server controls, or by creating a control that derives from the base class System.Web.UI.WebControls.WebControl, we can develop a custom Web server control.
We will find typical scenarios in which we are likely to develop our own controls and provide links to other topics for further information in the following list.
- We have created an ASP.NET page that provides a user interface that we want to reuse in another application. We would like to create a server control that encapsulates the user interface (UI) but we do not want to write additional code. ASP.NET allows us to save our page as a user control without writing a single additional line of code. For details, see Web Forms User Controls.
- We would like to develop a compiled control that combines the functionality of two or more existing controls. For example, we need a control that encapsulates a button and a text box. We can do this using control composition, as described in Developing a Composite Control.
- An existing ASP.NET server control almost meets our requirements but lacks some required features. We can customize an existing control by deriving from it and overriding its properties, methods, or events.
- None of the existing ASP.NET server controls (or their combinations) meets our requirements. In that case, we can create a custom control by deriving from one of the base control classes. These classes provide all the plumbing needed by an ASP.NET server control, thus allowing us to focus on programming the features we need. To get started, see Developing Custom Controls: Key Concepts and Developing a Simple ASP.NET Server Control
Many custom controls include a combination of scenarios, where we combine custom controls that we have designed with existing ASP.NET server controls.
The ASP.NET server controls that provide a user interface are organized into two namespaces; System.Web.UI.HtmlControls and System.Web.UI.WebControls. While the Web server controls are richer and more abstract, the HTML server controls map directly to HTML elements.
Most Web server controls derive directly or indirectly from the base class System.Web.UI.WebControls.WebControl. On the other hand, the four controls in the upper-right corner (Literal, PlaceHolder, Repeater, and Xml) derive from System.Web.UI.Control. The controls on the left map to HTML elements. The controls in the center are for validating form input. Also the controls that are in the center provide rich functionality, such as the Calendar and the AdRotator controls. The controls which provide data binding support are on the right.
Before we start to talk about the server control, we will have some additional information about DataBound controls. Let's take a look at how we can develop a Templated DataBound control.
Related articles
Related discussion
-
An Introduction to VB.NET and Database Programming
by yen (12 replies)
-
Using ADO.NET with SQL Server
by jkoder59 (19 replies)
-
we search the company in India for program creation under the order
by qwe (0 replies)
-
String was not recognized as a valid DateTime.
by buvanasubi (22 replies)
-
save .csv with newline character
by James Crowley (1 replies)
Related podcasts
-
A Practical Look at Silverlight 2 Part 1
Now that Silverlight 2 is at the Olympics and making a big splash, we wanted to explore this fascinating technology more. Microsoft Silverlight 2 is a cross-browser, cross-platform, and cross-device plug-in for delivering the next generation of .NET based media experiences and rich interactive ap...
Events coming up
-
Dec
6
Developing AJAX Web Applications with Castle Monorail
London, United Kingdom
Monorail is the model-view-controller engine of the Castle Project, bringing many of the best ideas of Ruby on Rails to the .NET world. In this talk, David De Florinier and Gojko Adzic show how Monorail makes it easy to develop .NET based AJAX applications, and how to use the Castle Project to build Web 2.0 applications effectively. Come to this session if you are a .NET web developer. Everyone is welcome!
how do i add a checkbox control to a winform datagrid
singhswat@yahoo.co.in
Actually ado.net and asp.net connectivity has lot more than it this indepth article has of no use because it doesnt hv any example/s associted with it
ASP.NET is not really a language at all - it is a technology. You can write the code for ASP.NET in any of the .NET languages - in this case, the code is written in C#.
This is not ASP.NET It's VC++.NET ASP.NET is a web based language, not a windows forms language.
This thread is for discussions of In Depth ASP.NET using ADO.NET.