0% found this document useful (0 votes)
100 views

Set 2

1. ASP.Net offers a programming model and infrastructure that facilitates powerful applications using .Net languages like C# and VB. Developers can access managed runtime environment features like inheritance and type safety using Microsoft Visual Studio. Web Forms enable building forms and Web Services enable data exchange across firewalls using standards like SOAP and XML. 2. ASP.NET uses server controls instead of code blocks to program dynamic content. Controls are declared in .aspx files and can be standard HTML tags or custom tags. This allows richer custom controls. 3. Validation controls perform validation on the server. With client-side validation enabled, errors are detected on the client before form submission using scripts. This provides interactive validation experience.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
100 views

Set 2

1. ASP.Net offers a programming model and infrastructure that facilitates powerful applications using .Net languages like C# and VB. Developers can access managed runtime environment features like inheritance and type safety using Microsoft Visual Studio. Web Forms enable building forms and Web Services enable data exchange across firewalls using standards like SOAP and XML. 2. ASP.NET uses server controls instead of code blocks to program dynamic content. Controls are declared in .aspx files and can be standard HTML tags or custom tags. This allows richer custom controls. 3. Validation controls perform validation on the server. With client-side validation enabled, errors are detected on the client before form submission using scripts. This provides interactive validation experience.
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 5

BT0042

SEM 3
SET 2
Introduction to .NET technologies

1. ASP.Net offers a novel programming model and infrastructure that facilitates a powerful new
class of applications.ASP.Net is a compiled .Net based environment, so we author applications in
any .Net based language, including visual basic C# and Jscript.Net. Developers can effortlessly
access the advantage of these technologies, which consists of a managed common language
Runtime environment, type safety, inheritance and so on. With the aid of Microsoft Visual
Studio.Net Web development becomes easier.
Web Forms enable us to build powerful forms-based web pages. Web services enable the exchange
of data in client-server scenarios using standards like HTTP, SOAP (Simple Object Access
protocol) and XML messaging to move data across firewalls. XML provides meaning to data, and
soap is the protocol that allows web services to communicate with one another
When an ASP.NET page is first requested it is complied cached in the server. This means that
ASP.NET page performs very rapidly. All ASP.NET code is complied rather than interpreted,
which permits early binding, strong typing and just-in-time (JIT) compiling to native code.

2. ASP.NET server controls


Instead of using < %%> code blocks to program dynamic content, ASPNET page developers can
use ASP.NET sever controls to program web pages. Server controls are declared within an .aspx
file using custom tags or intrinsic HTML tags that contain a runat=``sever`` attribute value.
Intrinsic HTML tags are handled by one of the controls in the System.Web.UI.Html.Controls
namespace. Any tag that doesn’t explicitly map to one of the controls is assigned the type of
System.Web.UI.HtmlControls.Html GenericControl.
In addition to standard HTML input controls, ASP.NET enables developers to use richer custom
controls on their pages.
Program
<Html>
<head>
<link rel =``stylesheet``href=``intro.css``>
</head>
<body>
<center>
<form action=``example4.aspx`` method=``post`` runat=server>
<h3>Name;<asp:textbox id=``Name`` runat=``server``/>
Category : <asp:dropdownlist id=``category`` runat=server>
<asp:listitem>psychology</asp:listitem>
<<asp:listitem>business</asp:listitem>
<asp: listitem>popular comp</asp:listitem>
</asp: dropdownlist>
</h3>
<asp: button text=``lookup`` runat=``server``/>
</form>
</center>
</body>
</html>

3. The validation controls always perform validation checking in the server code. If the user is
working with a browser that supports DHTML, the validation controls can also perform validation
using client script. With the client side validation, any errors are detected on the client when the
form is submitted to the server. If any of the validators are found in error, the submission of the
form to the server is cancelled and the validator`s text property is displayed. This permits the user
to correct the input before submitting the form to the server. Field values are revalidated as soons
as the field containing errors loose focus, thus providing the user with a rich, interactive validation
experience.
Client side validation is enabled by default. If the client is capable, uplevel validation will be
performed automatically. To disable client-side validation, set the page`s ClientTarget property to
``downlevel`` (``Uplevel`` forces client side validation)

