Server
Controls vs. HTML Controls
Server controls
trigger control events on the server whereas HTML controls
can’t.
Server controls maintains data across requests but
with HTML controls data is not maintained.
Server
controls is provided with set of properties by .Net framework
whereas HTML controls has attributes only.
AutoPostBack
property associated with each control which causes the control to
fire postback event. By default, this property is set to
False.
ASP.NET List and
Table Controls are ListBox, DropDownList, Table, DataGrid,
DataList, Repeater.
The
validation controls check the validity of data just
before the page is posted back to the server, without a round-trip
to the server.
ASP.NET
performs control validation on the client side just before posting
the Web form back to the server. Once client-side validation
succeeds, the web form is validated again on the server side
before the Page_Load event occurs.
To open new
window, we can use onclick=”window.open()” attribute. Web
application supports client script that runs on the
client.
ASP.NET
Validation Controls: RequiredFieldValidator,
CompareValidator, RangeValidator, RegularExpressionValidator,
CustomValidator, ValidationSummary.
To use
the validation controls, follow these steps:
Draw
a validation control,
Set ControlToValidate or
ControltoCompare property,
Set control’s ErrorMessage
property,
Set validation control’s text property to show
longer error message in a ValidationSummary.
Navigating
between pages in ASP.NET
Hyperlink
control,
Response.Redirect,
Server.Transfer is only for aspx page, end the
currect page and begin executing the new one.
Server.Execute begins new one while still displaying
the currect one.
Window.Open displays new browser
window.
Layers
to data access in ADO.NET
Physical data
store: SQL, an OLE, or an Oracle database or an XML
file.
Data provider: Connection and command objects
that create in-memory representation of data
Data set:
In-memory representation of the tables and
relationships.
Data view: Presentation of a
table in the data set use for filtering or sorting of
data.
Types
of database connection in ADO.NET: OleDbConnection,
SqlConnection, OracleConnection.
Steps
to access a database through ADO.NET
Create
a connection using a connection object.
Invoke a command to
create a DataSet object using an adapter object.
Use the
DataSet object in code to display data or to change items in the
database.
The
database command object provides
these three command methods: ExecuteScalar, ExecuteNonQuery,
ExecuteReader.
To
establish database connection using command
object
Create a connection to the
database.
Open the connection.
Create a command
object containing the SQL command or stored procedure to
execute.
Execute the method on the command
object.
Close the database
connection..