Professional Documents
Culture Documents
728 - Om Gupta - AWP
728 - Om Gupta - AWP
Practical 1A
Aim: Create an application that obtains four int values from the user and
displays the product.
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Default.aspx :
<head> body>
</ <div>
<
</div>
</form>
</body>
</html>
Default.aspx.cs
using System.Web.UI.WebControls;
namespace WebApplication6
string s = TextBox1.Text;
OUTPUT :
operations
Fibonacci series
using System;
co++;
}
Console.ReadLine();
}
}
Output:
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
using System;
{
Console.WriteLine(ch+"is not vowel");
}
}
Console.ReadLine();
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
}
}
Output:
using System;
}
}
Output:
using System;
}
}
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
concepts
Code:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
using System;
namespace test1
{
class Program
{
public int Area(int a,int b)
{
return a* b;
}
public int Area(int a)
{
return a * a;
}
public double Area(double a)
{
return 3.14*a*a;
}
}
class Profram1
{
}
}
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
namespace single
{
class Teacher
{
public void Teach()
{
Console.WriteLine("tech");
}
}
class Student : Teacher
{
public void Learn()
{
Console.WriteLine("learn");
}
}
class Program
{
static void Main(string[] args)
{
Teacher T = new Teacher();
T.Teach();
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
namespace multilevel
{
class Mode
{
public void mode()
{
Console.WriteLine("there are many modes of transport");
}
}
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
namespace cal
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
{
interface calc1
{
int add(int a, int b);
}
interface calc2
{
int sub(int x, int y);
}
interface calc3
{
int mul(int r, int s);
}
interface calc4
{
int div(int c, int d);
}
class calulation:calc1,calc2,calc3,calc4
{
public int result1;
public int add(int a,int b)
{
return result1 = a + b;
}
public int result2;
public int sub(int a, int b)
{
return result2 = a - b;
}
public int result3;
public int mul(int a, int b)
{
return result3 = a * b;
}
public int result4;
public int div(int a, int b)
{
return result4= a / b;
}
class test
{
static void Main(string[] args)
{
calulation C = new calulation();
C.add(3, 4);
C.div(4, 8);
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
C.sub(3, 2);
C.mul(4, 2);
Console.WriteLine("addtion"+C.result1);
Console.WriteLine("subtration" + C.result2);
Console.WriteLine("multiplication" + C.result3);
Console.WriteLine("divsion" + C.result4);
Console.ReadKey();
}
}
}
Output :
Code:
using System;
namespace cal
{
class program
{
static void Main(string[] args)
{
grandfather g = new grandfather(); g.truck(); dad d = new dad();
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
d.truck();
d.car(); son s =new
son(); s.truck();
s.bike();
Console.ReadLine();
}
class grandfather
{
public void truck()
{
Console.WriteLine("truck");
}
}
class dad:grandfather
{
public void car()
{
Console.WriteLine("CAR");
}
}
class son : grandfather
{
public void bike()
{
Console.WriteLine("Bike");
}
}
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
namespace cal
{
class BankAccount
{
private int cust_id,bal; private
string cust_name;
public BankAccount()
{
cust_id = 1000;
cust_name = "not yet specifed"; bal = 0;
}
public BankAccount(int cust_id,string cust_name,int bal)
{
this.cust_id = cust_id;
this.cust_name = cust_name;
this.bal = bal;
}
public BankAccount(BankAccount obj)
{
cust_id = obj.cust_id; cust_name =
obj.cust_name;
bal = obj.bal;
}
public void showdata()
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
{
Console.WriteLine("cust id={0},cust name={1},cust bal={2}", cust_id, cust_name, bal);
}
}
class program
{
public static void Main(string[] args)
{
BankAccount a = new BankAccount();
BankAccount b = new BankAccount(102,"ehtishaam",200);
BankAccount c = new BankAccount(b); a.showdata();
b.showdata();
c.showdata();
Console.ReadLine();
}
}
Output:
Code:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
using System;
namespace tra
{
public interface Itransaction
{
string retcode();
int amtfunction();
}
public class transaction : Itransaction
{
private string tcode; private int
amount;
public transaction()
{
tcode = "";
amount = 0;
}
public transaction(string c, int a)
{
tcode = c;
amount = a;
}
public int amtfunction()
{
return amount;
}
}
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
namespace delegate1
{
class program
{
public delegate void print(int value); static void
Main(string[] args)
{
print printdel = printnumber;
printdel(10000); printdel(200);
printdel = printmoney;
printdel(15000); printdel(200);
Console.ReadLine();
}
public static void printnumber(int num)
{
Console.WriteLine("Number {0}", num);
}
}
}
Output
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
using System.Collections.Generic; using
System.Linq;
namespace delegate1
{
class program
{
static void Main(String [] args)
{
Console.WriteLine("enter name"); string
studentname = Console.ReadLine();
IList<String> studentList = FindALLStudenstFromDatabas(studentname);
Console.WriteLine("total {0}:{1}", studentname, studentList.Count()); Console.ReadKey();
}
private static IList<String> FindALLStudenstFromDatabas(String studentName)
{
IList<String> studentList = null; return
studentList;
}
}
}
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Code:
using System;
using System.Collections.Generic; using
System.Linq;
namespace delegate1
{
class program
{
static void Main(String [] args)
{
try
{
Console.WriteLine("enter name"); string
studentname = Console.ReadLine();
Output:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<br />
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
<br />
<br />
<br />
<asp:ListItem>1</asp:ListItem>
<asp:ListItem>2</asp:ListItem>
<asp:ListItem>3</asp:ListItem> <asp:ListItem>4</asp:ListItem>
</asp:DropDownList>
</div>
</form>
<p>
</p>
</body>
</html>
WebForm1.aspx.cs
using System;
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
namespace WebApplication1
Output:
WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
ForeColor="#FFFFCC" />
</asp:Calendar>
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
</div>
</form>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
</body> </html>
WebForm1.as.cx
namespace WebApplication2
e.Cell.BackColor = System.Drawing.Color.Yellow;
Label lb1 = new Label(); lb1.Text = "<br> teachers
day<br>";
e.Cell.Controls.Add(lb1);
Image g1 = new Image();
g1.ImageUrl = "263646.jpg";
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
g1.Height = 20;
g1.Width = 20;
e.Cell.Controls.Add(g1);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
Calendar1.Caption = "EHTISHAAM";
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
if (Calendar1.SelectedDate.ToShortDateString() == "9-18-2021")
Output:
Webform2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 100%;">
<tr>
<td class="style1">
Name
</td>
<td class="style2">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ErrorMessage="Enter Name"
ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
ErrorMessage="Enter Only Character" ControlToValidate="TextBox1"
ValidationExpression="[a-zA-Z]+"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="style1">
Roll no
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ErrorMessage="Enter no"
ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style1">
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
Age
</td>
<td class="style2">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
ErrorMessage="Enter Age"
ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
<asp:RangeValidator ID="RangeValidator1" runat="server"
ErrorMessage="Enter age in between 18-25"
ControlToValidate="TextBox3"
MaximumValue="25" MinimumValue="18"></asp:RangeValidator>
</td>
</tr>
<tr>
<td class="style1">
Contact
</td>
<td class="style2">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server"
ErrorMessage="Enter Contact"
ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
<asp:CustomValidator ID="CustomValidator1" runat="server"
ErrorMessage="CustomValidator" ControlToValidate="TextBox4"
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
onservervalidate="CustomValidator1_ServerValidate"></asp:CustomValidator>
</td>
</tr>
<tr>
<td class="style1">
Email
</td>
<td class="style2">
<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server"
ErrorMessage="Enter Email"
ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ErrorMessage="Enter correct Email id" ControlToValidate="TextBox5"
ValidationExpression="\w+([-+.']\w+)*@\w+([-
.]\w+)*\.\w+([.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
<td class="style1">
Password
</td>
<td class="style2">
<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server"
ErrorMessage="Enter Password"
ControlToValidate="TextBox6"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style1">
Re-Type Password
</td>
<td class="style2">
<asp:TextBox ID="TextBox7" runat="server"></asp:TextBox>
</td>
<td>
<asp:RequiredFieldValidator ID="RequiredFieldValidator7" runat="server"
ErrorMessage="Enter Re-Type Password"
ControlToValidate="TextBox7"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ErrorMessage="Enter Correct Password" ControlToCompare="TextBox6"
ControlToValidate="TextBox7"></asp:CompareValidator>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
</td>
</tr>
<tr>
<td>
<asp:Button ID="Button1" runat="server" Text="Submit" />
</td>
</tr>
<tr>
<td>
<asp:ValidationSummary ID="ValidationSummary1" runat="server" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
XML FILE : RIGHT CLICK ON PROJECT -> ADD -> NEW ITEM
-> DATA -> XML FILE
--> WebForm1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:AdRotator ID="AdRotator1" runat="server" DataSourceID="XmlDataSource1" />
<asp:XmlDataSource ID="XmlDataSource1" runat="server"
DataFile="~/XMLFile1.xml">
</asp:XmlDataSource>
</div>
</form>
</body>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: OM GUPTA
</html>
XMLFILE1.xml
<Advertisements>
<Ad>
<ImageUrl1>abc.jpg</ImageUrl1>
<NavigateUrl>https://www.youtube.com</NavigateUrl>
<AlternateText> this
is an image
</AlternateText>
<Impressions>1</Impressions>
<Keyword>game</Keyword>
</Ad>
<Ad>
<ImageUrl>xyz.jpg</ImageUrl>
<NavigateUrl>https://www.google.com</NavigateUrl>
<AlternateText>this is an image</AlternateText>
<Impressions>1</Impressions>
<keyword>games</keyword>
</Ad>
<Ad>
<ImageUrl>637668.jpg</ImageUrl>
<NavigateUrl>https://www.epicgames.com/store/en-US/</NavigateUrl>
<AlternateText>this is an image</AlternateText>
<Impressions>2</Impressions>
<keyword>games</keyword>
</Ad>
</Advertisements>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
RIGHT CLICK ON PROJECT -> ADD -> NEW ITEM -> WEB -
> WEB FORM USER CONTROL
DemoUserControl.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc1:Student ID="WebUserControl1" runat="server" />
<uc1:Student ID="Student1" runat="server" />
<uc1:Student ID="clr" runat="server" />
<uc1:Student ID="abc" runat="server" />
<uc1:Student ID="xyz" runat="server" />
</div>
</form>
</body>
</html>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WebUserControl1.ascx
WebUserControl1.ascx.cs
namespace WebApplication9
{
public partial class WebUserControl1 : System.Web.UI.UserControl
{
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WebForm1.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication8.WebForm1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
</form>
</body>
</html>
Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="Page1.aspx" title="home" description="Home">
<siteMapNode url="Page2.aspx" title="about" description="About" >
<siteMapNode url="Calendar.aspx" title="calendar" description="calendar" />
</siteMapNode>
<siteMapNode url="Page3.aspx" title="contact" description="contact" />
</siteMapNode>
</siteMap>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Page1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>HOME</h1>
</div>
</form>
</body>
</html>
Page2.aspx
Page3.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>CONTACT</h1>
</div>
</form>
</body>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Calendar.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>CALENDAR</h1>
</div>
</form>
</body>
</html>
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
SKIN1.SKIN
<%--
Default skin template. The following skins are provided as examples only.
1. Named control skin. The SkinId should be uniquely defined because duplicate SkinId's per control
type are not allowed in the same theme.
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
2. Default skin. The SkinId is not defined. Only one default control skin per
control type is allowed in the same theme.
STYLESHEET1.CSS
body
{
background-color:yellow; font-family:'Times New Roman'; font-size:larger;
}
WEBFORM1.ASPX
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
SITE1.MASTER
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site1.master.cs"
Inherits="WebApplication14.Site1" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<link href="StyleSheet1.css" rel="stylesheet" type="text/css" /> <title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</asp:ContentPlaceHolder>
<h3>
fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooter</ h3>
</div>
</form>
</body>
</html>
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" /><br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</html>
Default.aspx.cs
namespace WebApplication11
{
public partial class _Default : System.Web.UI.Page
{ int i =
0;
protected void Page_Load(object sender, EventArgs e)
{ if
(!IsPostBack)
{
ViewState["Count"] = i;
}
}
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Query1.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
User ID <asp:Label ID="Label1" runat="server" ></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><br />
Name <asp:Label ID="Label2" runat="server" ></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="SUBMIT" OnClick="Button_Click" />
</div>
</form>
</body>
</html>
Query2.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
UserID <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><br />
Name <asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><br />
</div>
</form>
</body>
</html>
Query1.aspx.cs
namespace WebApplication12
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Query2.aspx.cs
namespace WebApplication12
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ if
(!IsPostBack)
{
Label1.Text = Request.QueryString["UserID"];
Label2.Text = Request.QueryString["Name"];
}
}
}
}
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
C3) COOKIE
Web.Config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</system.web>
</configuration>
Cookies.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</head>
<body>
<form id="form1" runat="server">
<div>
Name<asp:TextBox ID="txtName" runat="server"></asp:TextBox><br />
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Cookie.aspx.cs
namespace WebApplication13
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
C4) SESSION
Web.Config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
-->
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
</configuration>
Session.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Session.aspx.cs
namespace WebApplication13
{
public class Furniture
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
}
}
}
}
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
PRACTICAL 6
WEBFORM1.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="WebApplication15.WebForm1" %>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Height="50px"
TextMode="MultiLine" Width="205px"></asp:TextBox>
WEB.CONFIG
<connectionStrings>
<add name="customer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication15\WebApplication15\App_Data\Database1.mdf';Integ rated
Security=True;User Instance=True"/>
</connectionStrings>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 6B
DEFAULT.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX.CS
namespace WebApplication16
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
reader.Close();
con.Close();
}
}
}
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEB.CONFIG
<connectionStrings>
<add name="stud" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication16\WebApplication16\App_Data\Database1.mdf ';Integrated
Security=True;User Instance=True" />
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Int egrated
Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
DATABASE :
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 6c
Aim : Dataset
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM1.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DataList ID="DataList1" runat="server" DataSourceID="SqlDataSource1">
<ItemTemplate>
id:
<asp:Label ID="idLabel" runat="server" Text='<%# Eval("id") %>' />
<br />
name:
<asp:Label ID="nameLabel" runat="server" Text='<%# Eval("name") %>' />
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
<br />
age:
<asp:Label ID="ageLabel" runat="server" Text='<%# Eval("age") %>'
/>
<br />
<br />
</ItemTemplate>
</asp:DataList>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [stud]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
DATALIST CONNECTION :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
Practical 7
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Default.aspx.cs" Inherits="WebApplication17._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</div>
</form>
</body>
</html>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX.CS
namespace WebApplication17
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
string connStr =
ConfigurationManager.ConnectionStrings["Ehtishaam"].ConnectionString;
SqlConnection con = new SqlConnection(connStr);
con.Open();
SqlCommand cmd = new SqlCommand("Select City from Ehtishaam", con);
SqlDataReader reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "City";
DropDownList1.DataBind(); reader.Close();
con.Close();
}
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEB.CONFIG
<connectionStrings>
<add name="Ehtishaam" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication17\WebApplication17\App_Data\Database1.mdf
';Integrated Security=True;User Instance=True"/>
</connectionStrings>
DATABASE
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
Practical 7b
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
<div>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Button" />
<br />
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</div>
</div>
</form>
</body>
</html>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX.CS
namespace WebApplication18
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
string connStr =
ConfigurationManager.ConnectionStrings["rcb"].ConnectionString;
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEB.CONFIG
DATABASE
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 7C Aim:
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs"
Inherits="WebApplication19._Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Customer Details</h1>
<table style="width: 100%;">
<tr>
<td class="style1">
Cust ID
</td>
<td class="style2">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
</tr>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
<tr>
<td class="style1">
Name
</td>
<td class="style2">
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style1">
City
</td>
<td class="style2">
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style1">
PhoneNo
</td>
<td class="style2">
<asp:TextBox ID="TextBox4" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
DEFAULT.ASPX.CS
namespace WebApplication19
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
cmd.Parameters.AddWithValue("@CustId", TextBox1.Text);
cmd.Parameters.AddWithValue("@Name", TextBox2.Text);
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
cmd.Parameters.AddWithValue("@City", TextBox3.Text);
cmd.Parameters.AddWithValue("@PhoneNo", TextBox4.Text);
conn.Open();
cmd.ExecuteNonQuery();
conn.Open();
cmd.ExecuteNonQuery();
WEB.CONFIG
<connectionStrings>
<add name="customer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication19\WebApplication19\App_Data\Database1.mdf ';Integrated
Security=True;User Instance=True" />
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Int egrated
Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
DATABASE
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 8A
Aim: Create a web application to demonstrate data binding using details
view and form view control
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM 2.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" runat="server" Height="50px"
Width="125px"
AutoGenerateRows="False" AllowPaging="true" DataSourceID="SqlDataSource1"
EnableModelValidation="True">
<Fields>
<asp:BoundField DataField="CustId" HeaderText="CustId"
SortExpression="CustId" />
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
PhoneNo:
<asp:TextBox ID="PhoneNoTextBox" runat="server" Text='<%#
Bind("PhoneNo") %>' />
<br />
<asp:LinkButton ID="UpdateButton" runat="server"
CausesValidation="True"
CommandName="Update" Text="Update" />
<asp:LinkButton ID="UpdateCancelButton" runat="server"
CausesValidation="False" CommandName="Cancel" Text="Cancel" />
</EditItemTemplate> <InsertItemTemplate>
CustId:
<asp:TextBox ID="CustIdTextBox" runat="server" Text='<%# Bind("CustId")
%>' />
<br />
Name:
<asp:TextBox ID="NameTextBox" runat="server" Text='<%# Bind("Name") %>'
/>
<br />
City:
<asp:TextBox ID="CityTextBox" runat="server" Text='<%# Bind("City") %>' />
<br />
PhoneNo:
<asp:TextBox ID="PhoneNoTextBox" runat="server" Text='<%#
Bind("PhoneNo") %>' />
<br />
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</ItemTemplate>
</asp:FormView>
</div>
</form>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM 1.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</asp:GridView>
</div>
</form>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
</body>
</html>
WEBFORM 1.ASPX.CS
namespace WebApplication19
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string connectionString =
WebConfigurationManager.ConnectionStrings["customer"].ConnectionString;
string selectSQL = "SELECT CustId, Name, City, PhoneNo FROM customer";
SqlConnection con = new SqlConnection(connectionString);
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
}
}
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEB.CONFIG
<connectionStrings>
<add name="customer" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication19\WebApplication19\App_Data\Database1.mdf ';Integrated
Security=True;User Instance=True" />
<add name="ConnectionString" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database1.mdf;Int egrated
Security=True;User Instance=True" providerName="System.Data.SqlClient" />
</connectionStrings>
DATABASE
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 9A
Aim: Create a web application to demonstrate Grid View paging and
creating own table format using grid view.
WEBFORM 1.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM 1.ASPX.CS
namespace WebApplication20
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
BindData();
}
}
}
}
WEB.CONFIG
<connectionStrings>
<add name="url" connectionString="Data
Source=.\SQLEXPRESS;AttachDbFilename='c:\users\hp\documents\visual studio
2010\Projects\WebApplication20\WebApplication20\App_Data\Database1.md f';Integrated
Security=True;User Instance=True"/>
</connectionStrings>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DATABASE
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
OUTPUT :
Practical 9B
Aim: Create a web application to demonstration use of gird view control
template and grid view hyperlink
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM 2.ASPX
%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="WebApplication20.WebForm2" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
EnableModelValidation="True"
onselectedindexchanged="GridView1_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="id" HeaderText="id" />
<asp:HyperLinkField DataNavigateUrlFields="url" DataTextField="Name"
HeaderText="User Profile" />
</Columns>
</asp:GridView>
</div>
</form>
</body>
</html>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
WEBFORM 2.ASPX.CS
namespace WebApplication20
{
public partial class WebForm2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
string connectionString =
WebConfigurationManager.ConnectionStrings["url"].ConnectionString; string
selectSQL = "SELECT id, name, url FROM url";
SqlConnection con = new SqlConnection(connectionString);
SqlCommand cmd = new SqlCommand(selectSQL, con); SqlDataAdapter
adapter = new SqlDataAdapter(cmd);
// Fill the Dataset.
DataSet ds = new DataSet();
adapter.Fill(ds, "info");
// Perform the binding.
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
}
}
}
WEB.CONFIG
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Button"
onclick="Button1_Click" />
<br />
<br />
<asp:ListBox ID="ListBox1" runat="server" Height="40px" Width="100px"
onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="Button"
onclick="Button2_Click" />
</div>
</form>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
DEFAULT.ASPX.CS
namespace WebApplication21
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Wr.WriteStartDocument();
Wr.WriteStartElement("Details", "top");
Wr.WriteElementString("ID", "1");
Wr.WriteElementString("FirstName", "ehtishaam");
Wr.WriteElementString("LastName", "shaikh"); Wr.WriteEndElement();
Wr.Close();
Label1.Text = "Datawrite successfully";
}
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical 10B
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ENTER USERNAME : <asp:TextBox ID="TextBox1" runat="server"
ontextchanged="TextBox1_TextChanged"></asp:TextBox><br /> ENTER PASSWORD :
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><br />
Default.aspx.cs
namespace WebApplication22
{
public partial class _Default : System.Web.UI.Page
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
if (uname == "Ehtishaam")
{
if (pass == "Ehtishaam123")
return true;
}
if (uname == "Nitesh")
{
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
if (pass == "nitesh123")
return true;
}
return false;
}
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Welcome to the programming world of dot net. <asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
Default2.aspx.cs
namespace WebApplication22
{
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Session["Username"]!=null)
{
//Response.Write(Session["Username"].ToString()); Label1.Text =
Session["Username"].ToString();
}
}
}
}
Web.Config
<authentication mode="Forms">
<forms loginUrl="Default.aspx"/>
</authentication>
<authorization>
<deny users="?"/> </authorization>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Practical Aim:
Multiview Code:
Default.aspx :
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="true"
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem Value="0">Calendar</asp:ListItem>
<asp:ListItem Value="1">Color</asp:ListItem>
</asp:DropDownList>
<asp:ListItem>Red</asp:ListItem>
<asp:ListItem>Green</asp:ListItem>
</asp:RadioButtonList>
</asp:View>
</asp:MultiView>
</div>
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
Default.aspx.cs :
using System; using System.Collections.Generic; using
System.Linq; using System.Web; using System.Web.UI;
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh
using System.Web.UI.WebControls;
namespace WebApplication7
{
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OUTPUT :
T.Y.B.Sc.IT ADVANCED WEB PROGRAMMING Name: Md. Ehtishaam Shaikh