Program
<html>
<head>
<script language=``VB`` runat=``server`>
Sub page load
If Not Is PostBack
`Validate initially to force 8s to appear before the first round-trip
Validate()
End if
End sub
Sub validationBtn_click(sender as object, e as EventArgs)
If (page.IsValid) Then
lbloutput.Text = ``page is valid! ``
Else
lblOutput.text=`` Some of the required fields are empty ``
end if
end sub
</script>
</head>
<body>
<H3><font face=”Verdana”> Client-side Required Field Validator
Sample</font></h3>
<p>
<form runat= “ server”>
<table bgcolor=”#eeeeee” cellpadding=10>
<tr valign= “top”>
<tr colspan=3>
<asp:label id= “lblOutput” Name= “lblOutput” Text=”fill in the required fields below”
forecolor=”red” font-name=”Verdana” Font-size= “10” runat=server/><br>
</td>
</tr>
<tr>
<td colspan=3>
<font face=Verdana size=2><b> credit card information</b></font>
</td>
</tr>
<tr>
<td align=right>
<font face=Verdana size=2>Card Type:</font>
</td>
<td>
<ASP.RadioBUttonList id= RadioButtonList1 RepeatLayout=”flow”
onclick=”clientOnChange(); “runat=server>
<asp:listitem>master card</asp:listitem>
Asp:listitem>visa</asp:listitem>
</ASP:RadioButtonList>
</td>
<td align=middle rowspan=1>
<asp:RequiredFieldValidator id=”RequiredFieldValidator1”
ControltoValidate=”RadioButtonList1”
Display=”Static”
InitialValue=””
Width=”100%”>
</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align=right>
<font face= verdana size=2> card number:</font>
</td>
<td.
<ASP:TextBox id = TextBox1 Runat=server/>
</td>
<td.
<asp:RequiredFieldValidator id= “RequiredFieldValidator2”
ControlToValidate= “TextBox1”
Display=”Static”
Width=”100” runat=server>
*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td align right>
<font face= Verdana size=2>Expiration Date:</font>
</tr>
<td>
<ASP: DropDownList id=DropDownList1 runat=server
<asp: listItem></asp: ListItem>
<asp: listItem>06/00</asp: ListItem>
<asp: listItem>07/00</asp: ListItem>
<asp: listItem>08/00</asp: ListItem>
<asp: listItem>09/00</asp: ListItem>
<asp: listItem>10/00</asp: ListItem>
<asp: listItem>11/00</asp: ListItem>
<asp: listItem>01/01</asp: ListItem>
<asp: listItem>02/01</asp: ListItem>
<asp: listItem>03/01</asp: ListItem>
<asp: listItem>04/01</asp: ListItem>
<asp: listItem>05/01</asp: ListItem>
<asp: listItem>06/01</asp: ListItem>
<asp: listItem>07/01</asp: ListItem>
<asp: listItem>08/01</asp: ListItem>
<asp: listItem>09/01</asp: ListItem>
<asp: listItem>10/01</asp: ListItem>
<asp: listItem>11/01</asp: ListItem>
<asp: listItem>12/01</asp: ListItem>
</ASP:DropDownList>
</td>
<td>
<asp:requiredFieldValidator id=”RequiredFieldValidator3”
ControlToValiadate=”DropDownList`”
Display=”Static”
InitialValue=””Width=”100%” runat=server>
</asp:RequiredFieldValidator>
</td>
<td>
</tr>
<tr>
<td></td>
<td>
<ASP:Button id=Button1 text=”Validate” OnClick=”ValidateBtn_Click”
Runat=server/>
</td>
<td></td>
</tr>
</table>
</form>
</body>
</html>
4.
a) Server Side Data
ASP.NET provides rich set of controls that well-integrated with the managed data access APIs
provides the common language runtime. This section walks through several iterations of a sample
that uses the ASP.NET DataGrid control to bind to the queries and XML data files. This section
assumes some familiarity with database fundamentals and the SQL query language
Server-side data access is unique in that web pages are basically stateless, which presents some
difficult challenges when trying to perform transactions such as inserting or updating records from
a set of data retrieved from a database. The DataGrid control can help mange these challenges
allowing us to concentrate more on our application logic and less on the details of state
management and event handling.

b) Accessing SQL based data


An application typically needs to perform 1 or more select insert, update, or delete queries to SQL
database. To perform a select query to sql database u create a sqlconnection to the database passing
the connection string and then construct a SqlDataAdpter object that contains the query statement.
The benefit of usind a data set is that it gives u a disconnected view of a database. We can operate
on a data set in our application, then reconcile our changes with the actual database later. For long
running applications this often the best approach. For web applications we are usually performing
short operation which each request. We often don’t need to hold a data set object over a series of
several requests. Foe situation like these we can use a SqlDataReader. SqlDataReaddrprovides a
forward only, read only pointer over data retyrieved from sql data base. To SqlDtaReader we
declare a SqlCommand instead of a SqlDataAdapter. The sql command exposes and
ExecuteReader method that return a SqlDataReader. Not also that we must explicitly open and
close the SqlConnection when use a SqlCommand. After a call to ExecuteReader, the
SqlDataReader can be bound to an asp.net server control.

5. ASP.NET web service implementations rely on the ASP.NET run time to dymically compile the
Web service at run time. To generate the symbolic debugging information to debug a web service,
we need to instruct the ASP.NET runtime to compile the application. To configure a web service
to be compiled with symbols, we must include a debug attribute in the < compilation > section of
the Web.config file. The .NET debugger represents a breakpoint using a red circle in the code
margin adjacent to the appropriate line of code. The breakpoint can switched on and off by
clicking in the code margin repeatedly.

You might also like