Docsity

ADVANCE WEB PROGRAMMING MANUAL, Lecture notes of Information Systems

Partial preview of the text

Download ADVANCE WEB PROGRAMMING MANUAL and more Lecture notes Information Systems in PDF only on Docsity!

UNIVERSITY OF MUMBAI

Teacher’s Reference Manual

Subject: Advanced Web

Programming

with effect from the academic year

Practical 3 (b).Demonstrate the use of Calendar control to perform following

operations.

a) Display messages in a calendar control b) Display vacation in a calendar

control

c) Selected day in a calendar control using style d) Difference between two calendar

dates

calndrCtrl.aspx

Calender properties set for this example:

if (e.Day.Date.Day == 13 && e.Day.Date.Month == 9)

Calendar1.SelectedDate = new DateTime(2018, 9, 12);

Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,

Calendar1.SelectedDate.AddDays(10));

Label lbl1 = new Label();

lbl1.Text = "Ganpati!";

e.Cell.Controls.Add(lbl1);

protected void btnReset_Click(object sender, EventArgs e)

Label1.Text = "";

Label2.Text = "";

Label3.Text = "";

Label4.Text = "";

Label5.Text = "";

Calendar1.SelectedDates.Clear();

protected void Calendar1_SelectionChanged(object sender, EventArgs e)

Label1.Text = "Your Selected Date:" + Calendar1.SelectedDate.Date.ToString();

OUTPUT

Practical 3(c).Demonstrate the use of Treeview control perform following operations.

a) Treeview control and datalist b) Treeview operations

Add XML File

Website - > Add - > XML File and Name it ‘stdetail’.

stdetail.xml

1

Tushar

TYIT

2

Sonali

TYCS

3

Yashashree

TYIT

4

Vedshree

TYCS

Default2.aspx

Treeview control navigation:

Default2.aspx.cs

using System.Data;

public partial class _Default : System.Web.UI.Page

protected void Page_Load(object sender, EventArgs e)

if (!IsPostBack)

BindData();

protected void BindData()

DataSet ds = new DataSet();

ds.ReadXml(Server.MapPath("stdetail.xml"));

if (ds != null && ds.HasChanges())

DataList1.DataSource = ds;

DataList1.DataBind();

else

DataList1.DataBind();

OUTPUT

Practical 4(b).Create Web Form to demonstrate use of Adrotator Control.

Add a XML file, name it "adds.xml"

Add images to test out the adrotator functionality.

XML File

rose1.jpg

http://www.1800flowers.com

Practical 4(c).Create Web Form to demonstrate use User Controls.

Add Web User Control

Website - > Add - > Web User Control and Name it ‘MyUserControl.

MyUserControl.ascx

<%@ Control Language="C#" AutoEventWireup="true"

CodeFile="MyUserControl.ascx.cs" Inherits="MyUserControl" %>

This is User Contro1

Name

City

MyUserControl.ascx.cs

protected void txtSave_Click(object sender, EventArgs e)

Label1.Text = "Your Name is " + txtName.Text + " and you are from " +

txtcity.Text;

UserControlDisplay .aspx

<%@ Page Language="C#" AutoEventWireup="true"

CodeFile="UserControlDisplay.aspx.cs" Inherits="UserControlDisplay" %>

<%@ Register Src="~/MyUserControl.ascx" TagPrefix="uc"

TagName="Student"%>

OUTPUT :

Master Page Demo

Master

Demo Of Master Page

Insight Products Downloads Contact Us

Info

Product Type 1

Product Type 2

Product Type 3

copyright @Sambare

MasterDisplay.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="MasterDisplay.aspx.cs" Inherits="MasterDisplay" %>

Home page

StyleSheet.css

#header{ color: blueviolet; text-align: center; font-size: 20px; } #nav{ background-color:darkseagreen; padding: 5px; } ul{ list-style-type: none; } li a { color:crimson ; font-size: 30px; column-width: 5%; } li { display: inline; padding-left: 2px; column-width: 20px; } a{ text-decoration: none; margin-left:20px }

Practical 6 (a): Create a web application to bind data in a multiline textbox by querying

in another textbox.

1. Create a webpage with one Button, one Multiline TextBox and one list box with

setting TextMode Property of text box to Multiline as shown below.

2. Write the Database related code in code behind C# file as given below.

Note: The users have to use their own system connection string in place of connection string

given in following code.

The connection string is available in Server Explorer (Right click on Database Name and Select

Properties) as displayed below. User can copy this connection string and can use in code.

3. Add this string to configuration file (web.config) as given below.

Web.confing

Practical 6 (b): Create a web application to display records by using database.

Create a web page with following design:

Add the following code on Button click event in C# Code behind file.

protected void Button1_Click(object sender, EventArgs e) { string connStr = ConfigurationManager.ConnectionStrings["connStr"].ConnectionString; SqlConnection con = new SqlConnection(connStr); SqlCommand cmd = new SqlCommand("Select City, State from Customer", con); con.Open(); SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { Label1.Text += reader["City"].ToString() + " " + reader["State"].ToString() + ""; } reader.Close(); con.Close(); }

Output:

Practical 6 (c): Demonstrate the use of Datalist link control.

1. Drag the Datalist control to our web page form toolbox->Data-> Datalist.

2. Then select Choose Data Source Option and select .

3. Now Select SQL Database from options and Click Ok button.

4. In next window click on New Connection button.

5. In add connection window Select the available SQL Server Name

6. Keep the Authentication as Windows Authentication.