Documente Academic
Documente Profesional
Documente Cultură
Roll No.:1058
Contents
1. Fundamentals of ASP.NET such as using HTML/Web Controls, Autopostback, Application events,
configuration files................................................................................................................. 2
a. Web Controls [22nd November, 2016]................................................................................... 2
b. Configuration files and application events [22nd November, 2016]...............................................3
c. Use of Autopostback [22nd November, 2016].........................................................................7
2. State management, Validation & Rich controls.........................................................................10
a. Master Page and AdRotator control [29th November, 2016]......................................................10
b. State Management: Session [5th December, 2016]..................................................................14
c. Validations [5th December, 2016]....................................................................................... 16
3. ADO.NET in ASP.NET with Data Binding, Interacting with XML documents..................................20
a. Database connectivity using SqlDataReader [5th December, 2016]..............................................20
b. Use of GridView [26th December, 2016]............................................................................. 21
c. Interacting with XML documents [26th December, 2016]..........................................................24
a. Creating and consuming web services [26th December, 2016]....................................................26
b. Use of AJAX controls [2nd January, 2017]..........................................................................27
c. Data caching [7th January, 2017]........................................................................................ 28
Page 1 of 30
Roll No.:1058
Page 2 of 30
Roll No.:1058
Page 4 of 30
Roll No.:1058
Default.aspx.vb
Imports System.Web.Configuration
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnOk_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnOk.Click
Dim amt As Integer
Dim yrs As String
Dim rate As Double
Dim installment As Double
amt = CInt(txtAmt.Text)
yrs = ddlYear.SelectedItem.Text
rate = CDbl(WebConfigurationManager.AppSettings(yrs))
installment = Math.Round((amt / (yrs * 12)) * rate)
lblmsg.Text = "Interest rate=" & rate & "<br> Monthly Installment=Rs." & installment
End Sub
End Class
Output:
Roll No.:1058
Page 9 of 30
Roll No.:1058
Roll No.:1058
Roll No.:1058
Roll No.:1058
Slide1.master(aspxcode)
<%@ Master Language="VB" AutoEventWireup="false" CodeBehind="Site1.master.vb"
Inherits="Pract2Q1.Site1" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div id="wrapper">
<div id="banner">
<img alt="banner" src="App_Themes/Images/banner.jpg"
style="width: 806px; height: 155px" /></div>
<div id="navigation">
<asp:LinkButton ID="lbtnHot" runat="server" PostBackUrl="~/WebForm1.aspx">Hot
Coffee</asp:LinkButton>
&nbs
p;
<asp:LinkButton ID="lbtnCold" runat="server" PostBackUrl="~/WebForm2.aspx">Cold
Coffee</asp:LinkButton>
</div>
<div id="content_area">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
<div id="sidebar">
<asp:AdRotator ID="AdRotator1" runat="server"
AdvertisementFile="~/App_Data/XMLFile1.xml" Height="100px" Width="500px" />
</div>
<div id="footer">
<p>All Rights reserved</p>
</div>
</div>
</form>
</body>
</html>
WebForm1.aspx
Page 12 of 30
Roll No.:1058
Output:
Roll No.:1058
Page 19 of 30
Roll No.:1058
Roll No.:1058
Page 23 of 30
Roll No.:1058
Roll No.:1058
Default.aspx
Imports System.Xml
Partial Public Class _Default
Inherits System.Web.UI.Page
Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As EventArgs) Handles
btnSearch.Click
Dim cnt As Integer = 0
Dim doc As New XmlDocument
lblMsg.Text = ""
doc.Load("D:\tycs\b1\1058\asp.net\Pract3Q3\Pract3Q3\App_Data\ChannelDetails.xml")
For Each Element As XmlElement In doc.DocumentElement.ChildNodes
Dim channel As String
channel = Element.GetAttribute("Name")
If Element.ChildNodes(0).InnerText = lstlanguage.SelectedItem.Text And
Element.ChildNodes(1).InnerText = lstcategory.SelectedItem.Text Then
lblMsg.Text &= channel & ","
cnt = cnt + 1
End If
Next
If cnt = 0 Then
lblMsg.Text = "Channel is not available."
End If
doc = Nothing
End Sub
End Class
Output:
Page 25 of 30
Roll No.:1058
Output:
Page 29 of 30
Page 30 of 30
Roll No.:1058