You are on page 1of 94

SHAGUN DEOGHARKAR

FYMCA , ROLL NO 12

PRACTICAL NO 1

AIM : Design UI based Application using basic windows form control.

cs code :
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
string name = t1.Text;
string email = t2.Text;
// MessageBox.Show(" My Name is " + name + " Email is
" + email);
string gender;
if (r1.Checked)
{
gender = "MALE";
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

else
{
gender = "FEMALE";
}
string feedback;
if (c1.Checked)
{
feedback = "GOOD";
}
else
{
feedback = "BAD";
}
l5.Text = "Name is " + name + "\nEmail is " + email
+ "\nGender is " + gender + "\nfeedback is " + feedback;
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 2

Aim: Design a window form to convert temperature from Celsius to


Fahrenheit and vice versa.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void button1_Click(object sender, EventArgs e)


{
double c, f, result;
if (ftoC.Checked)
{
f = Convert.ToDouble(textBox1.Text);
textBox2.Text = Convert.ToString((f - 32) * 5 /
9);

}
else
{
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

c = Convert.ToDouble(textBox1.Text);
textBox2.Text = Convert.ToString((c * 1.8) + 32);
}

}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 3

Aim: Design a webpage to provide functionality of Date, Time Object.

cs code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace prac3
{
class Program
{
static void Main(string[] args)
{
DateTime d = DateTime.Now;
Console.WriteLine("ROLL NO 12");
Console.WriteLine(d);
d.AddDays(5);
Console.WriteLine(d.AddDays(5));

d.AddYears(2);
Console.WriteLine(d.AddYears(2));

d.AddMonths(5);
Console.WriteLine(d.AddMonths(5));

d.AddMinutes(5);
Console.WriteLine(d.AddMinutes(5));

d.AddSeconds(5);
Console.WriteLine(d.AddSeconds(5));
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 4

Aim: Design Application using Classes and Objects.

cs Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace prac4
{
class shaggy
{

public void get()


{
Console.WriteLine("This is Class");
}

public void display()


{
Console.WriteLine("This is FYMCA");
}
class Program
{
static void Main(string[] args)
{
Console.WriteLine("ROLL NO 12");
shaggy a = new shaggy();
a.get();
a.display();
shaggy a1 = new shaggy();
a1.get();
a1.display();
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

shaggy a2 = new shaggy();


a2.get();
a2.display();
Console.ReadLine();
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 5

Aim: Design a Console Application using Inheritance with all types.

Simple Inheritance

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Prac2
{

class Parent
{
public void display()
{
Console.WriteLine("This is parent class");
}
}

class child: Parent


{
public void display1()
{
Console.WriteLine("This is child class");
}
}

class Program
{
static void Main(string[] args)
{
child c = new child();
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

c.display();
c.display1();
Console.ReadLine();
}
}
}

MULTIPLE INHERITANCE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Prac2
{
public interface if1
{
void display();
}

public interface if2


{
void display1();
}

public class demo : if1, if2


{
public void display()
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
Console.WriteLine("Interface 1");
}

public void display1()


{
Console.WriteLine("Interface 2");
}

public void display2()


{
Console.WriteLine("Multiple Inheritence using
Interface");
}
}
class multiple
{
static void Main(string[] args)
{
demo d = new demo();
d.display();
d.display1();
d.display2();
Console.ReadLine();
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

MULTILEVEL INHERITANCE

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Prac2
{
class Parent1
{
public void display()
{
Console.WriteLine("This is Parent Class");
}
}

class child1 : Parent1


{
public void display1()
{
Console.WriteLine("This is Child1 Class");
}
}

class child2 : child1


{
public void display2()
{
Console.WriteLine("This is Child2 Class");
}
}

class multilevel
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
static void Main(string[] args)
{
child2 c2 = new child2();
c2.display();
c2.display1();
c2.display2();

Console.ReadLine();
}
}
}

Hierarchical Inheritance.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Prac2
{
class Parent2
{
public void display()
{
Console.WriteLine("This is Parent Class");
}
}
class child3 : Parent2
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
public void display1()
{
Console.WriteLine("This is Child1 Class");
}
}
class child4 : Parent2
{
public void display2()
{
Console.WriteLine("This is Child2 Class");
}
}
class heirarchical
{
static void Main(string[] args)
{
child3 c3 = new child3();
c3.display();
c3.display1();
child4 c4 = new child4();
c4.display();
c4.display2();
Console.ReadLine();
}
}
}

PRACTICAL NO 6
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Aim: Design a Console Application using Abstract class

cs Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Prac2
{
public abstract class customer
{
public abstract void print();
}
public class abstrac : customer
{
public override void print()
{
Console.WriteLine("abstarct class");
}
static void Main(string[] args)
{
abstrac a = new abstrac();
a.print();
Console.ReadLine();
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 7

Aim: Create a Website using the Master Page concept.

Site1.master

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


CodeBehind="Site1.master.cs" Inherits="master.Site1" %>

<!DOCTYPE html>

<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body style="height: 535px">
<form id="form1" runat="server">
<div style="height: 517px">
<div class="wrapper">
<div class="menu">
<ul>
<li> <a href="home.aspx"> HOME </a></li>
<li> <a href="contact.aspx"> CONTACT </a></li>
<li> <a href="about.aspx"> ABOUT US </a></li>
<li> <a href="product.aspx"> PRODUCT </a></li>
</ul>

</div>
<div class="content">
<asp:ContentPlaceHolder ID="ContentPlaceHolder1"
runat="server">
</asp:ContentPlaceHolder>
</div>
</div>
</div>
</form>
</body>
</html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Home.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"


AutoEventWireup="true" CodeBehind="home.aspx.cs"
Inherits="master.home" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>This is home page</p>
</asp:Content>

Contact.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"


AutoEventWireup="true" CodeBehind="contact.aspx.cs"
Inherits="master.contact" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>This is Contact page</p>
</asp:Content>

Product.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"


AutoEventWireup="true" CodeBehind="product.aspx.cs"
Inherits="master.product" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">

</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>This is product page</p>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</asp:Content>

About.aspx:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master"


AutoEventWireup="true" CodeBehind="about.aspx.cs"
Inherits="master.about" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head"
runat="server">
</asp:Content>
<asp:Content ID="Content2"
ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<p>This is About page</p>
</asp:Content>

OUTPUT:
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 8

Aim: Create a web page to design a basic calculator

calcy.cs

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


CodeBehind="calcy.aspx.cs" Inherits="Calculator.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;
<asp:Label ID="Label4" runat="server" Text="Roll No:
12"></asp:Label>
<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Enter
First Number: "></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"
style="margin-left: 53px"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="Enter
Second Number: "></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"
style="margin-left: 36px"></asp:TextBox>
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<br />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="Add" Width="47px" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Subtract" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button3" runat="server"
OnClick="Button3_Click" Text="Multiply" Width="56px" />
&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button4" runat="server"
OnClick="Button4_Click" Text="Divide" />
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server"></asp:Label>
</div>
</form>
</body>
</html>

Calcy.aspx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Calculator
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
int t1 = Convert.ToInt32(TextBox1.Text);
int t2 = Convert.ToInt32(TextBox2.Text);
int addition = (t1) + (t2);
Label3.Text = "Addition is " +
Convert.ToString(addition);
}

protected void Button2_Click(object sender, EventArgs e)


{
int t1 = Convert.ToInt32(TextBox1.Text);
int t2 = Convert.ToInt32(TextBox2.Text);
int addition = (t1) - (t2);
Label3.Text = "Subtraction is " +
Convert.ToString(addition);
}

protected void Button3_Click(object sender, EventArgs e)


{
int t1 = Convert.ToInt32(TextBox1.Text);
int t2 = Convert.ToInt32(TextBox2.Text);
int addition = (t1) * (t2);
Label3.Text = "Multiplication is " +
Convert.ToString(addition);
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

protected void Button4_Click(object sender, EventArgs e)


{
int t1 = Convert.ToInt32(TextBox1.Text);
int t2 = Convert.ToInt32(TextBox2.Text);
int addition = (t1) / (t2);
Label3.Text = "Division is " +
Convert.ToString(addition);
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 9

AIM : Design a registration form.

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


CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1"
%>
<!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: 600px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server"
Text="REGISTRATION FORM"></asp:Label>
<br />
<br />
&nbsp;<asp:Label ID="Label2" runat="server" Text="FIRST
NAME"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="t1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="LAST
NAME"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="t2" runat="server"></asp:TextBox>
<br />
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Label ID="Label4" runat="server"


Text="AGE"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="t3" runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label5" runat="server"
Text="GENDER"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButtonList ID="RadioButtonList1"
runat="server" style="margin-left: 72px" Width="104px">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Label ID="Label6" runat="server"
Text="SKILLS"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
style="margin-left: 82px" Width="78px">
<asp:ListItem>Python</asp:ListItem>
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>Java</asp:ListItem>
<asp:ListItem>C++</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
</asp:CheckBoxList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Button ID="Button1" runat="server"


OnClick="Button1_Click" Text="SUBMIT" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
<br />
&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="l8" runat="server"></asp:Label>
</div>
</form>
</body>
</html>

WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{

protected void Button1_Click(object sender, EventArgs e)


{
l8.Text = "FIRST NAME: " + t1.Text + "<br/>LAST NAME:
" + t2.Text + "<br/> AGE: " + t3.Text + "<br/> GENDER: " +
RadioButtonList1.Text;
foreach (ListItem lst in CheckBoxList1.Items)
if (lst.Selected == true)
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
l8.Text += "\nSKILLS " + lst.Text + "<br/>";
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 10

AIM : Design a web Application with advanced control validation.

webform1.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication2
{
public partial class WebForm1 : System.Web.UI.Page
{

protected void Button1_Click(object sender, EventArgs e)


{
l8.Text = "FIRST NAME: " + t1.Text + "<br/>LAST NAME:
" + t2.Text + "<br/> AGE: " + t3.Text + "<br/> GENDER: " +
RadioButtonList1.Text;
foreach (ListItem lst in CheckBoxList1.Items)
if (lst.Selected == true)
{
l8.Text += "\nSKILLS " + lst.Text + "<br/>";
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication2.WebForm1"
%>

<!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: 600px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server"
Text="REGISTRATION FORM"></asp:Label>
<br />
<br />
&nbsp;<asp:Label ID="Label2" runat="server" Text="FIRST
NAME"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;<asp:TextBox ID="t1"
runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator
ID="RequiredFieldValidator1" runat="server"
ErrorMessage="RequiredFieldValidator" ControlToValidate="t1"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Label ID="Label3" runat="server" Text="LAST


NAME"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="t2" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator
ID="RequiredFieldValidator2" runat="server"
ErrorMessage="RequiredFieldValidator"></asp:RequiredFieldValidato
r>
<br />
<br />
<asp:Label ID="Label4" runat="server"
Text="AGE"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="t3" runat="server"></asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RangeValidator ID="RangeValidator1"
runat="server"
ErrorMessage="RangeValidator"></asp:RangeValidator>
<br />
<br />
<asp:Label ID="Label7" runat="server" Text="Email
Id"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RegularExpressionValidator
ID="RegularExpressionValidator1" runat="server"
ErrorMessage="RegularExpressionValidator"></asp:RegularExpression
Validator>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<br />
<br />
<asp:Label ID="Label10" runat="server" Text="User
Id"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox4"
runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label8" runat="server"
Text="Password"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RequiredFieldValidator
ID="RequiredFieldValidator3" runat="server"
ErrorMessage="RequiredFieldValidator" ControlToValidate="t1"
ForeColor="Red"></asp:RequiredFieldValidator>
<br />
<br />
<asp:Label ID="Label9" runat="server" Text="Confirm
Password"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:TextBox ID="TextBox3" runat="server"
OnTextChanged="TextBox3_TextChanged"></asp:TextBox>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;
<asp:CompareValidator ID="CompareValidator1"
runat="server"
ErrorMessage="CompareValidator"></asp:CompareValidator>
<br />
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Label ID="Label5" runat="server"


Text="GENDER"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:RadioButtonList ID="RadioButtonList1"
runat="server" style="margin-left: 72px" Width="104px">
<asp:ListItem>Male</asp:ListItem>
<asp:ListItem>Female</asp:ListItem>
</asp:RadioButtonList>
<br />
<asp:Label ID="Label6" runat="server"
Text="SKILLS"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:CheckBoxList ID="CheckBoxList1" runat="server"
style="margin-left: 82px" Width="78px">
<asp:ListItem>Python</asp:ListItem>
<asp:ListItem>C#</asp:ListItem>
<asp:ListItem>Java</asp:ListItem>
<asp:ListItem>C++</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
</asp:CheckBoxList>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" Text="SUBMIT" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="l8" runat="server"></asp:Label>
</div>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</form>
</body>
</html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 11

Aim: Design an Asp.Net Application to display Current Month Calendar.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication8
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Calendar1_SelectionChanged(object sender,
EventArgs e)
{
Response.Write("Your Selected Date is: ");
Response.Write(Calendar1.SelectedDate.ToShortDateString());
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 12

Aim: Design a Web Page to show ice-cream flavor selected by user using
AutoPostBack property.

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


CodeBehind="aurtopost.aspx.cs" Inherits="AutoPostBack.aurtopost"
%>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Example of AutoPostBack<br />
<br />
Select ice-cream from the box<br />
<br />
<asp:ListBox ID="ListBox1" AutoPostBack="true"
runat="server">
<asp:ListItem>Chocolate</asp:ListItem>
<asp:ListItem>Vanilla</asp:ListItem>
<asp:ListItem>Strawberry</asp:ListItem>
<asp:ListItem>Cheesecake</asp:ListItem>
</asp:ListBox>
<br />
<br />
<asp:Label ID="Label1" runat="server"
Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

aurtopost.aspx
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace AutoPostBack
{
public partial class aurtopost : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(ListBox1.SelectedItem != null)
{
Label1.Text = "Flavour of your ice-cream (Yash)"
+ ListBox1.SelectedItem.Value;
}
else
{
Label1.Text = "";
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 13

Aim: Design a Web Application using Client side Session Management


Technique

Webform1.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication9.WebForm1"
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
ROll NO 12
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode Text="HOME" Value="HOME"
NavigateUrl="~/Webform1.aspx"></asp:TreeNode>
<asp:TreeNode Text="Employee"
Value="Employee">
<asp:TreeNode Text="Upload Resume"
Value="Upload Resume"
NavigateUrl="~/uploadaspx.aspx"></asp:TreeNode>
<asp:TreeNode Text="Edit Resume"
Value="Edit Resume" NavigateUrl="~/edit.aspx"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode Text="Logout" Value="Logout"
NavigateUrl="~/logout.aspx"></asp:TreeNode>
</Nodes>
</asp:TreeView>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</div>
</form>
</body>
</html>

Upload.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="uploadaspx.aspx.cs"
Inherits="WebApplication9.uploadaspx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Upload Succesfull
</div>
</form>
</body>
</html>

Edit.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="edit.aspx.cs" Inherits="WebApplication9.edit" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<div>
Edit your resume
</div>
</form>
</body>
</html>

Logout.aspx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="logout.aspx.cs" Inherits="WebApplication9.logout" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Logout Successfull
</div>
</form>
</body>
</html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 14

Aim: Design a Web Application using Client side Session Management


Technique

Page1.aspx

Source code:

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


CodeBehind="page1.aspx.cs" Inherits="Practical27.WebForm1" %>

<!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: 446px">
<asp:Label ID="Label1" runat="server"
Text="Name"></asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="E-
mail"></asp:Label>
&nbsp;
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" style="margin-left: 48px" Text="Go Next
Page" Width="127px" />
</div>
</form>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</body>
</html>

Page1.aspx.cs

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical27
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Session["Name"] = TextBox1.Text;
Session["E-mail"] = TextBox2.Text;
Response.Redirect("~/page2.aspx");
}
}
}

Page2.aspx

Source code:

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


CodeBehind="page2.aspx.cs" Inherits="Practical27.session2" %>

<!DOCTYPE html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="height: 537px">
<asp:Label ID="Label1" runat="server"
Text="Name"></asp:Label>
&nbsp;
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="E-
mail"></asp:Label>
&nbsp;
<asp:Label ID="Label4" runat="server"
Text="Label"></asp:Label>
</div>
</form>
</body>
</html>

Page.aspx.cs

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical27
{
public partial class session2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

{
if(Session["Name"]!=null)
{
Label2.Text = Session["Name"].ToString();
}
if(Session["E-mail"]!=null)
{
Label4.Text = Session["E-mail"].ToString();
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 15

Aim: Design a WebApplication to Demonstrate the concept of state


management technique using cookies.

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


CodeBehind="cookie.aspx.cs" Inherits="AutoPostBack.cookie" %>

<!DOCTYPE html>

<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"
OnClick="Button1_Click" Text="Create Cookie" Width="136px" />
<asp:TextBox ID="TextBox1" runat="server" style="margin-
left: 56px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" Text="Retrieve Cookie" />
<asp:TextBox ID="TextBox2" runat="server" style="margin-
left: 56px"></asp:TextBox>
</div>
</form>
</body>
</html>

cookie.aspx

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

using System.Web.UI.WebControls;
namespace AutoPostBack
{
public partial class cookie : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
Response.Cookies["user"].Value = TextBox1.Text;
Response.Cookies["user"].Expires =
DateTime.Now.AddMinutes(1);
TextBox1.Text = "";
}
protected void Button2_Click(object sender, EventArgs e)
{
if(Request.Cookies["user"]!=null)
{
TextBox2.Text = Request.Cookies["user"].Value;
}
else
{
TextBox2.Text = "Biscuit not found";
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 16

Aim: Build Website to demonstrate the working of Entity Framework in


dot net.

Webserver.aspx
Souce code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="web_server.aspx.cs"
Inherits="Sql_server_Pract.web_server" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label4" runat="server" Font-Size="X-
Large" Text="SQL Server Program (RollNo:33)"></asp:Label>
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label1" runat="server"
Text="RollNo"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"
style="margin-left: 54px"></asp:TextBox>
<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server"
Text="FirstName"></asp:Label>
<asp:TextBox ID="TextBox2" runat="server"
style="margin-left: 34px"></asp:TextBox>
<br />
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server"
Text="LastName"></asp:Label>
<asp:TextBox ID="TextBox3" runat="server"
style="margin-left: 38px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" style="margin-left: 32px" Text="Save"
Width="62px" />
<asp:Button ID="Button2" runat="server"
OnClick="Button2_Click" style="margin-left: 49px"
Text="Update" />
<asp:Button ID="Button3" runat="server"
OnClick="Button3_Click" style="margin-left: 59px"
Text="Delete" />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label5" runat="server"
Text="OutPut"></asp:Label>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:GridView ID="GridView1" runat="server"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
style="margin-left: 35px">
<Columns>
<asp:BoundField DataField="Rollno"
HeaderText="Rollno" SortExpression="Rollno"></asp:BoundField>
<asp:BoundField DataField="firstname"
HeaderText="firstname"
SortExpression="firstname"></asp:BoundField>
<asp:BoundField DataField="lastname"
HeaderText="lastname" SortExpression="lastname"></asp:BoundField>
</Columns>
</asp:GridView>
<br />
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:SqlDataSource ID="SqlDataSource1" runat="server"


ConnectionString="<%$ ConnectionStrings:studConnectionString %>"
SelectCommand="SELECT * FROM [student]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>

Webserver.aspx.cs
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;

namespace Sql_server_Pract
{
public partial class web_server : System.Web.UI.Page
{
string connStr =
ConfigurationManager.ConnectionStrings["conn"].ConnectionString;
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Insert into student
values(@RollNo, @FirstName,@LastName)",con);
con.Open();
cmd.Parameters.AddWithValue("@RollNo",
TextBox1.Text);
cmd.Parameters.AddWithValue("@firstName",
TextBox2.Text);
cmd.Parameters.AddWithValue("@lastName",
TextBox3.Text);
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

int result = cmd.ExecuteNonQuery();


if (result > 0)
{
Label5.Text = "Record Successfully Inserted :)";
}
else
{
Label5.Text = "Record Not Inserted :(";
}
}

protected void Button2_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("update student set
FirstName=@FirstName, LastName=@LastName where RollNo=@RollNo",
con);
con.Open();
cmd.Parameters.AddWithValue("@RollNo",
TextBox1.Text);
cmd.Parameters.AddWithValue("@FirstName",
TextBox2.Text);
cmd.Parameters.AddWithValue("@LastName",
TextBox3.Text);
int result = cmd.ExecuteNonQuery();
if (result > 0)
{
Label5.Text = "Record Successfully Updated :)";
}
else
{
Label5.Text = "Record Not Updated :(";
}

protected void Button3_Click(object sender, EventArgs e)


{
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Delete from student
where RollNo=@RollNo", con);
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

con.Open();
cmd.Parameters.AddWithValue("@RollNo",
TextBox1.Text);
cmd.Parameters.AddWithValue("@firstName",
TextBox2.Text);
cmd.Parameters.AddWithValue("@lastName",
TextBox3.Text);
int result = cmd.ExecuteNonQuery();
if (result > 0)
{
Label5.Text = "Record Successfully Deleted :)";
}
else
{
Label5.Text = "Record Not Deleted :(";
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 17

Aim: Create a Windows based Application to demonstrate a connection


oriented Architecture.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Form1_Load();
}

private void Form1_Load()


{
//Connected Architecture
SqlConnection con = new
SqlConnection(@"Server=DESKTOP-24U44F0\MSSQLSERVER01;
Database=aiml; Integrated Security=True");
SqlCommand cmd = new SqlCommand("select Name from
AIML_00", con);
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

con.Open();
SqlDataReader sr = cmd.ExecuteReader();
CB_Name.Items.Add("Selected Name");
CB_Name.SelectedIndex = 0;
if (sr.HasRows)
{
while (sr.Read())
{
CB_Name.Items.Add(sr["Name"].ToString());
}
}
con.Close();
}

private void button1_Click(object sender, EventArgs e)


{
//Connected Architecture
SqlConnection con = new
SqlConnection(@"Server=DESKTOP-24U44F0\MSSQLSERVER01;
Database=aiml; Integrated Security=True");
SqlCommand details_cmd = new SqlCommand("select *
from AIML_00 where Name=@Name", con);
details_cmd.Parameters.AddWithValue("@Name",
CB_Name.SelectedItem.ToString());
con.Open();
SqlDataReader dr = details_cmd.ExecuteReader();
DataTable table = new DataTable();
table.Load(dr);
DGV.DataSource = table;
con.Close();

}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

private void comboBox1_SelectedIndexChanged(object


sender, EventArgs e)
{

}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 18

Aim: Create a Windows based Application to demonstrate a


Disconnected Architecture.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Form1_Load();
}

private void Form1_Load()


{

// Disconnected Architecture
SqlConnection con = new
SqlConnection(@"Server=(localdb)\MSSQLLocalDB;
Database=Student27; Integrated Security=True");
SqlCommand cmd = new SqlCommand("select Name from
Registration", con);
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
con.Close();
CB_Name.Items.Add("Select Name");
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

CB_Name.SelectedIndex = 0;
DataSet ds = new DataSet();
sda.Fill(ds);
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >
0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow dro = ds.Tables[0].Rows[i];
CB_Name.Items.Add(dro["Name"].ToString());
}
}
}

private void BTN_Select_Click_Click(object sender,


EventArgs e)
{

//Disconnected Architecture
SqlConnection con = new
SqlConnection(@"Server=(localdb)\MSSQLLocalDB;
Database=Student27; Integrated Security=True");
SqlCommand details_cmd = new SqlCommand("select *
from Registration where name=@name", con);
details_cmd.Parameters.AddWithValue("@name",
CB_Name.SelectedItem.ToString());
con.Open();
SqlDataAdapter sda = new
SqlDataAdapter(details_cmd);
con.Close();
DataSet ds = new DataSet();
sda.Fill(ds);
DGV.DataSource = ds.Tables[0];
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 19

Aim: Design a Web Application to demonstrate the concept of Server-


side state management Technique.

Page1.aspx

Source code:

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


CodeBehind="page1.aspx.cs" Inherits="Practical27.WebForm1" %>

<!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: 446px">
<asp:Label ID="Label1" runat="server"
Text="Name"></asp:Label>
&nbsp;&nbsp;
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<br />
<br />
<asp:Label ID="Label2" runat="server" Text="E-
mail"></asp:Label>
&nbsp;
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server"
OnClick="Button1_Click" style="margin-left: 48px" Text="Go Next
Page" Width="127px" />
</div>
</form>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</body>
</html>

Page1.aspx.cs

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical27
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

protected void Button1_Click(object sender, EventArgs e)


{
Session["Name"] = TextBox1.Text;
Session["E-mail"] = TextBox2.Text;
Response.Redirect("~/page2.aspx");
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Page2.aspx

Source code:

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


CodeBehind="page2.aspx.cs" Inherits="Practical27.session2" %>

<!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: 537px">
<asp:Label ID="Label1" runat="server"
Text="Name"></asp:Label>
&nbsp;
<asp:Label ID="Label2" runat="server"
Text="Label"></asp:Label>
<br />
<br />
<asp:Label ID="Label3" runat="server" Text="E-
mail"></asp:Label>
&nbsp;
<asp:Label ID="Label4" runat="server"
Text="Label"></asp:Label>
</div>
</form>
</body>
</html>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Page.aspx.cs

Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Practical27
{
public partial class session2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(Session["Name"]!=null)
{
Label2.Text = Session["Name"].ToString();
}
if(Session["E-mail"]!=null)
{
Label4.Text = Session["E-mail"].ToString();
}
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 20

Aim: Design a Web Application using Data Bound Control.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
Form1_Load();
}

private void Form1_Load()


{

// Disconnected Architecture
SqlConnection con = new
SqlConnection(@"Server=(localdb)\MSSQLLocalDB;
Database=Student27; Integrated Security=True");
SqlCommand cmd = new SqlCommand("select Name from
Registration", con);
con.Open();
SqlDataAdapter sda = new SqlDataAdapter(cmd);
con.Close();
CB_Name.Items.Add("Select Name");
CB_Name.SelectedIndex = 0;
DataSet ds = new DataSet();
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

sda.Fill(ds);
if (ds.Tables.Count > 0 && ds.Tables[0].Rows.Count >
0)
{
for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
{
DataRow dro = ds.Tables[0].Rows[i];
CB_Name.Items.Add(dro["Name"].ToString());
}
}
}

private void BTN_Select_Click_Click(object sender,


EventArgs e)
{

//Disconnected Architecture
SqlConnection con = new
SqlConnection(@"Server=(localdb)\MSSQLLocalDB;
Database=Student27; Integrated Security=True");
SqlCommand details_cmd = new SqlCommand("select *
from Registration where name=@name", con);
details_cmd.Parameters.AddWithValue("@name",
CB_Name.SelectedItem.ToString());
con.Open();
SqlDataAdapter sda = new
SqlDataAdapter(details_cmd);
con.Close();
DataSet ds = new DataSet();
sda.Fill(ds);
DGV.DataSource = ds.Tables[0];
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 21
Aim: Design a web application to perform CRUD Operation Using LinQ.

Webform.aspx:
Soucre code:
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="linq_pract21.WebForm1" %>
<!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 {
width: 305px;
height: 229px;
}
.auto-style4 {
margin-left: 345px;
}
.auto-style5 {
width: 305px;
height: 45px;
}
.auto-style6 {
height: 45px;
}
.auto-style7 {
width: 305px;
height: 48px;
}
.auto-style8 {
height: 48px;
}
.auto-style9 {
width: 305px;
height: 41px;
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

.auto-style10 {
height: 41px;
}
.auto-style11 {
width: 305px;
height: 76px;
}
.auto-style12 {
height: 76px;
}
.auto-style13 {
height: 229px;
}
.auto-style14 {
height: 58px;
}
.auto-style15 {
height: 113px;
}
.auto-style16 {
height: 57px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td colspan="2" style="font-size:x-large;
color:#000080; background-color:#808080; font-style: inherit;"
class="auto-style8">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp; CRUD Operation Using LinQ C#</td>
</tr>
<tr>
<td class="auto-style5">
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Label ID="Label1" runat="server"


Text="User Id"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox1" runat="server"
Height="24px" Width="203px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Label ID="Label2" runat="server"
Text="User Name"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="TextBox2" runat="server"
Height="21px" Width="202px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style7">
<asp:Label ID="Label3" runat="server"
Text="Address"></asp:Label>
</td>
<td class="auto-style8">
<asp:TextBox ID="TextBox3" runat="server"
Height="23px" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style9">
<asp:Label ID="Label4" runat="server"
Text="Age"></asp:Label>
</td>
<td class="auto-style10">
<asp:TextBox ID="TextBox4" runat="server"
Height="26px" Width="200px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style11">
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

<asp:Label ID="Label5" runat="server"


Text="Gender"></asp:Label>
</td>
<td class="auto-style12">
<asp:RadioButtonList
ID="RadioButtonList1" runat="server">
<asp:ListItem>Female</asp:ListItem>
<asp:ListItem>Male</asp:ListItem>
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server"
Text="Date Of Birth"></asp:Label>
</td>
<td class="auto-style13">
<asp:Calendar ID="Calendar1"
runat="server"></asp:Calendar>
</td>
</tr>
<tr>
<td class="auto-style14" colspan="2">
<asp:Button ID="Button1" runat="server"
CssClass="auto-style4" Height="38px" OnClick="Button1_Click"
Text="Insert" Width="85px" />
</td>
</tr>
<tr>
<td class="auto-style15" colspan="2">
<asp:GridView ID="GridView1"
runat="server" Width="521px">
</asp:GridView>
</td>
</tr>
<tr>
<td class="auto-style16" colspan="2">
<asp:LinqDataSource ID="LinqDataSource1"
runat="server">
</asp:LinqDataSource>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

</td>
</tr>
</table>
</div>
</form>
</body>
</html>

Webform.aspx.cs
Source Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace linq_pract21
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{

}
//LinQ Class File
DataClasses1DataContext db = new
DataClasses1DataContext();//insertion activity will perform using
this

protected void Button1_Click(object sender, EventArgs e)


{
try
{
//Storing data in variable
int uid = int.Parse(TextBox1.Text);
string uname = TextBox2.Text, address =
TextBox3.Text;
int Age = int.Parse(TextBox4.Text);
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

string gender = RadioButtonList1.SelectedValue;


DateTime dob =
DateTime.Parse(Calendar1.SelectedDate.ToString());

//creating instance varible to create object


class
var st = new UserInfo
{
UserID = uid,
UserName = uname,
Address = address,
Age = Age,
Gender = gender,
DateOFBirth = dob
};
db.UserInfos.InsertOnSubmit(st);
db.SubmitChanges();

ScriptManager.RegisterStartupScript(this,
this.GetType(), "script","alert('Successfully Inserted');",true);
}
catch(Exception ex)
{
ScriptManager.RegisterStartupScript(this,
this.GetType(), "script", "alert('" + ex.Message.ToString() +
"');", true);
}
}

protected void GridView1_SelectedIndexChanged(object


sender, EventArgs e)
{

}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 22

Aim: Design a web application to produce and consume a web service.

Webservice.asmx.cs
Source Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;

namespace webservice_pract22
{
/// <summary>
/// Summary description for WebService1
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.ComponentModel.ToolboxItem(false)]
// To allow this Web Service to be called from script, using
ASP.NET AJAX, uncomment the following line.
// [System.Web.Script.Services.ScriptService]
public class WebService1 : System.Web.Services.WebService
{

[WebMethod]
public int Add(int firstNumber ,int secondNumber)
{
return firstNumber + secondNumber;
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 23

Aim: Create a procedure to demonstrate the working of a Simple stored


Procedure.
create procedure roll12
As
begin
select * from AIML_00;
end
exec roll12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 24

Aim: Create a procedure to Demonstrate the working of Parameterized


Stored Procedures

Parameterized Stored Procedure:

create procedure getData1


@SrNo int
As
begin
select * from AIML_00 where SrNo= @SrNo;
end;
exec getData1 @SrNo=1
select * from AIML_00
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Altering StoreProcedure:
create procedure InsertUserInfo
@userId int,
@userName nvarchar(15),
@address nvarchar(15),
@age int,
@gender nvarchar(15)
As
begin
insert into AIML_00
values(@userId,@userName,@address,@age,@gender,'1/1/1995');
end;

exec InsertUserInfo @userId=33,


@userName='Shagun',
@address='vashi',
@age=21,
@gender=male;

Select * from AIML_00


SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

Practical NO 25

Aim:Design MVC based web application.

using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Web;

namespace WebApplication11
{
public class HomeController : Controller
{
public string Index()
{
return "Hello everyone this is my first page ..";
}
public string GetDetails()
{
return "Roll no : 12, Invoked GetDetails...";
}
}
}
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

PRACTICAL NO 26
Aim: Design a web application to produce and consume WCF
Services.

IFirstWebService.cs
Source Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace FirstWCFWebService
{
// NOTE: You can use the "Rename" command on the "Refactor"
menu to change the interface name "IFirstWebServices" in both
code and config file together.
[ServiceContract]
public interface IFirstWebServices
{
[OperationContract]
string Message();
}
}

FirstWebService.svc.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;

namespace FirstWCFWebService
{
// NOTE: You can use the "Rename" command on the "Refactor"
menu to change the class name "FirstWebServices" in code, svc and
config file together.
// NOTE: In order to launch WCF Test Client for testing this
service, please select FirstWebServices.svc or
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

FirstWebServices.svc.cs at the Solution Explorer and start


debugging.
public class FirstWebServices : IFirstWebServices
{
public string Message()
{
return "hello This Is My First WCF Web Services
Page...";
}
}
}

NOw Creating Another Project of Web application using Mvc

Project 2:(Client.Project in web application)


HomeController.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Client.FirstWebServiceReference;

namespace Client.Controllers
{
public class HomeController : Controller
{
FirstWebServicesClient client = new
FirstWebServicesClient();
public ActionResult Index()
{
ViewBag.Message=client.Message();
return View();

public ActionResult About()


{
ViewBag.Message = "Your application description
page.";

return View();
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

public ActionResult Contact()


{
ViewBag.Message = "Your contact page.";

return View();
}
}
}

Index.cshtml
@{
ViewBag.Title = "Home Page";
}

<h1>@ViewBag.Message</h1>
SHAGUN DEOGHARKAR
FYMCA , ROLL NO 12

You might also like