1. What is asp.net?
Asp.net
frame work is a part of the .NET frame
work used to create a dynamic website, web application and web services. It is
a server-side technology that uses all .NET compatible languages such as c#,
vb.net etc, which are compiled to micro soft intermediate language (MSIL)
asp.net uses server control to develop a rapid and interaction interactive application
in an easy way.
2.What is the difference between web
site and web application
Web site
In
a web site, you cannot add multiple projects
-
There
is no project file. All the files in a folder structure are automatically
included in the site
-
The
website is easy to create and display
-
You
can use different .NET languages or a
single website, such as vb.net pages and c# pages can be used on the single
website.
-
You
cannot establish dependencies on a web site.
Web
application
-
In
a web application, you can add multiple projects
-
It
has a visual studio project file stores information about the project like as
the list of files that are included in the project, and any project to project
references.
-
You
can established dependencies in a web application
3. What is
the difference between client side and server side validations?
Client side validations work at the
client end with the help of scripting languages such as java script or vb
script.
On the other hand, server-side
validations work at the server end with the help of programming languages like
c#,vb.net etc
Server validations work when you submit
or send data to the server
4. What is
MVC
MVC is the frame work used to create web
application. The web application base builds on Model view controller pattern. Which
separates the application logic from UI, and the user will be controlled by the
controller.
5. asp Vs
asp.net
Key difference between them is that asp
is interpreted as scripts are used, whereas asp.net is compiled because of
these pages using .NET languages
6.what is the extension for asp.net
pages
.aspx
Structure of an asp.net page
List of the important elements of an asp.net page
-Directive
-Code declaration blocks
-asp.net controls
-code render blocks
-source code comments
-server code include
directives
-Literal text and html tags
Directive
A beginning of a directive is marked
with the characters
<%@ and
end of a directive is marked with the characters %>
A directive
can appear anywhere within a page
Page
directive
You can use a page directive to specify
the default programming language for a page. For example, you would use the
following page directive
<% page
Language =”c#” %>
You can enable tracing for a page by
including the following directive
<% page trace =”true” %>
<Script runat=”server”>
Sub page_load
Dim strtracemessage as String
Trace.warn(“page_load event executing”)
setTracemessage =”hello world”
trace.write (“the value of strTrace message is “&
strtracemessage)
end sub
<script>
<head> <title> Trace.aspx</title>
</head>
<body>
<h2> Testing page trace </h2>
<% trace.warn(“Rendering page content1” %>
</body>
</html>
A code declaration blocks contains all
the application logic for asp.net page and all the global variable declaration,
subroutines and functions.
We can declare subroutines and functions
only within a code declaration block
If no language is specified in a page,
the language defaults to visual basic.
Asp.net
controls
Controls are small building blocks of
the GUI which include text boxes, buttons, check boxes, list boxes and numerous
other tools.
Code render
blocks
If you read to execute code with the html
or text content of your asp.net page, you can do so within code render blocks.
The two types of code render blocks are inline code and inline expressions.
In line code executes a statement or
series of statements. This type of code begins with the characters <% and
ends with the characters %>
In line expression on the other hand,
display the value of a variable or method (this type of code is shorthand for
response.write )
The
<%=….. %> displaying expression is an equivalenet of the embedded code block
that contains only the response.write (…) statement. It is the simplest way to
display information, such as a single string, an int variable or a constant.
<%@ page
language =”vb”%>
<html>
<body>
<form
id=”form1” runat=”server”>
<%=
DateTime.Now.ToString()%>
</form>
</body>
</html>
Remember that the displaying expression
can not be used in the attributes of the server controls. It is because .NET
framework directly compiles the whole expression instead of the displaying
content as the value to the attribute.
Server-Side
Comments
The asp.net web forms compiler
completely ignore everything within the <%...%>
Server-side
Includes SSI are directives that are placed in HTML page and evaluated on the
server while the pages are being served.
Literal text
and HTML tag
The literal control is used to display
text that is it renders static text on a web page without adding additional
HTML tags.
Data Sources in asp.net
The data source control provides data in
the controls without complex coding. The actions like insert, update, delete, and sort is possible using the data control. There are various data source
controls in asp.net. The model allows users to create user data source control
which can internet with various data sources.
The different data sources used in
asp.net are as mentioned below
1.linqDataSource:
The language integrated query in an asp.net web page is possible using the
mark-up. The insert, update, select, delete commands are supported. Filtering
sorting and paging of the data are possible.
2.Object
data source: The user can work with the objects using the object data source.
3.sqldata
source: User can work with a micro soft SQL server. Oracle OLEDB and oracle databases. The sorting, filtering, paging of the data is possible using the data
source.
4.Access
data source: working with a micro soft access database is possible using the
data source.
5.XML data
source: user can work with the XML file when the hierarchical structure needs
to be used as a data source.
6.Sitemapdata
source
Site navigation data
Asp.net features
Asp.net Asp.net is a web application framework
developed and marketed by micro soft to allow programmers to build dynamic web
sites.
The principal design features of
Microsoft .net framework is
-
Interoperability
-
Portability
-
Security
-
Language
independence
-
Type
safety
-
Memory
management
1.Interoperability:
is the ability of code to interact with code that is written using different programming
language.
2.portability:
portable class libraries can help you reduce the time and costs.
3.Security:
The code can access are restricted based on this evidence associated with the
code and its identity.
4. Language
independence: It is possible to use .net from many programming languages
because they have all agreed on some standards
5. Type
safety: This prevents ill-defined casts, wrong method invocations, and memory
size issues when accessing an object.
6.Memory
management: automatic memory management is one of the services that the common
language runtime provides during managed execution
Master
pages
Master pages allow you to create a
consistent look and behavior for all the pages (or group of pages) in your web
application.
A master page provides a template for
other pages, with a shared layout and functionality. The master page defines
placeholders for the content, which can be overridden by content pages. The
output result is a combination of the master page and the content page.
<%
master %>
<html>
<body>
<h1>
standard header form master page </h1>
<asp:contentplaceholder
id =”cph1” runat =”server”>
</asp:contentplaceholder>
</body>
</html>
The master page contains a place holder
tag <asp:content placeholder> for individual content
The
id =”cph1” attribute identifies the placeholder, allowing many placeholders in
the master page.
<%
page master page File –“master1.mastr”>
<asp:
content contentplaceholder id =”cph1”
runat=”server”>
<h2>
individual content </h2>
<p>
paragraph 1 </p>
<p>
paragraph 2</p>
</asp:content>
A master page is the design layout of the web
page, which helps to standardize the
look and feel for web pages in the application, the master page contains all common
reusable interface part of all asp.net web pages.
-master the page provides a template for standardization
-
In one application we can have multiple master pages
-It
has place holders for the content, which can be overridden by the web page.
-master
page comes with .master extension
-
script language, header, footer all are placed on the master page
Content
place holder – a place for web page control, in page
Asp:
content has a property called content
placeholder id to map with place holder
In real-time application development you
may have a requirement where you need to change the master page dynamically at
run time depending on user role, permission, region, etc
Nested
master page
When one master page references another
master page as its master, that’s called a nested master page. One master page
can have multiple levels of another page references though there is no
architectural limitation but having for many levels of the master page may be considered
as bad design
The grid view control displays the
values of a data source in a table. Each column represents a field, while each row
represents a record. The grid view control supports the following features
-
Binding the data source controls such as SQL data source
-
Built-in sort capabilities
-
Built-in update and delete capabilities
-
Built-in paging capabilities
-
Built-in row selection capabilities
-
Dynamically ser properties handle events and so on
-
Multiple key fields
-
Multiple data fields for the hyperlink columns
-
Customize appearance through themes and styles
Displaying
empty data
Suppose that there is no data in the data
base table or no results are returned from the data source then you can display
user-friendly message in a grid view that there is no record available
-
Empty data text
-
Empty data template
The grid view control supports the
following types of fields
Bound field: how to display the
column and its value.
Department-ID, employee id
Command field
Command the field is used to perform edit, delete, update, cancel, and select operations.
Template field
You
can customize the user interface and all validation logic to the fields
Altering item template: the content of
every alienate row
Edit item template: user edit the
records.
Footer template: content displayed at
the column footer
Header template contents of the
column header
Insertion template: insert a new data
item
Row data-bound template
Rowdatabound
event is used when you want to modify the appearance of individual rows in a grid
view
Object data source control uses
reflection to expose and call the appropriate methods of a business object to
select, insert, and update data.
Different
operations supported by object data source control
Selection:
which retrieves data
Sorting:
sorting elements
Filtering:
filtering expression
Updating:
that performs updating
Deleting:
that perform deleting
Inserting:
set the insert method to business object method that perform insertion
Old value
parameter: the old value is the original value of the field when the page first
loads
Select
method: select the contents
Select
parameter: number of possibilities for selecting parameters
Sort
parameter name sort
Type name:
used for specifying dependent name, identifies the name of the class works with
Update method:
number of columns updated in the data storage
Update
parameter: your parameter values and
list of values will automatically be updated
Enable
paging: 10 records on a page at a time
Select count
method: select count number of rows that matches a specified criterion
Select row
index parameter
Object data
source control uses reflection to create instances of business objects and to
call methods on them to retrieve, update, insert, and delete data.
No comments:
Post a Comment