8423 AWP Practical File
8423 AWP Practical File
Roll No.:8423
Certificate
This is to certify that Mr. /Miss. Abhay.S.Daundkar Examination Seat no.8423 has
successfully completed all the practicals of the subject Advanced Web Programming
Internal Examiner
Roll No.:8423
Roll No.:8423
Roll No.:8423
PRACTICAL-1
1A] Create an application that obtains four int values from the user and
displays the product.
Code:
using System;
public class Practical1
{
public static void Main()
{
Console.WriteLine("Enter First Int: ");
int a = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Second Int: ");
int b = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Third Int: ");
int c = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Fourth Int: ");
int d = int.Parse(Console.ReadLine());
Console.WriteLine("The product of four integers: " + a * b * c * d);
int e = int.Parse(Console.ReadLine());
}
}
OUTPUT :
Roll No.:8423
string Subject;
Subject = "Awp";
string marks;
marks = "100";
string rank = "1";
Console.WriteLine("Name: " + Name);
Console.ReadLine();
Console.WriteLine("id: " + id);
Console.ReadLine();
Console.WriteLine("Subject: " + Subject);
Console.ReadLine();
Console.WriteLine("Marks: " + marks);
Console.ReadLine();
Console.WriteLine("Rank: " + rank);
Console.ReadLine();
}
}
Output:
Roll No.:8423
2. In the calculate class, write methods for the addition and subtraction of
two integers.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Calculation
{
public class Calculate
{
public int Add(int a, int b)
{
return a + b;
}
public int Sub(int a, int b)
{
return a - b;
}
}
}
Name: ABHAY DAUNDKAR
Roll No.:8423
Roll No.:8423
Step 3 - Add a reference for the dll file, "calculation.dll", that we created
earlier.
Name: ABHAY DAUNDKAR
Roll No.:8423
Step 4 - Add the namespace ("using calculation;") and write the code.
Name: ABHAY DAUNDKAR
Roll No.:8423
using Calculation;
namespace FORM1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
Calculate cal = new Calculate();
private void button1_Click(object sender, EventArgs e)
{
try
{
int i = cal.Add(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text =
i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button2_Click(object sender, EventArgs e)
{
try
{
//storing the result in int i
int i = cal.Sub(int.Parse(textBox1.Text), int.Parse(textBox2.Text)); textBox3.Text =
i.ToString();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
}
Output:
Name: ABHAY DAUNDKAR
Roll No.:8423
1. Addition :
2. Subtraction:
Name: ABHAY DAUNDKAR
Roll No.:8423
num2 = num3;
Roll No.:8423
Console.Write("Enter a Number:
"); num =
int.Parse(Console.ReadLine()); m
= num / 2;
if (num % i == 0)
break;
if (flag == 0)
Console.Write("Number is Prime.");
char ch;
Console.WriteLine("Enter an alphabet :
"); ch = (char)Console.Read();
switch (ch)
{ case ‘a’:
Case ’A’:
Name: ABHAY DAUNDKAR
Roll No.:8423
Case ’e’:
Case ’E’:
Case ‘i’:
Case ‘I’:
Case ‘o’:
Case ‘O’:
Case ‘u’:
Case ‘U’:
default:
Console.WriteLine(str);
}
Name: ABHAY DAUNDKAR
Roll No.:8423
{+
class practical
int no;
Roll No.:8423
case 1: obj.fibonacci();
break; case 2:
obj.primeNum(); break;
case 3:
obj.vowels();
break; case 4:
obj.forEach();
break; case 5:
obj.sum();
break; default:
}
Name: ABHAY DAUNDKAR
Roll No.:8423
OUTPUT:
1. Fibonacci series:
2.Prime Numbers:
3. VOWEL:
Roll No.:8423
PRACTICAL-2
Roll No.:8423
i. Function Overloading ;-
Code:
using System;
class Functionoverloading
int sum = a + b;
return sum;
int sum = a + b + c;
return sum;
Console.ReadLine();
int sum2 =
obj.Add(1, 4, 5);
}
Name: ABHAY DAUNDKAR
Roll No.:8423
Output:
using System;
class A
{
public void show()
{
Console.WriteLine("Parent Class");
}
}
class B : A
{
public void print()
{
Console.WriteLine("Child Class");
}
}
class test
{
public static void Main(string[] args)
{
B s = new B(); s.show();
s.print();
Console.ReadLine();
}
}
Name: ABHAY DAUNDKAR
Roll No.:8423
Output:
2. Multilevel:
Code:
using System;
public class A
{
public void show()
{
Console.WriteLine("class A");
Console.ReadLine();
}
}
public class B : A
{
public void show1()
{
Console.WriteLine("class B");
Console.ReadLine();
}
}
public class C : B
{
public void show2()
{
Console.WriteLine("class C");
Console.ReadLine();
}
}
class multilevel
{
public static void Main(string[] args)
Name: ABHAY DAUNDKAR
Roll No.:8423
{
C ob = new C(); ob.show1(); ob.show2(); Console.ReadLine();
}
}
Output:
3. Hierarchical Inheritance:
Code:
using System;
class parent
{
Roll No.:8423
class demo
c1.display();
c1.show1();
c2.display();
c2.show2();
Console.ReadLin
e();
Output:
Name: ABHAY DAUNDKAR
Roll No.:8423
4. Hybrid Inheritance:
Code:
using System;
class parent
{
public void display()
{
Console.WriteLine("I am parent ");
}
}
class child1 : parent
{
public void display1()
{
Console.WriteLine("I am 1st child of parent");
}
}
class subchild : child1
{
public void show()
{
Console.WriteLine("I am child of child1");
}
}
class child2 : parent
{
public void display2()
{
Console.WriteLine("I am 2nd child of parent");
}
Name: ABHAY DAUNDKAR
Roll No.:8423
}
class test
{
public static void Main(string[] args)
{
child1 c1 = new child1();
c1.display(); c1.display1(); child2 c2 = new child2();
c2.display(); c2.display2(); subchild s = new subchild(); s.display();
s.display1();
s.show();
Console.ReadLine();
}
} using System;
class parent
{
public void display()
{
Console.WriteLine("I am parent ");
}
}
class child1 : parent
{
public void display1()
{
Console.WriteLine("I am 1st child of parent");
}
}
class subchild : child1
{
public void show()
{
Console.WriteLine("I am child of child1");
}
}
class child2 : parent
{
public void display2()
{
Console.WriteLine("I am 2nd child of parent");
}
}
class test
{
public static void Main(string[] args)
{
child1 c1 = new child1();
c1.display(); c1.display1(); child2 c2 = new child2();
c2.display(); c2.display2(); subchild s = new subchild(); s.display();
s.display1();
s.show();
Console.ReadLine();
}
}
Output:
Name: ABHAY DAUNDKAR
Roll No.:8423
Output:
Name: ABHAY DAUNDKAR
Roll No.:8423
iv. Interface
Code:
using System;
interface I1
{
void show();
}
interface I2
{
void display();
}
class A : I1, I2
{
public void show()
{
Console.WriteLine(" First interface method");
}
public void display()
{
Console.WriteLine(" Second interface method");
}
}
class Interface
{
public static void Main(string[] args)
{
A a = new A(); a.show();
a.display();
Console.ReadLine();
}
}
using System;
interface I1
{
void show();
}
interface I2
{
void display();
}
class A : I1, I2
{
public void show()
{
Console.WriteLine(" First interface method");
}
Name: ABHAY DAUNDKAR
Roll No.:8423
Output:
Code:
using System;
namespace Delegates;
public delegate void MyDel(string str);
class EventProgram
{
public event MyDel MyEvent;
public void show(string username)
{
Console.WriteLine("Welcome " + username);
}
static void Main(string[] args)
{
EventProgram obj1 = new EventProgram(); MyDel d = new MyDel(obj1.show);
Name: ABHAY DAUNDKAR
Roll No.:8423
Output:
Roll No.:8423
Output:
Name: ABHAY DAUNDKAR
Roll No.:8423
PRACTICAL 3
3A) a. Create a simple web page with various server controls to demonstrate
setting and use of their properties. (Example: AutoPostBack)
Name: ABHAY DAUNDKAR
Roll No.:8423
Code:
.Cs :
using System;
using System.Collections.Generic;
using System.Linq;
Name: ABHAY DAUNDKAR
Roll No.:8423
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Students_data
{
public partial class Students_entry : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
String name = "Welcome to AWP";
if (ViewState["name"] == null)
{
ViewState["name"] = name;
}
Roll No.:8423
{
for (int i = 0; i < ListBox1.Items.Count; i++)
{
if (ListBox1.Items[i].Selected == true)
{ TextBox2.Text = TextBox2.Text + "" + ListBox1.Items[i].Text; }
}
}
}
}
.aspx :
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Students_entry.aspx.cs"
Inherits="Students_data.Students_entry" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 653px">
VIEW STATE DATA
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="VIEW STATE DATA" />
<asp:Label ID="Label1" runat="server" Text="WELCOME TO AWP"></asp:Label>
<br />
<br />
ENTER YOUR NAME :
<asp:TextBox ID="TextBox1" runat="server" OnTextChanged="TextBox1_TextChanged"
Width="240px"></asp:TextBox>
<br />
<br />
SELECT HOBBIES :
<asp:CheckBox ID="CheckBox1" runat="server" AutoPostBack="True"
OnCheckedChanged="CheckBox1_CheckedChanged" Text="PLAYING" />
<asp:CheckBox ID="CheckBox2" runat="server" AutoPostBack="True"
OnCheckedChanged="CheckBox2_CheckedChanged" Text="READING" />
<br />
<br />
SELECT GENDER :
<asp:RadioButton ID="RadioButton1" runat="server" Text="MALE" />
<asp:RadioButton ID="RadioButton2" runat="server" Text="FEMALE" />
<br />
<br />
SELECT CLASS : <asp:DropDownList ID="DropDownList1" runat="server"
AutoPostBack="True" OnSelectedIndexChanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>FYIT</asp:ListItem>
<asp:ListItem>SYIT</asp:ListItem>
<asp:ListItem>TYIT</asp:ListItem>
</asp:DropDownList>
<br />
Name: ABHAY DAUNDKAR
Roll No.:8423
<br />
SELECT DIVISION : <asp:ListBox ID="ListBox1" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ListBox1_SelectedIndexChanged">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
<asp:ListItem>D</asp:ListItem>
</asp:ListBox>
<br />
<br />
<br />
YOUR NAME
IS
<asp:Label ID="Label2" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR HOBBIES ARE
<asp:Label ID="Label3" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR GENDER IS
<asp:Label ID="Label4" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR CLASS
IS
<asp:Label ID="Label5" runat="server" Text="Label"></asp:Label>
<br />
<br />
YOUR DIVISION IS
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<br />
</div>
</form>
</body>
</html>
Design :
Name: ABHAY DAUNDKAR
Roll No.:8423
Output :
Name: ABHAY DAUNDKAR
Roll No.:8423
Roll No.:8423
Code :
.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Calendar
{
public partial class Calendar : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Roll No.:8423
}
}
}
}
.aspx :
< !DOCTYPE html >
Roll No.:8423
< asp:Label ID = "Label3" runat="server" Text="Label"></asp:Label >
< br />
< br />
DAYS & nbsp; REMAINING FOR GANPATI VACATION
< asp:Label ID = "Label4" runat="server" Text="Label"></asp:Label >
< br />
< br />
DAYS REMAINING FOR NEW YEAR
< asp:Label ID = "Label5" runat="server" Text="Label"></asp:Label >
< br />
< br />
< asp:Button ID = "Button1" runat="server" OnClick="Button1_Click" Text="SHOW CALENDAR INFO" />
</div>
</form>
</body>
</html>
Design :
Output :
Name: ABHAY DAUNDKAR
Roll No.:8423
Code :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TreeView ID="TreeView1" runat="server"
OnSelectedNodeChanged="TreeView1_SelectedNodeChanged">
<Nodes>
<asp:TreeNode Text="Pillai Collage" Value="Pillai Collage"></asp:TreeNode>
<asp:TreeNode Text="TYIT" Value="TYIT">
<asp:TreeNode Text="SEM I" Value="SEM I"></asp:TreeNode>
<asp:TreeNode Text="SEM II" Value="SEM II"></asp:TreeNode>
<asp:TreeNode Text="SEM III" Value="SEM III"></asp:TreeNode>
<asp:TreeNode Text="SEM IV" Value="SEM IV"></asp:TreeNode>
<asp:TreeNode Text="SEM V" Value="SEM V"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
</div>
Name: ABHAY DAUNDKAR
Roll No.:8423
</form>
</body>
</html>
Output :
Name: ABHAY DAUNDKAR
Roll No.:8423
Practical 4
Working with Form Controls
a. Create a Registration form to demonstrate use of various Validation
controls.
Registrationform.aspx
Roll No.:8423
Inherits="registration8416.registrationform" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1
{ width:
100%;
.auto-style2
{ height: 31px;
.auto-style3
{ width:
229px;
.auto-style4
{ height: 31px;
width: 229px;
.auto-style5
{ width:
218px;
.auto-style6
{ height: 31px;
width: 218px;
</style>
</head>
<body>
Name: ABHAY DAUNDKAR
Roll No.:8423
<table class="auto-style1">
<tr>
<td class="auto-style3">Name</td>
<td class="auto-style5">
</td>
<td>
</td>
</tr>
<tr>
<td class="auto-style4">Password</td>
<td class="auto-style6">
</td>
<td class="auto-style2">
ErrorMessage="CustomValidator" ForeColor="#FF3300"
13</asp:CustomValidator>
Roll No.:8423
</td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
</tr>
<tr>
<td class="auto-style3">Email</td>
<td class="auto-style5">
</td>
<td>
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">Email is
wrong</asp:RegularExpressionValidator>
Name: ABHAY DAUNDKAR
Roll No.:8423
</td>
</tr>
<tr>
<td class="auto-style5">
</td>
<td>
</td>
</tr>
<tr>
<td class="auto-style3">Age</td>
<td class="auto-style5">
</td>
<td>
Roll No.:8423
</td>
</tr>
<tr>
<td class="auto-style3"> </td>
<td class="auto-style5">
<td> </td>
</tr>
</table>
</div>
</form>
</body>
</html>
Success.aspx
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="success.aspx.cs"
Inherits="registration8416.success" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
Roll No.:8423
<div>
</div>
</form>
</body>
</html>
Registrationform.aspx.cs
using System; using
System.Collections.Generic;
using System.Linq; using
System.Web; using
System.Web.UI; using
System.Web.UI.WebControls;
namespace registration8416
Response.Redirect("success.aspx");
args.IsValid = true;
Name: ABHAY DAUNDKAR
Roll No.:8423
else
args.IsValid = false;
web.config
<?xml version="1.0" encoding="utf-8"?>
<!--
<configuration>
<appSettings>
<system.web>
</system.web>
<system.codedom>
<compilers>
Roll No.:8423
</system.codedom>
</configuration>
Output:
Validator for Name: (RequiredField Vaildator)
Roll No.:8423
Roll No.:8423
1. SiteMapPath Control
Site maps are XML files which are mainly used to describe the logical structure
of the web application. It defines the layout of all pages in a web application
and how they relate to each other. Whenever you want you can add or remove
pages to your site map there by managing navigation of the website efficiently.
Site map files are defined with .sitemap extension. <sitemap> element is the
root node of the sitemap file.
It has three attributes:
Title: It provides a textual description of the link.
URL: It provides the location of the valid physical file.
Description: It is used for the tooltip of the link.
2. Menu Control
Menu is another navigation control in ASP.NET which is used to display menus
in web pages. This control is used in combination with SiteMapDataSource
control for navigating the web Site. It displays two types of menu: static menu
and dynamic menu. Static menu is always displayed in menu Control, by default
only menu items at the root levels are displayed. Dynamic menu is displayed
only when the user moves the mouse pointer over the parent menu that contains
a dynamic sub menu.
3. TreeView Control
TreeView is another navigation control used in ASP.NET to display the data in
a hierarchical list manner. When TreeView is displayed for the first time, it
displays all of its nodes. Users can control it by setting the property called
ExpandDepth.
TYIT.master
Name: ABHAY DAUNDKAR
Roll No.:8423
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table class="auto-style1">
<tr>
<td class="auto-style1"> <h1> Library
<table class="auto-style1">
<tr>
<td>
<asp:Menu ID="Menu1" runat="server" DataSourceID="SiteMapDataSource1" Height="77px"
Width="95px">
</asp:Menu>
<asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" />
<br />
<asp:TreeView ID="TreeView1" runat="server" DataSourceID="SiteMapDataSource1">
</asp:TreeView>
</td>
</tr>
</table>
</h1></td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td><footer> CopyRight TYIT - A NEERAJ </footer></td>
</tr>
</table>
</form>
</body>
</html>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
HOME.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="HOME.aspx.cs" Inherits="practical_5.HOME" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3> this is Library home page </h3>
</asp:Content>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
Output
CART.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="CART.aspx.cs" Inherits="practical_5.CART" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3>this is cart page </h3>
</asp:Content>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
Output
BOOKS.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/TYIT.Master" AutoEventWireup="true"
CodeBehind="BOOKS.aspx.cs" Inherits="practical_5.BOOKS" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<h3>this is book page </h3>
</asp:Content>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
Output
Web.sitemap
<?xml version="1.0" encoding="utf-8" ?>
<siteMap xmlns="http://schemas.microsoft.com/AspNet/SiteMap-File-1.0" >
<siteMapNode url="~/HOME.ASPX" title="HOME" description="">
</siteMap>
Name: ABHAY DAUNDKAR
Roll No.:8423
Content Placeholder
Defines a region for content in an ASP.NET master
page. public class ContentPlaceHolder :
System.Web.UI.Control A ContentPlaceHolder
control defines a relative region for content in a
master page, and renders all text, markup, and
server controls from a related Content control found
in a content page.
Materpage.master
<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="masterpage.master.cs"
Inherits="Practical_5B.masterpage" %>
Roll No.:8423
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1 id="header"> WebSite.</h1>
<table align="center">
<tr>
<td class="style1"><a href="WebForm1.aspx">Home Page</a></td>
<td class="style1"><a href="WebForm2.aspx">Cart Page</a></td>
</tr>
</table>
<asp:ContentPlaceHolder id="ContentPlaceHolder1"
runat="server"></asp:ContentPlaceHolder>
<footer>
<div id="footer" align="center" class="container-fluid">
<div class="row">
<div class="text-center">
<p style="color:whitesmoke">© All right Reversed - TYIT A</p>
</div>
</div>
</div>
</footer>
<!-- ./Footer -->
</div>
</form>
</body>
</html>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
StyleSheet1.css
#footer {
background: #531f00;
}
WebForm1.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage.Master" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="Practical_5B.WebForm1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.s1{font-weight:bolder;font-style:italic;text-align:center;background-color:Aqua;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="s1"> Home page of WebSite</h1>
<asp:Button SkinID="blue" ID="Button1" runat="server" Text="Blue" BackColor="Blue" />
<asp:Button SkinID="orange" ID="Button2" runat="server" Text="Orange" BackColor="Orange" />
</asp:Content>
Split view
Name: ABHAY DAUNDKAR
Roll No.:8423
Output
WebForm2.aspx
<%@ Page Title="" Language="C#" MasterPageFile="~/masterpage.Master" AutoEventWireup="true"
CodeBehind="WebForm2.aspx.cs" Inherits="Practical_5B.WebForm2" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
<style type="text/css">
.s1{font-weight:bolder;font-style:italic;text-align:center;background-color:Orange;}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<h1 class="s1"> Cart page of WebSite</h1>
<asp:Button SkinID="Red" ID="Button1" runat="server" Text="Red" BackColor="Red" />
<asp:Button SkinID="Yellow" ID="Button2" runat="server" Text="Yellow" BackColor="Yellow" />
</asp:Content>
Split view
Output
Name: ABHAY DAUNDKAR
Roll No.:8423
Skin1.skin
<asp:Button SkinID="Red" runat="server" Text="RED" BackColor="Red" BorderColor="Black"/>
<asp:Button SkinID="Yellow" runat="server" Text="YELLOW" BackColor="Yellow"
BorderColor="Black" />
<asp:Button SkinID="blue" runat="server" Text="BLUE" BackColor="#0066FF"
BorderColor="Black" />
<asp:Button SkinID="orange" runat="server" Text="ORANGE" BackColor="#FF9900"
BorderColor="Black" />
Name: ABHAY DAUNDKAR
Roll No.:8423
PRACTICAL NO 6
Roll No.:8423
● System.Data.Common-
namespace defines common classes. These classes are base classes for
concrete data provider classes.
● System.Data.Oledb-
Namespace defines classes to work with OLE-DB data sources
using.NET OleDb data providers.
● System.Data.SqlClient-
namespaces define Sql.NET data provider classes to work with SQL
server 7.0 or later databases.
● System.Data.SqlTypes-
providers a group classes representing the specific types found in
SQL server. Some of these classes are SqlBinary SqlMoney,
SqlString, SqlDouble, SqlDateTime, and SqlNumeric.
Roll No.:8423
WebForm1.aspx.cs :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;
namespace CRUDdem
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Roll No.:8423
{
SqlConnection conn = new
SqlConnection(ConfigurationManager.ConnectionStrings["StudentCo
nnectionString"].ConnectionString);
conn.Open();
SqlCommand cmd = new SqlCommand("insert into
student(roll_no,name,marks) values
(@rollno,@name,@marks)",conn);
cmd.Parameters.AddWithValue("@rollno",tbRollNo.Text);
cmd.Parameters.AddWithValue("@name", tbName.Text);
cmd.Parameters.AddWithValue("@marks", tbMarks.Text);
cmd.ExecuteNonQuery();
Roll No.:8423
conn.Close();
}
catch(Exception ex)
{
Response.Write(ex.ToString());
}
}
Roll No.:8423
Response.Write("Successfully Updated");
conn.Close();
}
}
}
Web.Config :
<connectionStrings>
Name: ABHAY DAUNDKAR
Roll No.:8423
Output :
Student Table
Add Details
Name: ABHAY DAUNDKAR
Roll No.:8423
Search Details
Name: ABHAY DAUNDKAR
Roll No.:8423
Update
Name: ABHAY DAUNDKAR
Roll No.:8423
Delete
Name: ABHAY DAUNDKAR
Roll No.:8423
Name: ABHAY DAUNDKAR
Roll No.:8423
Dashboard.aspx :
Dashboard.aspx.cs :
using System; using System.Collections.Generic; using System.Linq;
using System.Web; using System.Web.UI; using
System.Web.UI.WebControls; using System.Data; using
System.Data.SqlClient; using System.Configuration;
namespace disconectedArchitecture
Name: ABHAY DAUNDKAR
Roll No.:8423
}
private void GetDetails()
{
SqlConnection con = new
SqlConnection(ConfigurationManager.ConnectionStrings["Connectio
nString"].Co nnectionString);
SqlDataAdapter da = new SqlDataAdapter("Select * from
student", con);
DataSet ds = new DataSet();
da.Fill(ds, "StudentDetails");
GridView2.DataSource = ds;
GridView2.DataBind();
Label1.Text = "Data Added to Dataset";
}
protected void getbtn_Click(object sender, EventArgs e)
{
GetDetails();
}
}
}
Name: ABHAY DAUNDKAR
Roll No.:8423
Output :
Name: ABHAY DAUNDKAR
Roll No.:8423
Name: ABHAY DAUNDKAR
Roll No.:8423
Practical 8
Webform1.aspx
Code:
<!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/xhtul">
<head runat "server">
<title></title>
</head>
<body>
<form id="forml" runat="server">
<div style="font-family: Arial">
<asp:Button ID-"btnGetDataFromDB runat="server" Text="Get Data
from Database" />
<asp:GridView ID="gvStudents' runat=server"
AutoGenerateColumns "False"
DatakeyNames "ID" >
<Columns>
Name: ABHAY DAUNDKAR
Roll No.:8423
<asp:CommandField ShowDeleteButton-"True"
ShowEditButton-"True" />
<asp:BoundField DataField="ID" Header Text="ID"
Insertvisible="False"
ReadOnly="True" Sort Expression="ID" />
<asp:BoundField DataField="Name" Header Text="Name"
SortExpression="Name" />
<asp:BoundField DataField="Gender" HeaderText="Gender"
SortExpression="Gender" />
<asp:BoundField DataField-"TotalMarks" Header Text-"TotalMarks"
SortExpression-"TotalMarks" />
</Columns >
</asp:GridView>
<asp:Label ID="lblMessage" runat="server" Text="Label">
</asp:Label>
<asp:Button ID="btnUpdateDB' runat="server" Text="Button" />
<asp:SqlDataSource
ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:DBCS %>"
DeleteCommand="DELETE FROM
[tb]Students] WHERE [ID] = @ID" InsertCommand="INSERT
INTO [tblStudents] ([Name], [Gender],
[TotalMarks]) VALUES (@Name, @Gender, @TotalMarks)"
SelectCommand="SELECT * FROM [tblStudents]"
UpdateCommand="UPDATE [tblStudents] SET [Name] = @Name,
[Gender] = @Gender,
Name: ABHAY DAUNDKAR
Roll No.:8423
Design
<body>
<form id="form1" runat="server">
Name: ABHAY DAUNDKAR
Roll No.:8423
<div style="font-family:Arial">
<asp:Button ID="btnGetDataFromDB" runat="server" Text="Get
Data from Database" />
<asp:GridView ID="gvStudents' runat="server"
AutoGenerateColumns="False"
DatakeyNames="ID">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="ID" HeaderText="ID"
InsertVisible="False"
ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name"
SortExpression="Name" />
<asp:BoundField DataField="Gender" Header Text="Gender"
SortExpression="Gender" />
<asp:BoundField DataField="TotalMarks" HeaderText="TotalMarks"
SortExpression="totalMarks" />
</Columns>
</asp:GridView>
<asp:Button ID="btnUpdateDB" runat="server" Text="Update
Database Table" />
<asp:Label ID="lblMessage" runat="server">
</asp:Label>
</div>
</form>
Name: ABHAY DAUNDKAR
Roll No.:8423
</body>
WebForm1.aspx.cs
namespace WebFormsDemo
{
public partial class WebForm1 : System.Web.UI.Page
{
}
private void GetDataFromDB()
{
string CS = ConfigurationManager.ConnectionStrings
["DBCS").ConnectionString; SqlConnection con = new
SqlConnection(CS); string strSelectQuery = "Select *
from tblStudents";
SqlDataAdapter da = new SqlDataAdapter(strSelectQuery, con);
DataSet ds = new
DataSet(); da.Fill(ds,
"Students");
ds. Tables["Students"].PrimaryKey = new DataColumn[] { ds.
Tables["Students"].Columns["ID"] };
Name: ABHAY DAUNDKAR
Roll No.:8423
Roll No.:8423
GetDataFromCache();
}
protected void gvStudents_RowUpdating(object sender,
GridViewUpdate EventArgs e)
{
if (Cache[ "DATASET"] != null)
{
DataSet ds = (DataSet)Cache [ "DATASET"];
DataRow dr = ds.
Tables["Students"].Rows.Find(e.Keys
["ID"]); dr["Name"] = e. NewValues
[ "Name"); dr["Gender"] = e.
NewValues["Gender"); dr["TotalMarks"] =
e. NewValues["TotalMarks"];
Cache. Insert("DATASET", ds, null, DateTime.Now.AddHours (24),
System.Web.Caching.Cache. NoSlidingExpiration);
gvStudents.EditIndex= -1;
GetDataFromCache();
}
}
protected void gvStudents_RowCancelingEdit(object sender,
GridViewCancelEditEventArgs e)
{
gvStudents.EditIndex= -1;
GetDataFromCache();
}
protected void gvStudents_RowDeleting(object sender,
GridViewDeleteEventArgs e)
{
Name: ABHAY DAUNDKAR
Roll No.:8423
Roll No.:8423
da.UpdateCommand=
updateCommand; da.Update(ds,
"Students");
string strDeleteCommand = "Delete from tblStudents where
ID= @ID”; SqlCommand deleteCommand = new
SqlCommand(strDeleteCommand, con);
deleteCommand.Parameters.Add("@Id", SqlDbType. Int, 0,
"Id"l); da.DeleteCommand= deleteCommand;
}
Update:
Name: ABHAY DAUNDKAR
Roll No.:8423
Delete:
Name: ABHAY DAUNDKAR
Roll No.:8423
Name: ABHAY DAUNDKAR
Roll No.:8423
Practical 9
Program1: Directives:
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/
angular.min.js"></ script> <body>
<div ng-app="" ng-init="firstName='Juned'">
<p>Input something in the input box:</p>
<p>Name: <input type="text" ng-model="firstName"></p>
<p>You wrote: {{ firstName }}</p>
</div>
</body>
</html>
Name: ABHAY DAUNDKAR
Roll No.:8423
Roll No.:8423
Program3: Controllers
<!DOCTYPE html>
<html>
<script
src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/
angular.min.js"></ script> <body>
<div ng-app="myApp" ng-controller="myCtrl">
First Name: <input type="text" ng-model="firstName"><br>
Last Name: <input type="text" ng-model="lastName"><br>
<br>
Full Name: {{firstName + " " + lastName}}
</div>
<script>
var app = angular.module('myApp', []);
app.controller('myCtrl', function($scope) {
$scope.firstName = "Juned";
$scope.lastName = "8487";
});
</script>
Name: ABHAY DAUNDKAR
Roll No.:8423
</body>
</html>