Set 2
Set 2
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.
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.
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.