1.write A Program To Perform All Arithmatic Operations: Date:-22/09/2015

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 129

.

NET Tasks :-
Date:- 22/09/2015

1.Write a Program To Perform All Arithmatic Operations

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Arithmeticaspx.aspx.cs"


Inherits="Arithmeticaspx" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>

</head>
<body>
<form id="form1" runat="server">
<div>

<table style="background-color: #00FF00">


<tr>
<td >
<asp:Label ID="Label1" runat="server" Text="Enter First
Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td >
<asp:Label ID="Label2" runat="server" Text="Enter Second
Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="T2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Button ID="Button1" runat="server" ForeColor="#FF3300"
OnClick="Button1_Click" Text="Add" />
</td>
<td class="auto-style2">
<asp:Button ID="Button3" runat="server" ForeColor="Red"
OnClick="Button3_Click" Text="Subtract" />
</td>
</tr>
<tr>
<td class="auto-style5">
<asp:Button ID="Button2" runat="server" ForeColor="Red"
OnClick="Button2_Click" Text="Multply" />
</td>
<td class="auto-style6">
<asp:Button ID="Button4" runat="server" ForeColor="Red"
OnClick="Button4_Click" Text="Divide" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.Cs Code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
lbldisplay.Text ="Adition is" +( Convert.ToInt32(T1.Text) +
Convert.ToInt32(T2.Text)).ToString();
}
protected void Button3_Click(object sender, EventArgs e)
{
lbldisplay.Text = "Sutraction is "+(Convert.ToInt32(T1.Text) -
Convert.ToInt32(T2.Text)).ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
lbldisplay.Text = "Multiplication is "+(Convert.ToInt32(T1.Text) *
Convert.ToInt32(T2.Text)).ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{
lbldisplay.Text ="Division is"+ (Convert.ToInt32(T1.Text) /
Convert.ToInt32(T2.Text)).ToString();
}
}

2.Write A Program To Find Given Number Is Armstrong Or Not

.aspx Code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="factorial.aspx.cs"


Inherits="factorial" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 51%;
}
.auto-style3 {
width: 747px;
}
.auto-style4 {
width: 770px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="background-color: #FF3399">


<tr>
<td class="auto-style4">
<asp:Label ID="Label1" runat="server" Text="Enter Any
Number"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
<td class="auto-style3">
<asp:TextBox ID="T1" runat="server" Height="21px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td class="auto-style3">
<asp:Button ID="btnsubmit" runat="server" OnClick="btnsubmit_Click"
Text="Submit" ForeColor="#993333" />
</td>
</tr>
</table>
</div>
</form>
</body>
</html>

.cs code

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button2_Click(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32(T1.Text), sum = 0, r, m;
m = n;
while (n > 0)
{
r = n % 10;
sum = sum + (r * r * r);
n = n / 10;
}
if (sum == m)
{
lbldisplay.Text = "This is Armstrong Number";
}
else
{
lbldisplay.Text = "This is Not Armstrong";
}
}
}

3.Write A program To Find The Factorial of The Given Number

.aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="factorial.aspx.cs"


Inherits="factorial" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 51%;
}
.auto-style3 {
width: 747px;
}
.auto-style4 {
width: 770px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="background-color: #FF3399">


<tr>
<td class="auto-style4">
<asp:Label ID="Label1" runat="server" Text="Enter Any
Number"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
<td class="auto-style3">
<asp:TextBox ID="T1" runat="server" Height="21px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td class="auto-style3">
<asp:Button ID="btnsubmit" runat="server" OnClick="btnsubmit_Click"
Text="Submit" ForeColor="#993333" />
</td>
</tr>
</table>

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

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsubmit_Click(object sender, EventArgs e)
{
int i, n = Convert.ToInt32(T1.Text);
long f = 1;
for (i = 1; i <= n; i++)
{
f = f * i;
}
lbldisplay.Text = "factorial is" + f.ToString();
}
}

4.Write A Program To Find The Fibanocci Series

.aspx code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="fibanocci series.aspx.cs"


Inherits="fibanocci_series" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 41%;
height: 92px;
margin-right: 0px;
}
.auto-style3 {
width: 88px;
}
.auto-style4 {
width: 256px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="background-color: #66FF33">


<tr>
<td class="auto-style4">
<asp:Label ID="Label1" runat="server" Text="Enter The
Range"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="T2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td class="auto-style3">
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Submit" ForeColor="Red" />
</td>
</tr>
</table>

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

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
series();
}
int n, f1 = 0, f2 = 1, f3 = 0;
public void series()
{
Console.WriteLine("Enter Any Limit");
n = Convert.ToInt32(T2.Text);
Response.Write(f1+" ");
while(f3<n)
{
f3 = f1 + f2;
Response.Write(f3 + ",");
f1 = f2;
f2 = f3;
}

}
}

5.Write a Program to Find Given Number is Palindrome or Not ?


.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Palindrome.aspx.cs"


Inherits="Palindrome" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 67%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="background-color: #FF33CC; height: 86px;


margin-right: 0px;text-align:center">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Enter Any
Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td>
<asp:Button ID="Submit" runat="server" ForeColor="#3333FF"
OnClick="Submit_Click" Text="Submit" />
</td>
</tr>
</table>

</div>
</form>
</body>
</html>
.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Submit_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32(T1.Text), rev=0, r,m;
m = n;
while (n > 0)
{
r = n % 10;
rev = (rev * 10) + r;
n = n / 10;
}
if (rev == m)
{
lbldisplay.Text = "This is a palindrome Number";
}
else
{
lbldisplay.Text = "This is not a palinddrome";
}
}
}

6.Write a Program To Find Given Number is Perfect or not ?

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Perfect Number.aspx.cs"


Inherits="Perfect_Number" %>

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 45%;
}
</style>
</head>
<body style="height: 84px; width: 807px">
<form id="form1" runat="server">
<table class="auto-style1" style="background-color: #FF3300; height: 78px;">
<tr>
<td>
<asp:Label ID="Label1" runat="server" Text="Enter Any
Number"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td>
<asp:Button ID="Button2" runat="server" Text="Submit"
ForeColor="Blue" OnClick="Button2_Click" />
</td>
</tr>
</table>
<div>

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

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button2_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32(T1.Text), i, sum = 0,D;
D=2*n;
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
sum = sum + i;
}
}
if(sum==D)
{
lbldisplay.Text="This is a Perfect Number";
}
else
{
lbldisplay.Text="This is not a Perfect Number";
}

}
}

7. Write a Program to Find The Prime Numbers Between The Range

.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="prime betweeen range.aspx.cs"


Inherits="prime_betweeen_range" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 49%;
}
.auto-style8 {
height: 23px;
}
.auto-style9 {
width: 246px;
}
.auto-style10 {
height: 23px;
width: 246px;
}
.auto-style11 {
width: 246px;
height: 30px;
}
.auto-style12 {
height: 30px;
}
</style>
</head>
<body>
<form id="form3" runat="server">
<div>

</div>
<table class="auto-style1" style="background-color: #996633; height: 88px;">
<tr>
<td class="auto-style9">
<asp:Label ID="Label8" runat="server" Text="Enter Starting
Value"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style10">
<asp:Label ID="Label9" runat="server" Text="Enter Ending
Value"></asp:Label>
</td>
<td class="auto-style8">
<asp:TextBox ID="T2" runat="server" Height="22px"
Width="139px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style11">
&nbsp;</td>
<td class="auto-style12">
<asp:Button ID="Submit1" runat="server" Text="Submit"
ForeColor="#00CC00" OnClick="Submit_Click" />
</td>
</tr>
</table>
</form>
</body>
</html>

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Submit_Click(object sender, EventArgs e)
{
int i, j, n1=Convert.ToInt32(T1.Text), n2=Convert.ToInt32(T2.Text), cnt = 0;

for (i = 1; i < n2; i++)


{
for (j = 1; j < n2; j++)
{
if (i % j == 0)
cnt++;
}
if (cnt == 2)
{
Response.Write(i+" ");
}
cnt = 0;
}

}
}

8. Write a Program To Find the Given number is prime or not ?

.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Prime number.aspx.cs"


Inherits="Prime_number" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 55%;
height: 59px;
}
.auto-style3 {
width: 487px;
}
.auto-style4 {
width: 1055px;
}
.auto-style5 {
width: 1055px;
height: 26px;
}
.auto-style6 {
width: 487px;
height: 26px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="color: #FF00FF; font-style: italic; background-


color: #3333FF;">
<tr>
<td class="auto-style5">
<asp:Label ID="Label1" runat="server" Text="Enter Any
Number"></asp:Label>
</td>
<td class="auto-style6">
<asp:TextBox ID="T2" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style4">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td class="auto-style3" style="background-color: #0000FF">
<asp:Button ID="btnsubmit" runat="server" OnClick="btnsubmit_Click"
Text="Submit" ForeColor="Red" />
</td>
</tr>
</table>

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

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsubmit_Click(object sender, EventArgs e)
{
int i, n = Convert.ToInt32(T2.Text), count = 0;
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
count++;
}
}
if (count == 2)
{
lbldisplay.Text = "This is a prime number";
}
else
{
lbldisplay.Text = "This is not a prime number";
}

}
}

9.Write a Program to Sort the Given string in ascending order


.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="string ascendng order.aspx.cs"


Inherits="string_ascendng_order" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 52%;
height: 85px;
}
.auto-style2 {
width: 379px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<table align="center" class="auto-style1" style="background-color: #66FF99">
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter The
String"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td>
<asp:Button ID="btnsubmit" runat="server" ForeColor="#FF0066"
OnClick="btnsubmit_Click" Text="Submit" />
</td>
</tr>
</table>
</form>
</body>
</html>

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsubmit_Click(object sender, EventArgs e)
{
string s=T1.Text;
lbldisplay.Text=(stringtools.alphabet(s));
}
}
public static class stringtools
{
public static string alphabet(string s)
{
char[] a=s.ToCharArray();
Array.Sort(a);
return new string(a);
}
}

10. Write a Program To Find Given string is palindrome or not

.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="string palindrome.aspx.cs"


Inherits="string_palindrome" %>

<!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: 195px;
}
</style>
</head>
<body style="height: 91px; width: 446px">
<form id="form1" runat="server">
<table class="auto-style1" style="background-color: #990000">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter
string"></asp:Label>
</td>
<td>
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
<td>
<asp:Button ID="Submit" runat="server" OnClick="Submit_Click"
Text="Submit" ForeColor="#339933" />
</td>
</tr>
</table>
</form>
</body>
</html>

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Submit_Click(object sender, EventArgs e)
{
int i;string srev = ""; string s = T1.Text;

for (i=s.Length-1;i>=0;i--)
{
srev = srev + s[i];
}
if (srev==s)
{
lbldisplay.Text = "This is Palindome";
}
else
{
lbldisplay.Text = "This is not a palindrome";
}
}
}

11. Write a Program to find Reverse of the Given String


.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="string recerse.aspx.cs"


Inherits="string_recerse" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 65%;
}
.auto-style2 {
width: 261px;
}
.auto-style3 {
width: 261px;
height: 52px;
}
.auto-style4 {
height: 52px;
width: 312px;
}
.auto-style5 {
width: 312px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1" style="background-color: #000066">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter The String"
ForeColor="Yellow"></asp:Label>
</td>
<td class="auto-style5">
<asp:TextBox ID="T1" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style3">
<asp:Label ID="lbldisplay" runat="server"
ForeColor="Yellow"></asp:Label>
</td>
<td class="auto-style4">
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click"
Text="Submit" ForeColor="#660066" />
</td>
</tr>
</table>

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

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void Button1_Click(object sender, EventArgs e)
{
int i;string srev = ""; string s = T1.Text;
for (i = s.Length - 1; i >= 0; i--)
{
srev = srev+ s[i];
}
lbldisplay.Text = srev.ToString();
}
}

Login Task
Home Page :-
.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Home.aspx.cs" Inherits="Home" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Home Page"></asp:Label>

</div>
<div>

<asp:Label ID="Label1" runat="server" Font-Size="X-Large" ForeColor="#996633"


Text="Welcome To Home Page"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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:LinkButton ID="lbtnlogout" runat="server"
OnClick="lbtnlogout_Click">Logout</asp:LinkButton>

</div>
<div style="background-color: #000000;margin-top:310px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label13" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;<asp:Label ID="Label14" runat="server" ForeColor="White" Text="Copyrights
Belongs To Megafore Technologies"></asp:Label>

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

.cs code :-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void lbtnlogout_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
}

Login Page :-
.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Login.aspx.cs" Inherits="Login"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 65%;
height: 82px;
}
.auto-style2 {
width: 112px;
}
.auto-style3 {
width: 320px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
<asp:Label ID="Label3" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Login Here"></asp:Label>

</div>
<div>
<table align="center" class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter User
Name"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtusername" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtusername" EnableClientScript="False"
ErrorMessage="Please Enter Your User Name" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter
Passsword"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtpassword" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server" ControlToValidate="txtpassword" EnableClientScript="False"
ErrorMessage="Please Enter Your Password" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">&nbsp;</td>
<td class="auto-style3">
<asp:Button ID="btnlogin" runat="server" OnClick="btnlogin_Click"
Text="Login" />
<br />
<asp:CheckBox ID="CheckBox1" runat="server" Text="Remember Me" />
<br />
<asp:LinkButton ID="LinkButton1" runat="server"
OnClick="LinkButton1_Click">Register Here</asp:LinkButton>
</td>
</tr>
</table>

</div>
<div style="background-color: #000000;margin-top:225px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label12" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;
<asp:Label ID="Label13" runat="server" ForeColor="White" Text="Copy Rghts Belongs
To Megafore Technologies"></asp:Label>
</div>
</form>
</body>
</html>

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnlogin_Click(object sender, EventArgs e)
{
if(Page.IsValid==true)
Response.Redirect("Home.aspx");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
Response.Redirect("Registration.aspx");
}
}

Registration Page :-
.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Registration.aspx.cs"


Inherits="Registration" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 67%;
height: 187px;
}
.auto-style2 {
width: 335px;
}
.auto-style3 {
width: 505px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label10" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Register Here"></asp:Label>

</div>
<div>
<table align="center" class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter First
Nme"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtfirstname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1"
runat="server" ControlToValidate="txtfirstname" EnableClientScript="False"
ErrorMessage="Please Enter First Name" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Last
Name"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtlastname" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2"
runat="server" ControlToValidate="txtlastname" EnableClientScript="False"
ErrorMessage="Please Enter Last Name" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Enter
Password"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtpassword" runat="server"
TextMode="Password"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator3"
runat="server" ControlToValidate="txtpassword" EnableClientScript="False"
ErrorMessage="Please Enter Pasword" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Password</td>
<td class="auto-style3">
<asp:TextBox ID="txtreenterpassword" runat="server"
TextMode="Password"></asp:TextBox>
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txtpassword" ControlToValidate="txtreenterpassword"
EnableClientScript="False" ErrorMessage="Passwords Should Be Same"
ForeColor="Red"></asp:CompareValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Select
Gender"></asp:Label>
</td>
<td class="auto-style3">
<asp:RadioButton ID="rbtnmale" runat="server" GroupName="gender"
Text="Male" />
<asp:RadioButton ID="rbtnFemale" runat="server" GroupName="gender"
Text="Female" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Email
ID"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtemail" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4"
runat="server" ControlToValidate="txtemail" EnableClientScript="False"
ErrorMessage="Please Enter Email id" ForeColor="Red"></asp:RequiredFieldValidator>
&nbsp;&nbsp;
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server" ControlToValidate="txtemail" EnableClientScript="False"
ErrorMessage="Enter Correct Email ID" ForeColor="Red" ValidationExpression="\w+([-
+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Enter Phone
Number"></asp:Label>
</td>
<td class="auto-style3">
<asp:TextBox ID="txtphonenumber" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5"
runat="server" ControlToValidate="txtphonenumber" EnableClientScript="False"
ErrorMessage="Please Enter Password" ForeColor="Red"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label7" runat="server" Text="Select
Qualification"></asp:Label>
</td>
<td class="auto-style3">
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem Selected="True">B.Tech</asp:ListItem>
<asp:ListItem>M.Tech</asp:ListItem>
<asp:ListItem>MCA</asp:ListItem>
<asp:ListItem>MBA</asp:ListItem>
<asp:ListItem>BE</asp:ListItem>
<asp:ListItem>ME</asp:ListItem>
<asp:ListItem>BSC</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label8" runat="server" Text="Course"></asp:Label>
</td>
<td class="auto-style3">
<asp:CheckBox ID="chknet" runat="server" Text=".NET" />
<asp:CheckBox ID="chkjava" runat="server" Text="JAVA" />
&nbsp;
<br />
<asp:CheckBox ID="chkoracle" runat="server" Text="Oracle" />
<asp:CheckBox ID="chkandroid" runat="server" Text="Android" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label9" runat="server" Text="Select
Batches"></asp:Label>
</td>
<td class="auto-style3">
<asp:RadioButton ID="rbtnbatcha" runat="server" GroupName="tmings"
Text="Batch A" />
<asp:RadioButton ID="rbtnbatchb" runat="server" GroupName="tmings"
Text="Batch B" />
</td>
</tr>
<tr>
<td class="auto-style2">&nbsp;
<asp:Button ID="brnreset" runat="server" OnClick="brnreset_Click"
Text="Reset" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </td>
<td class="auto-style3">&nbsp;<asp:Button ID="btnsubmit0" runat="server"
OnClick="btnsubmit_Click" Text="Submit" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;
<asp:LinkButton ID="lbtnlogin" runat="server"
OnClick="lbtnlogin_Click">You Can Also Login Here</asp:LinkButton>
</td>
</tr>
</table>

</div>
<div style="background-color: #000000;margin-top:70px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label11" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label12" runat="server" ForeColor="White" Text="Copyrights Belongs
To Megafore Technologies"></asp:Label>
&nbsp;</div>
</form>
</body>
</html>

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsubmit_Click(object sender, EventArgs e)
{
if (Page.IsValid == true)
{
Response.Redirect("submit.aspx");
}
}
protected void lbtnlogin_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
protected void brnreset_Click(object sender, EventArgs e)
{
txtfirstname.Text = "";
txtlastname.Text="";
txtemail.Text="";
txtpassword.Text="";
txtphonenumber.Text = "";
txtreenterpassword.Text = "";
rbtnFemale.Checked = false;
rbtnmale.Checked = false;
chkandroid.Checked = false;
chkjava.Checked = false;
chknet.Checked = false;
chkoracle.Checked = false;
rbtnbatcha.Checked = false;
rbtnbatchb.Checked = false;

}
}

Submitted Page :-

.aspx code :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="submit.aspx.cs" Inherits="submit"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Acknowledgement"></asp:Label>

</div>
<div>

<asp:Label ID="Label1" runat="server" Font-Size="X-Large" ForeColor="#996633"


Text="You Are Successfully Registered"></asp:Label>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:LinkButton ID="lbtnlogin1" runat="server" OnClick="lbtnlogin1_Click">Click
Here To Goto Login Page</asp:LinkButton>

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

.cs code:-

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

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void lbtnlogin1_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
}

Task on Master Page :-


Abut us:-
.aspx code:-
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="About Us.aspx.cs" Inherits="About_Us" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<div id="u173-4" class="clearfix colelem" style="margin: 0px 0px 0px 1px; padding:
0px; border-width: 0px; transform-origin: left top 0px; display: inline; float: left;
clear: both; z-index: 55; width: 540px; min-height: 49px; color: rgb(51, 51, 51); font-
size: 36px; line-height: 43px; font-family: lato, sans-serif; font-weight: 300; position:
relative; font-style: normal; font-variant: normal; letter-spacing: normal; orphans:
auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255);">
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
About Megafore Technologies</p>
</div>
<div id="u178" class="colelem" style="margin: 5px 0px 0px 1px; padding: 0px; border-
width: 0px; transform-origin: left top 0px; display: inline; float: left; clear: both; z-
index: 80; width: 30px; height: 2px; position: relative; color: rgb(0, 0, 0); font-
family: Arial, 'Helvetica Neue', Helvetica, sans-serif; font-size: 14px; font-style:
normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height:
17px; orphans: auto; text-align: left; text-indent: 0px; text-transform: none; white-
space: normal; widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-
color: rgb(233, 29, 98);">
</div>
<div id="u177-15" class="clearfix colelem" style="margin: 32px 0px 0px 1px; padding: 0px;
border-width: 0px; transform-origin: left top 0px; display: inline; float: left; clear:
both; z-index: 65; width: 540px; min-height: 330px; color: rgb(96, 96, 96); font-size:
16px; line-height: 19px; font-family: lato, sans-serif; font-weight: 300; position:
relative; font-style: normal; font-variant: normal; letter-spacing: normal; orphans:
auto; text-align: left; text-indent: 0px; text-transform: none; white-space: normal;
widows: 1; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: rgb(255,
255, 255);">
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s; font-size: 25px; font-weight:
400;">
Corporate Overview</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Over the past six years,<span class="Apple-converted-space">&nbsp;</span><strong
style="font-style: inherit; font-weight: inherit;">Megafore Technologies Pvt.
Ltd.</strong><span class="Apple-converted-space">&nbsp;</span>has backed more than 500
companies, many of which have gone on to become leaders in their respective industries.
We&#39;re proud that many executives from past portfolio companies have chosen Megafore
Technologies as an Online and Technology support for their subsequent business.</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Megafore seeks to drive results with efficiency, embracing and seeking to
stimulate change, and continually acquire and share knowledge. Our programs in search,
social, and content marketing revolve around your business strategy. We execute with
honesty and integrity, seeking to get better every day.</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Over the past Decade we are Successful with our projects and the strategies what
we are been implementing. We had Successfully delivered different type of projects with
an innovative ways of development of Clients sites or web applications.</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s; font-size: 25px; font-weight:
400;">
Vision</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
To be one of the top companies based on quality,value and respect.</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s; font-size: 25px; font-weight:
400;">
Mission</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
To deliver good value to our customers, employees, share holders and society.</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s; font-size: 25px; font-weight:
400;">
Values</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
&nbsp;</p>
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Customer driven</p>
<br />
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
fast and flexible</p>
<br />
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Cost effective</p>
<br />
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Commitment</p>
<br />
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Integrity</p>
<br />
<p style="margin: 0px; padding: 0px; border-width: 0px; transform-origin: left top
0px; max-height: 1e+06px; transition: all 0.5s ease 0s;">
Ever growing</p>
</div>
<p>
<br />
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</asp:Content>

.cs code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

Contact Us:-

.aspx code:-
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="Contact Us.aspx.cs" Inherits="Contact_Us" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label5" runat="server" Font-Size="XX-Large" Text="Contact
Us"></asp:Label>
&nbsp;</p>
<p>
<asp:Label ID="Label4" runat="server" Text="Megafore Technologies"></asp:Label>
</p>
<p>
Plot No:50</p>
<p>
Opp: Madhapur Petrol Bunk</p>
<p>
4th-Floor ,V-square Building</p>
<p>
Madhapur,Hi-Techcity,Telangana,India</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
<p>
&nbsp;</p>
</asp:Content>

.cs code :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Image ID="Image1" runat="server" Height="292px"
ImageUrl="~/imags/B6QuwGqCcAAUC8j.jpg" Width="474px" />
&nbsp; &nbsp;</p>
</asp:Content>

.cs code :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
}

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<style type="text/css">
.auto-style1 {
width: 33%;
height: 78px;
}
.auto-style2 {
width: 168px;
}
</style>
<script>
function fadd()
{
if (document.getElementById('t1').value == '') {
document.getElementById('l1').innerHTML = "Hai";
return false;
}
else { return true;}
}

</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;
<asp:Label ID="Label4" runat="server" Font-Size="XX-Large" Text="Login"></asp:Label>
</p>
<form Id="f1">
<table align="center" class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter User name"></asp:Label>
</td>
<td>
<asp:TextBox ID="t1" runat="server" onblur="fadd()"></asp:TextBox>
<asp:Label ID="l1" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Enter Password"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtpassword" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsubmit" runat="server" Text="Submit"
OnClientClick="javascript:return fadd();" OnClick="btnsubmit_Click"/>
</td>
<td>
<asp:LinkButton ID="lbtnnewregster" runat="server"
OnClick="lbtnnewregster_Click">Register Here</asp:LinkButton>
</td>
</tr>

</table>
</form>
<p style="height: 10px; width: 1250px">
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</asp:Content>

.cs code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void lbtnnewregster_Click(object sender, EventArgs e)
{
Response.Redirect("New Registraton.aspx");
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
Response.Redirect("Home.aspx");
}
}

Master Page:-

.aspx code:-
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="MasterPage.master.cs"
Inherits="MasterPage" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="background-color: #000000">

<asp:ImageButton ID="ImageButton1" runat="server" Height="58px"


ImageUrl="~/imags/c1.png" OnClick="ImageButton1_Click" Width="73px" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="Label1" runat="server" Text="Megafore Technologies"
Font-Size="XX-Large" ForeColor="White"></asp:Label>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label4" runat="server" ForeColor="White" Text="An Iso 9001-
2008 Certified Company"></asp:Label>
<br />
<br />
<asp:Menu ID="Menu1" runat="server" Orientation="Horizontal" Width="250px"
ForeColor="White">
<Items>
<asp:MenuItem Text="Home" Value="Home"
NavigateUrl="~/Home.aspx"></asp:MenuItem>
<asp:MenuItem Text="About Us" Value="About Us" NavigateUrl="~/About
Us.aspx"></asp:MenuItem>
<asp:MenuItem Text="Contact Us" Value="Contact Us"
NavigateUrl="~/Contact Us.aspx"></asp:MenuItem>
<asp:MenuItem Text="Login" Value="Login"
NavigateUrl="~/Login.aspx"></asp:MenuItem>
</Items>
</asp:Menu>
<br />

</div>

<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

<p>
<br />
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</asp:ContentPlaceHolder>
</div>
<div style="background-color: #000000">

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;
<asp:Label ID="Label2" runat="server" Text="Developed By "
ForeColor="White"></asp:Label>
<asp:LinkButton ID="LinkButton1" runat="server" ForeColor="White">Megafore
Technologies</asp:LinkButton>
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;
<asp:Label ID="Label3" runat="server" Text="copyrights Reserved By Megafore
Technologies" ForeColor="White"></asp:Label>

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

.cs code:-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class MasterPage : System.Web.UI.MasterPage


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
Response.Redirect("home.aspx");
}
}

New Registration Page:_


.aspx code :-
<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="New Registraton.aspx.cs" Inherits="New_Registraton" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">


<style type="text/css">
.auto-style1 {
width: 34%;
height: 117px;
}
.auto-style2 {
width: 182px;
}
</style>
<script>
function fcheck1()
{
if (document.getElementById("txtfrstname").value == 0)
{
document.write("Welcome");
}
}
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&n
bsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;
<asp:Label ID="Label7" runat="server" Font-Size="XX-Large" Text="New
Registration"></asp:Label>
<br />
<table align="center" class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter First
NAme"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtfrstname" runat="server"
onblur="fcheck1()"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Second
NAme"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtsecondname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Select Gender"></asp:Label>
</td>
<td>
<asp:RadioButton ID="rbtnmale" runat="server" Text="Male"
GroupName="gender" />
<asp:RadioButton ID="rbtnfemale" runat="server" Text="Female"
GroupName="gender" />
</td>
</tr>
<tr>
<td class="auto-style2">&nbsp;</td>
<td>
<asp:Button ID="btnsubmit" runat="server" Text="Submit"
OnClick="btnsubmit_Click" style="height: 26px" />
</td>
</tr>
</table>
</p>
<p>
</p>
<p>
</p>
</asp:Content>

.cs code :-
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsubmit_Click(object sender, EventArgs e)
{
Response.Redirect("Login.aspx");
}
}
Task On Data Base :-
Connection oriented architecture 1st Method:-
Bus table:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Buses.aspx.cs"
Inherits="Table_Buses" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Bus
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Bus
Company"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Enter seat
capacity"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtseatcapacity" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Bus
Milage"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusmilage" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Bus
Type"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbustype" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="Insert" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Button ID="btnclear" runat="server" Text="Clear"
OnClick="btnclear_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

<div>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into buses values(" + txtbusid.Text + ",'" + txtbusname.Text +
"'," + txtseatcapacity.Text + "," + txtbusmilage.Text + ",'" + txtbustype.Text + "')";

cmd = new SqlCommand(s, con);

con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row(s) Effected";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
string s = "update buses set
bus_company='TATA',seat_capacity=50,bus_miilage=20,bus_type='AC' where bus_id=" +
txtbusid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete buses where bus_id=" +txtbusid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
txtbusid.Text = "";
txtbusmilage.Text = "";
txtbusname.Text = "";
txtbustype.Text = "";
txtseatcapacity.Text = "";
}
}

Table Company:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Company.aspx.cs"
Inherits="Table_Company" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Company
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Company
Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="EnterCompany
Type"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanytype" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Company Established
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyestd" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Company
Address"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyaddress" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="Insert" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Button ID="btnclear" runat="server" Text="Clear"
OnClick="btnclear_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into Company values(" + txtcompanyid.Text + ",'" +
txtcompanyname.Text + "','" + txtcompanytype.Text + "','" + txtcompanyestd.Text + "','" +
txtcompanyaddress.Text + "')";
//string s = "insert into company values(@pid,@pname,@ptype,@pestd,@paddress)";
cmd = new SqlCommand(s, con);
//cmd.Parameters.AddWithValue("@pid", txtcompanyid.Text);
//cmd.Parameters.AddWithValue("@pname", txtcompanyname.Text);
//cmd.Parameters.AddWithValue("@ptype", txtcompanytype.Text);
//cmd.Parameters.AddWithValue("@pestd", txtcompanyestd.Text);
//cmd.Parameters.AddWithValue("@paddress", txtcompanyaddress.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row(s) Effected";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
string s = "update company set
com_name='capgemini',com_type='services',com_estd=2006,com_address='hyd' where com_id=" +
txtcompanyid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s="delete company where com_id="+txtcompanyid.Text;
cmd = new SqlCommand(s,con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
txtcompanyid.Text = "";
txtcompanyname.Text = "";
txtcompanytype.Text = "";
txtcompanyestd.Text = "";
txtcompanyaddress.Text = "";
}
}

Table Employs :-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Employee.aspx.cs"
Inherits="Table_Employee" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Employee
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtempid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Employee
Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtename" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Enter Employee
Desgnation"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdesignation" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Employee join
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdoj" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Employee
salary"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtsalary" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Enter Employee department
no"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdeptno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="Insert" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Button ID="btnclear" runat="server" Text="Clear"
OnClick="btnclear_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

<div>

</div>

</body>
</html>

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into emp values(" + txtempid.Text + ",'" + txtename.Text +
"','" + txtdesignation.Text + "'," + txtdoj.Text + "," + txtsalary.Text + "," +
txtdeptno.Text + ")";

cmd = new SqlCommand(s, con);

con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row(s) Effected";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
string s = "update emp set
emp_name='arun',emp_designation='Developer',emp_doj=2006,emp_salary=1000,emp_deptno=6
where emp_id=" + txtempid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete emp where emp_id=" + txtempid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
txtempid.Text = "";
txtename.Text = "";
txtdesignation.Text = "";
txtdoj.Text = "";
txtsalary.Text = "";
txtdeptno.Text = "";

}
}

Table Manager:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Manager.aspx.cs"


Inherits="Table_Manager" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter manager
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Manager
Name'"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagername" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Manager join
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerdoj" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Manager
salary"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagersalary" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Manager
Deptno"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerdeptno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="Insert" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Button ID="btnclear" runat="server" Text="Clear"
OnClick="btnclear_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

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

.cs file:-

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;

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


{

SqlConnection con = new SqlConnection("server=.;user


id=sa;password=123456;database=employs");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into manager values(" + txtmanagerid.Text + ",'" +
txtmanagername.Text + "'," + txtmanagerdoj.Text + "," + txtmanagersalary.Text + "," +
txtmanagerdeptno.Text + ")";

cmd = new SqlCommand(s, con);

con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row(s) Effected";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
string s = "update manager set
manager_name='arun',manager_doj=2015,manager_salary=10000,manager_deptno=1 where
manager_id=" + txtmanagerid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete manager where manager_id=" + txtmanagerid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
txtmanagerid.Text = "";
txtmanagername.Text = "";
txtmanagerdoj.Text = "";
txtmanagersalary.Text = "";

}
}

Working With DATA READER :-


connection oriented architecture 2 nd method :-

Table Bus:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="buses.aspx.cs" Inherits="buses"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form1" runat="server">

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Bus
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusid" runat="server"></asp:TextBox>
<asp:Button ID="btnedit" runat="server" OnClick="btnedit_Click"
Text="Edit" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Bus
Company"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Enter seat
capacity"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtseatcapacity" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Bus
Milage"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbusmilage" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Bus
Type"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtbustype" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" OnClick="btninsert_Click"
Text="save" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

<div>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
SqlDataReader dr;

protected void btninsert_Click(object sender, EventArgs e)


{
string s = "update buses set
bus_company='TATA',seat_capacity=50,bus_miilage=20,bus_type='AC' where bus_id=" +
txtbusid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete buses where bus_id=" + txtbusid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btnedit_Click(object sender, EventArgs e)
{
string s = "select *from buses where bus_id=" + txtbusid.Text;
SqlCommand cmd = new SqlCommand(s, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.Read() == true)
{
lblResult.Text = "";
txtbusid.Text = dr[0].ToString();
txtbusname.Text = dr[1].ToString();
txtseatcapacity.Text = dr[2].ToString();
txtbusmilage.Text = dr[3].ToString();
txtbustype.Text = dr[4].ToString();
}
else
{
txtbusmilage.Text = "";
txtbusname.Text = "";
txtbustype.Text = "";
txtseatcapacity.Text = "";
lblResult.Text = "Records not found";
}
}
}

Table Company :-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="company.aspx.cs"


Inherits="company" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 182px;
}
.auto-style2 {
width: 226px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Company
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyid" runat="server"></asp:TextBox>
<asp:Button ID="btnedt" runat="server" Text="Button"
OnClick="btnedt_Click" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Company
Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="EnterCompany
Type"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanytype" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Company Established
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyestd" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Company
Address"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtcompanyaddress" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="save" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

</body>
</html>

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnedt_Click(object sender, EventArgs e)
{
string s = "select *from company where com_id=" + txtcompanyid.Text;
cmd = new SqlCommand(s, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.Read())
{
lblResult.Text = "";
txtcompanyid.Text = dr[0].ToString();
txtcompanyname.Text = dr[1].ToString();
txtcompanytype.Text = dr[2].ToString();
txtcompanyestd.Text = dr[3].ToString();
txtcompanyaddress.Text = dr[4].ToString();
}
else
{
txtcompanyaddress.Text = "";
txtcompanyestd.Text = "";
txtcompanyname.Text = "";
txtcompanytype.Text = "";
lblResult.Text = "Records no found";
}

}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "update company set
com_name='capgemini',com_type='services',com_estd=2006,com_address='hyd' where com_id=" +
txtcompanyid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete company where com_id=" + txtcompanyid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}

Table Employee :-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Employee.aspx.cs"


Inherits="Employee" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style2 {
width: 226px;
}

.auto-style1 {
width: 43%;
height: 182px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter Employee
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtempid" runat="server"></asp:TextBox>
<asp:Button ID="btnedt" runat="server" OnClick="btnedt_Click"
Text="Edit" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Employee
Name"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtename" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Enter Employee
Desgnation"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdesignation" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Employee join
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdoj" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Employee
salary"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtsalary" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label6" runat="server" Text="Enter Employee department
no"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtdeptno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" OnClick="btninsert_Click"
Text="save" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

<div>

</div>
</form>

</body>
</html>

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btninsert_Click(object sender, EventArgs e)
{

string s = "update emp set


emp_name='arun',emp_designation='Developer',emp_doj=2006,emp_salary=1000,emp_deptno=6
where emp_id=" + txtempid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete emp where emp_id=" + txtempid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
protected void btnedt_Click(object sender, EventArgs e)
{
string s = "select *from emp where emp_id=" + txtempid.Text;
cmd = new SqlCommand(s, con);
con.Open();
dr = cmd.ExecuteReader();
if(dr.Read()==true)
{
lblResult.Text = "";
txtempid.Text=dr[0].ToString();
txtename.Text=dr[1].ToString();
txtdesignation.Text=dr[2].ToString();
txtdoj.Text=dr[3].ToString();
txtsalary.Text=dr[4].ToString();
txtdeptno.Text=dr[5].ToString();
}
else
{
txtdesignation.Text = "";
txtdeptno.Text = "";
txtdoj.Text = "";

txtename.Text = "";
txtsalary.Text = "";
lblResult.Text="REcords not found";
}
}
}

Table manager:-
.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="manager.aspx.cs"


Inherits="manager" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style2 {
width: 226px;
}

.auto-style1 {
width: 43%;
height: 182px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">
<asp:Label ID="Label1" runat="server" Text="Enter manager
ID"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerid" runat="server"></asp:TextBox>
<asp:Button ID="btnedit" runat="server" OnClick="btnedit_Click"
Text="Edit" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label2" runat="server" Text="Enter Manager
Name'"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagername" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label3" runat="server" Text="Manager join
Date"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerdoj" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label4" runat="server" Text="Enter Manager
salary"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagersalary" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label ID="Label5" runat="server" Text="Enter Manager
Deptno"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmanagerdeptno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btninsert" runat="server" OnClick="btninsert_Click"
Text="Save" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>
</form>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
SqlDataReader dr;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnedit_Click(object sender, EventArgs e)
{
string s = "select *from manager where manager_id=" + txtmanagerid.Text;
cmd = new SqlCommand(s, con);
con.Open();
dr = cmd.ExecuteReader();
if (dr.Read())
{
lblResult.Text = "";
txtmanagerid.Text = dr[0].ToString();
txtmanagername.Text = dr[1].ToString();
txtmanagerdoj.Text = dr[2].ToString();
txtmanagersalary.Text = dr[3].ToString();
txtmanagerdeptno.Text = dr[4].ToString();
}
else
{
txtmanagerdeptno.Text = "";
txtmanagerdoj.Text = "";
txtmanagername.Text = "";
txtmanagersalary.Text = "";
lblResult.Text = "Records Not Found";
}
}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "update manager set
manager_name='arun',manager_doj=2015,manager_salary=10000,manager_deptno=1 where
manager_id=" + txtmanagerid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete company where manager_id=" + txtmanagerid.Text;
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}
Working With Strored Procedures:-
Customer table:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Customers.aspx.cs"


Inherits="Customers" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 157px;
}
.auto-style2 {
width: 267px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">Enter Customer Id</td>
<td>
<asp:TextBox ID="txtCid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer NAme</td>
<td>
<asp:TextBox ID="txtCname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer Phone number</td>
<td>
<asp:TextBox ID="txtCnumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer Address</td>
<td>
<asp:TextBox ID="txtCAddress" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsave_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand("Inscust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid", Convert.ToInt32(txtCid.Text));
cmd.Parameters.AddWithValue("@Cname", txtCname.Text);
cmd.Parameters.AddWithValue("@CphoneNumber", Convert.ToInt32(txtCnumber.Text));
cmd.Parameters.AddWithValue("@CAddrss", txtCAddress.Text);

int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Inserted";
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Updatecust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid", Convert.ToInt32(txtCid.Text));
cmd.Parameters.AddWithValue("@Cname", txtCname.Text);
cmd.Parameters.AddWithValue("@CphoneNumber", txtCnumber.Text);
cmd.Parameters.AddWithValue("@CAddrss", txtCAddress.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delcust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid",Convert.ToInt32( txtCid.Text));
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}

Table Products:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Products.aspx.cs"
Inherits="Products" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 198px;
width: 645px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td>Enter Product Id</td>
<td>
<asp:TextBox ID="txtproductid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Name</td>
<td>
<asp:TextBox ID="txtproductname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Quantity</td>
<td>
<asp:TextBox ID="txtquantity" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Unit Price</td>
<td>
<asp:TextBox ID="txtuniprice" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Status</td>
<td>
<asp:TextBox ID="txtstatus" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
style="height: 26px" Text="Save" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Label ID="lblDisplay" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insprod", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtproductname.Text);
cmd.Parameters.AddWithValue("@Quantity", Convert.ToInt32(txtquantity.Text));
cmd.Parameters.AddWithValue("@untprice", Convert.ToInt32(txtuniprice.Text));
cmd.Parameters.AddWithValue("@PStatus", txtstatus.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblDisplay.Text = i + "ROw (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("upadateprod", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtproductname.Text);
cmd.Parameters.AddWithValue("@Quantity", Convert.ToInt32(txtquantity.Text));
cmd.Parameters.AddWithValue("@untprice", Convert.ToInt32(txtuniprice.Text));
cmd.Parameters.AddWithValue("@PStatus", txtstatus.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblDisplay.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delprod", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblDisplay.Text = i + "Row (s) Deleted";
}
}

Table sales:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="sales.aspx.cs" Inherits="sales"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 45%;
height: 60px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td>Enter Bill Number</td>
<td>
<asp:TextBox ID="txtBillno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Id</td>
<td style="font-weight: 700">
<asp:TextBox ID="txtProductid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Name</td>
<td>
<asp:TextBox ID="txtProductname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Total Price</td>
<td>
<asp:TextBox ID="txtTotalprice" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click"
Text="Save" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnSave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("inssales", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Billno", Convert.ToInt32(txtBillno.Text));
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtProductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtProductname.Text);
cmd.Parameters.AddWithValue("@TotalPrice", txtTotalprice.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("updatesales", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Billno", Convert.ToInt32(txtBillno.Text));
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtProductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtProductname.Text);
cmd.Parameters.AddWithValue("@TotalPrice", txtTotalprice.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("delsales", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Billno", Convert.ToInt32(txtBillno.Text));
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}

Table stock:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="stock.aspx.cs" Inherits="stock"


%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 117px;
width: 461px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td>Enter Product Id</td>
<td>
<asp:TextBox ID="txtproductid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Name</td>
<td>
<asp:TextBox ID="txtproductname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Product Status</td>
<td>
<asp:TextBox ID="txtproductstatus" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" OnClick="btnupdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td>
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-

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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insstock", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtproductname.Text);
cmd.Parameters.AddWithValue("@Pstatus", txtproductstatus.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("updatestock", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
cmd.Parameters.AddWithValue("@Pname", txtproductname.Text);
cmd.Parameters.AddWithValue("@Pstatus", txtproductstatus.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("delstock", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Pid", Convert.ToInt32(txtproductid.Text));
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}

DATABASE TASKS :-
Student db:-
Table bus:-
Table school:-

Table student
Table teachers

Employee Data Base:-


Employee table
Department table

Working with insert, update ,delete queries


Bus table
Table company

Table employee
Table manager:-

Insert ,update,delete,select queries using


storedprocedures:-
Database departmental stores:-
Table customers:-
Table sales:-

Table products:-
Table stock :-

System Test date:- 10/10/2015

Table Employee:-
.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Employee.aspx.cs"


Inherits="Employee" %>

<!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: 207px;
}
</style>
<script>
function fempid()
{
if(form1.txtempid.value==0)
{
document.getElementById("lbl1").innerHTML="enter empid";

else
{
document.getElementById("lbl1").insertHTML="";
}
}
function fempname()
{
if (form1.txtempid.value == 0) {
document.getElementById("lbl2").innerHTML = "enter empname";

else {
document.getElementById("lbl2").insertHTML = "";
}
}

function fempemailaddress()
{
if (form1.txtempid.value == 0)
{
document.getElementById("lbl3").innerHTML = "enter empaddress";

else {
document.getElementById("lbl3").insertHTML = "";
}
}

function fempdeptid() {
if (form1.txtempid.value == 0) {
document.getElementById("lbl4").innerHTML = "enter empdeptid";

else {
document.getElementById("lbl4").insertHTML = "";
}
}

</script>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1">
<tr>
<td class="auto-style2">Enter emp id</td>
<td>
<asp:TextBox ID="txtempid" runat="server" onblur="fempid()">

</asp:TextBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;
</td>
</tr>
<tr>
<td class="auto-style2">Enter emp name</td>
<td>
<asp:TextBox ID="txtempname" runat="server" onblur="fempname()">

</asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter email address</td>
<td>
<asp:TextBox ID="txtempaddress" runat="server"
onblur="fempemailaddress()">

</asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter dept id</td>
<td>
<asp:TextBox ID="txtdeptid" runat="server" onblur="fempdeptid()">

</asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" Text="save"
OnClick="btnsave_Click" />
</td>
<td>
<asp:Label ID="lbldisplay" runat="server"></asp:Label>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
<tr>
<td class="auto-style2">
<br />
<asp:DropDownList ID="ddlemployee" runat="server" AutoPostBack="True"
OnSelectedIndexChanged="ddlemployee_SelectedIndexChanged">
</asp:DropDownList>
<br />
<br />
<br />
<br />
<asp:GridView ID="gdvemployeee" runat="server">
</asp:GridView>
</td>
<td>
&nbsp;</td>
</tr>
</table>

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

.cs code:-

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;

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


{
SqlConnection sqlcon = new SqlConnection("user
id=sa;password=123456;database=employee;server=.");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
SqlDataAdapter da;
DataSet ds1 = new DataSet();
da = new SqlDataAdapter("select * from department_table", sqlcon);
da.Fill(ds1);
ddlemployee.DataSource = ds1;
ddlemployee.DataTextField = "dept_name";
ddlemployee.DataValueField = "dept_id";
ddlemployee.Items.Insert(0, "select");
ddlemployee.DataBind();
}

protected void btnsave_Click(object sender, EventArgs e)


{
string s = "insert into employee_details values(" + txtempid.Text + ",'" +
txtempname.Text + "','" + txtempaddress.Text + "'," + txtdeptid.Text + ")";
cmd = new SqlCommand(s, sqlcon);
sqlcon.Open();
int i = cmd.ExecuteNonQuery();
sqlcon.Close();
lbldisplay.Text = i + "Rows are inserted";

}
protected void ddlemployee_SelectedIndexChanged(object sender, EventArgs e)
{

SqlDataAdapter da;
DataSet ds = new DataSet();
da = new SqlDataAdapter("select * from employee_details where emp_did=" +
ddlemployee.SelectedItem.Value,sqlcon);
da.Fill(ds);
gdvemployeee.DataSource = ds;
gdvemployeee.DataBind();

Output:-
Database Output:-
Table Department:-

.aspx code:-

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Department.aspx.cs"


Inherits="Department" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="auto-style1">
<tr>
<td>Enter Department Id</td>
<td>
<asp:TextBox ID="txtDepartmentno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter Department Name</td>
<td>
<asp:TextBox ID="txtDepartmentname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnSave" runat="server" OnClick="btnSave_Click"
Text="Save" />
</td>
<td>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
</table>
</div>
</form>
</body>
</html>

.cs code:-

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;

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


{

SqlConnection sqlcon = new SqlConnection("user


id=sa;password=123456;database=employee;server=.");

protected void Page_Load(object sender, EventArgs e)


{

}
protected void btnSave_Click(object sender, EventArgs e)
{
string s = "insert into department_table values(" + txtDepartmentno.Text + ",'" +
txtDepartmentname.Text + "')";
SqlCommand cmd;
cmd = new SqlCommand(s, sqlcon);
sqlcon.Open();
int i=cmd.ExecuteNonQuery();
sqlcon.Close(); ;
lblMessage.Text = i + "Row (s) Inserted";
}
}

Output:-
Database Out put :-

Countries,States,District Task

Date:- 13/10/2015

Country:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Counyries.aspx.cs"
Inherits="Counyries" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td>Enter Country Id</td>
<td>
<asp:TextBox ID="txtcountryid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Country Name</td>
<td>
<asp:TextBox ID="txtcountryname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-
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;

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


{
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsave_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Countries");
SqlCommand cmd;
string s = "insert into Country values(@pcid,@pcname)";
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@pcid", txtcountryid.Text);
cmd.Parameters.AddWithValue("@Pcname", txtcountryname.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text = i + "Row (s) inserted";
}
}

Output:-

Database Output:-

States:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="States.aspx.cs" Inherits="States"
%>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<br />
<br />
<br />
<table class="auto-style1">
<tr>
<td>Enter Country Name</td>
<td>
<asp:DropDownList ID="ddlCountries" runat="server">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Enter State Id</td>
<td>
<asp:TextBox ID="txtsateid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Enter State Name</td>
<td>
<asp:TextBox ID="txtstatename" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:- 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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Countries");
protected void Page_Load(object sender, EventArgs e)
{
SqlDataAdapter da;
DataSet ds;
ds = new DataSet();
if (IsPostBack == false)
{
da = new SqlDataAdapter("Select *from Country", con);
da.Fill(ds);
ddlCountries.DataTextField = "countryname";
ddlCountries.DataValueField = "Countryid";
ddlCountries.DataSource = ds;
ddlCountries.DataBind();
ddlCountries.Items.Insert(0, "select");
}
}
protected void btnsave_Click(object sender, EventArgs e)
{

SqlCommand cmd;
string s = "insert into States values(@psid,@psname,@pcid)";
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@psid", txtsateid.Text);
cmd.Parameters.AddWithValue("@psname", txtstatename.Text);
cmd.Parameters.AddWithValue("@pcid", ddlCountries.SelectedItem.Value);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text = i + "Row (s) inserted";

}
}

Output:-
Database output:-

Districts:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Districts.aspx.cs"
Inherits="Districts" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<br />
<table align="center" class="auto-style1">
<tr>
<td>State Name</td>
<td>
<asp:DropDownList ID="ddlstates" runat="server" Height="16px"
Width="124px">
</asp:DropDownList>
</td>
</tr>
<tr>
<td>Enter District Id</td>
<td>
<asp:TextBox ID="txtdistrictid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>Dstrict Name</td>
<td>
<asp:TextBox ID="txtdistrictname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Countries");
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
SqlDataAdapter da;
DataSet ds = new DataSet();
da = new SqlDataAdapter("select * from States", con);
da.Fill(ds);
ddlstates.DataSource = ds;
ddlstates.DataTextField = "Statename";
ddlstates.DataValueField = "Countryid";
ddlstates.DataBind();
}

}
protected void btnsave_Click(object sender, EventArgs e)
{

SqlCommand cmd;
string s = "insert into Dstricts values(@pdid,@pdname,@psid)";
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@pdid", txtdistrictid.Text);
cmd.Parameters.AddWithValue("@pdname", txtdistrictname.Text);
cmd.Parameters.AddWithValue("@psid", ddlstates.SelectedItem.Value);

con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text = i + "Row (s) Inserted";
}
}

output:-

Database output:-
Comlete form with dropdown lists:-

Working with stored procedures:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Customers.aspx.cs"
Inherits="Customers" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">

.auto-style1 {
width: 43%;
height: 157px;
}
.auto-style2 {
width: 267px;
}
</style>
</head>
<body>
<form id="form2" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">Enter Customer Id</td>
<td>
<asp:TextBox ID="txtCid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer NAme</td>
<td>
<asp:TextBox ID="txtCname" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer Phone number</td>
<td>
<asp:TextBox ID="txtCnumber" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Customer Address</td>
<td>
<asp:TextBox ID="txtCAddress" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Button ID="btnUpdate" runat="server" OnClick="btnUpdate_Click"
Text="Update" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btndelete" runat="server" OnClick="btndelete_Click"
Text="Delete" />
</td>
<td>
<asp:Label ID="lblResult" runat="server"></asp:Label>
</td>
</tr>
</table>

</div>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

}
protected void btnsave_Click(object sender, EventArgs e)
{
con.Open();
cmd = new SqlCommand("Inscust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid", Convert.ToInt32(txtCid.Text));
cmd.Parameters.AddWithValue("@Cname", txtCname.Text);
cmd.Parameters.AddWithValue("@CphoneNumber", Convert.ToInt32(txtCnumber.Text));
cmd.Parameters.AddWithValue("@CAddrss", txtCAddress.Text);

int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Inserted";
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Updatecust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid", Convert.ToInt32(txtCid.Text));
cmd.Parameters.AddWithValue("@Cname", txtCname.Text);
cmd.Parameters.AddWithValue("@CphoneNumber", txtCnumber.Text);
cmd.Parameters.AddWithValue("@CAddrss", txtCAddress.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delcust", con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Cid",Convert.ToInt32( txtCid.Text));
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblResult.Text = i + "Row (s) Deleted";
}
}

Stored procedure:-

Insert:-
USE [Departmental Stores]
GO
/****** Object: StoredProcedure [dbo].[Inscust] Script Date: 11/03/2015
14:15:47 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[Inscust]
@Cid int,@Cname varchar(50),@CphoneNumber bigint,@CAddrss varchar(50)
as
begin
insert into customer values(@Cid,@Cname ,@CphoneNumber,@CAddrss)
end
update:-
USE [Departmental Stores]
GO
/****** Object: StoredProcedure [dbo].[Updatecust] Script Date:
11/03/2015 14:16:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[Updatecust]
@Cid int,@Cname varchar(50),@CphoneNumber bigint,@CAddrss varchar(50)
as
begin
update customer set Cname=@Cname,Cphonenumber=@CphoneNumber,CAddress=@CAddrss
where Cid=@Cid
end

delete:-
USE [Departmental Stores]
GO
/****** Object: StoredProcedure [dbo].[Delcust] Script Date: 11/03/2015
14:17:40 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[Delcust]
@Cid int
as
begin
delete customer where Cid=@Cid
end

output for insert:-

Database output:-
Output for update:-

Database output:-

Output for delete:-


Database output:-

Working with databound controls:-

Repeater and gridview:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="cusomer.aspx.cs"
Inherits="Repeater" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td>
<table>
<asp:Repeater ID="rptrqueries" runat="server">
<HeaderTemplate>
<tr><th> Customer ID</th> <th> Phone Number</th> <th>Customer
Name</th><th> Address</th> </tr>
</HeaderTemplate>
<ItemTemplate>
<tr><td> <%#Eval("Cid") %></td>
<td> <%#Eval("Cname") %></td>
<td><%#Eval("Cphonenumber") %></td>
<td> <%#Eval("CAddress") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
<td>
<table>
<asp:Repeater ID="rptrstoredprocedure" runat="server">
<HeaderTemplate>
<tr> <tr><th> Customer ID</th><th>Customer Name</th> <th>
Phone Number</th> <th> Address</th> </tr></tr>
</HeaderTemplate>
<ItemTemplate>
<tr><td> <%#Eval("Cid") %></td>
<td> <%#Eval("Cname") %></td>
<td><%#Eval("Cphonenumber") %></td>
<td> <%#Eval("CAddress") %></td>
</tr>
</ItemTemplate>
</asp:Repeater>
</table>
</td>
</tr>
<tr>
<td>
<asp:GridView ID="gdvqueries" runat="server">
</asp:GridView>
</td>
<td>
<asp:GridView ID="gdvstoredprocedure" runat="server">
</asp:GridView>
</td>
</tr>
</table>

</div>
</form>
</body>
</html>
.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Departmental Stores");
SqlDataAdapter da ;
DataSet ds=new DataSet();

public void repeaterwithqueries()


{
SqlDataAdapter da = new SqlDataAdapter("select *from customer", con);
DataSet ds;
ds = new DataSet();
da.Fill(ds);
rptrqueries.DataSource = ds;
rptrqueries.DataBind();
}
public void repeaterwithstoredprocedure()
{
da = new SqlDataAdapter("selcustomer", con);
da.Fill(ds);
rptrstoredprocedure.DataSource = ds;
rptrstoredprocedure.DataBind();
}
public void gridviewwithqueries()
{
da = new SqlDataAdapter("select *from customer", con);

gdvqueries.DataSource = ds;
gdvqueries.DataBind();
}
public void gridviewwithsroredprocedure()
{
da = new SqlDataAdapter("selcustomer", con);

gdvstoredprocedure.DataSource = ds;
gdvstoredprocedure.DataBind();
}
protected void Page_Load(object sender, EventArgs e)
{
repeaterwithqueries();
repeaterwithstoredprocedure();
gridviewwithqueries();
gridviewwithsroredprocedure();
}
}

Out put:-
Task on Gridview with checkbox:-

Date:-20/10/2015

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridaspx.aspx.cs"
Inherits="Gridaspx" %>

<!DOCTYPE html>

<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">

<Columns>
<asp:TemplateField HeaderText="Empid">
<ItemTemplate>

<asp:Label ID="lblempid" runat="server" Text='<%#Eval("empid")


%>' ></asp:Label>
</ItemTemplate>
</asp:TemplateField>

<asp:BoundField HeaderText="Ename" DataField="ename" />


<asp:BoundField HeaderText="Designation" DataField="designation" />
<asp:BoundField HeaderText="Join Date" DataField="doj" />
<asp:BoundField HeaderText="Salary" DataField="salary" />
<asp:BoundField HeaderText="Deptno" DataField="deptno" />
<asp:BoundField HeaderText="status" DataField="status" />
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkone" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
</Columns>

</asp:GridView>

<br />
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="btnactive" runat="server" Text="Active" OnClick="btnactive_Click"
/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;
<asp:Button ID="Btninactive" runat="server" Text="InActive"
OnClick="Btninactive_Click" />

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=Task");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
getdata();
}
}
public void getdata()
{
SqlDataAdapter da = new SqlDataAdapter("select *from emp1", con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected void btnactive_Click(object sender, EventArgs e)


{
con.Open();
foreach (GridViewRow x in GridView1.Rows)
{
CheckBox c1 = (CheckBox)x.FindControl("chkone");
if (c1.Checked)
{
Label l1 = (Label)x.FindControl("lblempid");
string s = "update emp1 set status=3 where empid=@p1 ";
SqlCommand cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@p1", l1.Text);
cmd.ExecuteNonQuery();
}
}
con.Close();
getdata();
}
protected void Btninactive_Click(object sender, EventArgs e)
{
con.Open();
foreach (GridViewRow x in GridView1.Rows)
{
CheckBox c1 = (CheckBox)x.FindControl("chkone");
if (c1.Checked)
{
Label l1 = (Label)x.FindControl("lblempid");
string s = "update emp1 set status=1 where empid=@p1 ";
SqlCommand cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@p1", l1.Text);
cmd.ExecuteNonQuery();
}
}
con.Close();
getdata();
}
}

Output:-
Task on gridview to find student Percentage:-
Date:-26/10/2015

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>

<!DOCTYPE html>

<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">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%#Eval("ID")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Name" DataField="Name" />
<asp:BoundField HeaderText="DOB" DataField="DOB" />
<asp:BoundField HeaderText="Class" DataField="Class" />
<%--<asp:TemplateField HeaderText="Unit Type">
<ItemTemplate>
<asp:Label ID="lblunittype" runat="server"
Text='<%#Eval("unit_type") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Telugu">
<ItemTemplate>
<asp:Label ID="lbltelugu" runat="server" Text='<%#Eval("Telugu")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="English">
<ItemTemplate>
<asp:Label ID="lblenglish" runat="server"
Text='<%#Eval("English") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Maths">
<ItemTemplate>
<asp:Label ID="lblmaths" runat="server" Text='<%#Eval("Maths")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Science">
<ItemTemplate>
<asp:Label ID="lblscience" runat="server"
Text='<%#Eval("science") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Social">
<ItemTemplate>
<asp:Label ID="lblsocial" runat="server" Text='<%#Eval("social")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Hindi">
<ItemTemplate>
<asp:Label ID="lblhindi" runat="server" Text='<%#Eval("Hindi")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="Total Marks">
<ItemTemplate>
<asp:Label ID="lbltotalmarks" runat="server"
Text='<%#Eval("Total_Marks") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UnitI">
<ItemTemplate>
<asp:Label ID="lblunit1" runat="server" Text=""></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Grade">
<ItemTemplate>
<asp:Label ID="lblgrade" runat="server" Text=""></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="UnitII">
<ItemTemplate>
<asp:Label ID="lblunit2" runat="server" Text=""></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Grade">
<ItemTemplate>
<asp:Label ID="lblgrade1" runat="server" Text=""></asp:Label>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=SampleTasks");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
get();
calculate();
calculate1();
}
}
public void get()
{
SqlDataAdapter da = new SqlDataAdapter("select s.ID,
s.Name,s.DOB,s.Class,m.unit_type,m.Telugu,m.English,m.Maths,m.science,m.social,m.Hindi,m.
Total_Marks from StudentMaster s,StudentMarks m where s.ID=m.ID", con);
DataSet ds = new DataSet();
da.Fill(ds, "x");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
}
public void calculate()
{
foreach (GridViewRow x in GridView1.Rows)
{
Label l1 = (Label)x.FindControl("lblid");
Label l10 = (Label)x.FindControl("lblunit1");
Label l11 = (Label)x.FindControl("lblgrade");
Label ltotal = (Label)x.FindControl("lbltotalmarks");
string s = "select Total_Marks from StudentMarks where ID=101";
SqlDataAdapter da = new SqlDataAdapter(s,con);
DataSet ds = new DataSet();
da.Fill(ds);

//l10.Text = ds.Tables[0].Columns[0].ToString();
//l10.Text = "460";
//l11.Text = "b";

int p = (Convert.ToInt32(ltotal.Text) / 6);


if (p < 40)
{
l10.Text=ltotal.Text+"/600";
l11.Text="F";
}
else if (p > 40 && p < 50)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "C";
}
else if (p > 51 && p < 60)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "B";
}
else if (p > 61 && p < 70)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "B+";
}
else if (p> 71 &&p < 80)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A-";
}
else if (p > 81 &&p < 90)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A";
}
else
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A+";
}

}
}
public void calculate1()
{
foreach(GridViewRow x in GridView1.Rows)
{
Label l1 = (Label)x.FindControl("lblid");
Label l10 = (Label)x.FindControl("lblunit2");
Label l11 = (Label)x.FindControl("lblgrade1");
Label ltotal = (Label)x.FindControl("lbltotalmarks");
string s = "select Total_Marks from StudentMarks where ID=101";
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();
da.Fill(ds);
int p = (Convert.ToInt32(ltotal.Text) / 6);
if (p < 40)
{
l10.Text=ltotal.Text+"/600";
l11.Text="F";
}
else if (p > 40 && p < 50)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "C";
}
else if (p > 51 && p < 60)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "B";
}
else if (p > 61 && p < 70)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "B+";
}
else if (p> 71 &&p < 80)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A-";
}
else if (p > 81 &&p < 90)
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A";
}
else
{
l10.Text = ltotal.Text + "/600";
l11.Text = "A+";
}

}
}

Output:-

Task on Gridview with up and down links:-


Date:-28/10/2015

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridview move.aspx.cs"
Inherits="Gridview_move" %>

<!DOCTYPE html>

<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"


OnRowCommand="GridView1_RowCommand" DataKeyNames="Phone">
<Columns>
<asp:BoundField HeaderText="ID" DataField="ID" />
<asp:BoundField HeaderText="Name" DataField="Name" />

<asp:BoundField HeaderText="Address" DataField="Address" />


<asp:BoundField HeaderText="City" DataField="city" />
<asp:BoundField HeaderText="State" DataField="State" />
<%--<asp:BoundField HeaderText="ID" DataField="ID" />--%>
<asp:BoundField HeaderText="Phone Number" DataField="Phonenumber" />
<%--<asp:BoundField HeaderText="Phone" DataField="Phone" />--%>
<asp:TemplateField HeaderText="Move">
<ItemTemplate>

<asp:LinkButton ID="lbtnup" runat="server" Text="Up"


CommandName="up" CommandArgument="<%#((GridViewRow)Container).RowIndex
%>"></asp:LinkButton>
<asp:LinkButton ID="lbtndown" runat="server" Text="Down"
CommandName="down" CommandArgument="<%#((GridViewRow)Container).RowIndex
%>"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=SampleTasks");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
//if(!IsPostBack)
//{
// get();
//}
get();
}
public void get()
{
SqlDataAdapter da;
da = new SqlDataAdapter("select * from customers3 order by Phone asc", con);
DataSet ds = new DataSet();
da.Fill(ds,"x");
GridView1.DataSource = ds.Tables[0];
GridView1.DataBind();
GridViewRow firstrow = GridView1.Rows[0];
LinkButton l1 = (LinkButton)firstrow.FindControl("lbtnup");
l1.Visible = false;
GridViewRow lastrow = GridView1.Rows[GridView1.Rows.Count - 1];
LinkButton l2 = (LinkButton)lastrow.FindControl("lbtndown");
l2.Visible = false;
}
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
int i = 0;
GridViewRow r1;
GridViewRow r2;
if (e.CommandName == "up")
{
i = Convert.ToInt32(e.CommandArgument);
r1 = GridView1.Rows[i];
r2 = GridView1.Rows[i - 1];
int phonenumber =
Convert.ToInt32(GridView1.DataKeys[r1.RowIndex].Value.ToString());
//int phonenumber =
Convert.ToInt32(GridView1.DataKeys[r1.RowIndex].Values["Phone"].ToString());
int value1 = Convert.ToInt32(r1.Cells[0].Text);
int value2 = Convert.ToInt32(r2.Cells[0].Text);
string s = "update customers3 set Phone=@p1 where Id=@p2;update customers3
set Phone=@p3 where Id=@p4 ";
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@p1",phonenumber-1);
cmd.Parameters.AddWithValue("@p2",value1);
cmd.Parameters.AddWithValue("@p3",phonenumber);
cmd.Parameters.AddWithValue("@p4",value2);

con.Open();
cmd.ExecuteNonQuery();
con.Close();

}
if (e.CommandName == "down")
{
i = Convert.ToInt32(e.CommandArgument);
r1 = GridView1.Rows[i];
r2 = GridView1.Rows[i + 1];
int phonenumber =
Convert.ToInt32(GridView1.DataKeys[r1.RowIndex].Value.ToString());
//int phonenumber =
Convert.ToInt32(GridView1.DataKeys[r1.RowIndex].Values["Phone"].ToString());
int value1 = Convert.ToInt32(r1.Cells[0].Text);
int value2 = Convert.ToInt32(r2.Cells[0].Text);
string s = "update customers3 set Phone=@p1 where Id=@p2;update customers3
set Phone=@p3 where Id=@p4 ";
cmd = new SqlCommand(s, con);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@p1", phonenumber + 1);
cmd.Parameters.AddWithValue("@p2", value1);
cmd.Parameters.AddWithValue("@p3", phonenumber);
cmd.Parameters.AddWithValue("@p4", value2);

con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
get();
}
}

Ouput:-

Gridview with Dropdownlist:-


29/10/2015
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridview Dropdown.aspx.cs"
Inherits="Gridview_Dropdown" %>

<!DOCTYPE html>

<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">


<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%#Eval("Id")
%>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--<asp:BoundField HeaderText="ID" DataField="ID" />--%>
<asp:BoundField HeaderText="Name" DataField="Name" />
<%--<asp:BoundField HeaderText="Address" DataField="Address" />--%>
<asp:BoundField HeaderText="PhoneNumber" DataField="PhoneNumber" />
<asp:TemplateField HeaderText="Status">
<HeaderTemplate>
Status
<asp:DropDownList ID="ddlemployee" runat="server"
OnSelectedIndexChanged="select"
AutoPostBack="true"><asp:ListItem>select</asp:ListItem></asp:DropDownList>

</HeaderTemplate>
<ItemTemplate>
<asp:DropDownList ID="ddlstatus" runat="server"
><asp:ListItem>Select</asp:ListItem></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Save" />

&nbsp;&nbsp;&nbsp;
<asp:Label ID="lblMessage" runat="server"></asp:Label>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=SampleTasks");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{

if (!IsPostBack)
{
get();
add();
}

}
public void get()
{
SqlDataAdapter da = new SqlDataAdapter("select * from customers",con);
DataTable ds = new DataTable();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();

}
public void add()
{
GridViewRow r = GridView1.HeaderRow;
DropDownList d=(DropDownList)r.FindControl("ddlemployee");
d.Items.Insert(0, "select");
d.Items.Insert(1,"Activate");
d.Items.Insert(2, "DeActivate");
d.Items.Insert(3, "Prospect");

//s = d.SelectedItem.ToString();
//foreach (GridViewRow x in GridView1.Rows)
//{

// DropDownList d3 = (DropDownList)x.FindControl("ddlstatus");
// d3.Items.Add("select");
//}

}
public void select(object sender, EventArgs e)
{

GridViewRow r = GridView1.HeaderRow;
DropDownList d = (DropDownList)r.FindControl("ddlemployee");
string s = d.SelectedItem.ToString(); ;
foreach (GridViewRow x in GridView1.Rows)
{

DropDownList d2 = (DropDownList)x.FindControl("ddlstatus");
d2.Items.Clear();
d2.Items.Add(s);

}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow x in GridView1.Rows)
{
DropDownList d = (DropDownList)x.FindControl("ddlstatus");
Label l=(Label)x.FindControl("lblid");
//string s="update customers set status=@p1 where Id=@p2";
//cmd=new SqlCommand(s,con);
//cmd.CommandType = CommandType.Text;
//cmd.Parameters.AddWithValue("@p1",d.Text);
//cmd.Parameters.AddWithValue("@p2",l.Text);
//con.Open();
//cmd.ExecuteNonQuery();
//con.Close();
//lblMessage.Text = "Status Updated Successfully";
string s;
if (d.Text == "Activate")
{
s = "update customers set status='1' where Id=" + l.Text;
}
else if (d.Text == "DeActivate")
{
s = "update customers set status='2' where Id=" + l.Text;
}
else
{
s = "update customers set status='3' where Id=" + l.Text;
}
cmd=new SqlCommand(s,con);
cmd.CommandType=CommandType.Text;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text="Database Updated Successfully";
}

}
}

Output:-
Task on Gridviw with Redirection of Selectd row:-
03/11/2015
Target page:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Save.aspx.cs" Inherits="Save" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 201px;
width: 553px;
}
.auto-style2 {
width: 265px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table align="center" class="auto-style1">


<tr>
<td class="auto-style2">Enter Employee ID</td>
<td>
<asp:TextBox ID="txtempid" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Employee Name</td>
<td>
<asp:TextBox ID="txtename" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Employee Designation</td>
<td>
<asp:TextBox ID="txtdesignation" runat="server" ></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Employee Date of Join</td>
<td>
<asp:TextBox ID="txtdoj" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Employee Salary</td>
<td>
<asp:TextBox ID="txtsalary" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">Enter Employee Deptno</td>
<td>
<asp:TextBox ID="txtdeptno" runat="server"></asp:TextBox>
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btnsave" runat="server" OnClick="btnsave_Click"
Text="Save" />
</td>
<td>
<asp:Button ID="btnupdate" runat="server" Text="Update"
OnClick="btnupdate_Click" />
</td>
</tr>
<tr>
<td class="auto-style2">
<asp:Button ID="btncancel" runat="server" Text="Cancel"
OnClick="btncancel_Click" />
</td>
<td>
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</td>
</tr>
</table>

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

.cs code:-
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;

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


{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
SqlCommand cmd;
protected void Page_Load(object sender, EventArgs e)
{
//txtdeptno.Text = Request.QueryString[0];
get();

}
protected void btnsave_Click(object sender, EventArgs e)
{
string s="insert into emp values(@p1,@p2,@p3,@p4,@p5,@p5)";
cmd = new SqlCommand(s, con);
cmd.Parameters.AddWithValue("@p1",txtempid.Text);
cmd.Parameters.AddWithValue("@p2",txtename.Text);
cmd.Parameters.AddWithValue("@p3",txtdesignation.Text);
cmd.Parameters.AddWithValue("@p4",txtdoj.Text);
cmd.Parameters.AddWithValue("@p5",txtsalary.Text);
cmd.Parameters.AddWithValue("@p6",txtdeptno.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{

string s = "update emp set


emp_name=@p2,emp_designation=@p3,emp_doj=@p4,emp_salary=@p5,emp_deptno=@p6 where
emp_id=@p1";
cmd = new SqlCommand(s, con);
cmd.Parameters.AddWithValue("@p1", txtempid.Text);
cmd.Parameters.AddWithValue("@p2", txtename.Text);
cmd.Parameters.AddWithValue("@p3", txtdesignation.Text);
cmd.Parameters.AddWithValue("@p4", txtdoj.Text);
cmd.Parameters.AddWithValue("@p5", txtsalary.Text);
cmd.Parameters.AddWithValue("@p6", txtdeptno.Text);
con.Open();
int i = cmd.ExecuteNonQuery();
con.Close();
lblMessage.Text = i + "Row (s) Updated";
}
protected void btncancel_Click(object sender, EventArgs e)
{
}
public void get()
{

txtempid.Text = Request.QueryString["id"];
txtename.Text = Request.QueryString["name"];
txtdesignation.Text = Request.QueryString["designation"];
txtdoj.Text = Request.QueryString["doj"];
txtsalary.Text = Request.QueryString["salary"];
txtdeptno.Text = Request.QueryString["deptno"];
}
}

Output:-

Source Page:-

.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridview.aspx.cs"
Inherits="Gridview" %>

<!DOCTYPE html>

<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"


OnRowCommand="GridView1_RowCommand" DataKeyNames="emp_id">
<Columns>
<asp:TemplateField HeaderText="ID">
<ItemTemplate>
<asp:Label ID="lblid" runat="server" Text='<%#Eval("emp_id") %>'
/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Name">
<ItemTemplate>
<asp:Label ID="lblname" runat="server" Text='<%#Eval("emp_name")
%>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Designation">
<ItemTemplate>
<asp:Label ID="lbldesignation" runat="server"
Text='<%#Eval("emp_designation") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Doj">
<ItemTemplate>
<asp:Label ID="lbldoj" runat="server" Text='<%#Eval("emp_doj")
%>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Salary">
<ItemTemplate>
<asp:Label ID="lblsalary" runat="server"
Text='<%#Eval("emp_salary") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Deptno">
<ItemTemplate>
<asp:Label ID="lbldeptno" runat="server"
Text='<%#Eval("emp_deptno") %>'/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:Button ID="btnedit" runat="server" Text="Edit"
CommandName="rowedit" CommandArgument='<%#((GridViewRow)Container).RowIndex %>'/>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>

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

.cs code:-
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;
public partial class Gridview : System.Web.UI.Page
{
SqlConnection con = new SqlConnection("server=.;user
id=sa;password=123456;database=employs");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
get();
}
}
public void get()
{
SqlDataAdapter da = new SqlDataAdapter("select * from emp",con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)


{
if (e.CommandName == "rowedit")
{
int rowindex = Convert.ToInt32(e.CommandArgument);
GridViewRow rows = GridView1.Rows[rowindex];
Label l1 = (Label)rows.FindControl("lblid");
Label l2 = (Label)rows.FindControl("lblname");
Label l3 = (Label)rows.FindControl("lbldesignation");
Label l4 = (Label)rows.FindControl("lbldoj");
Label l5 = (Label)rows.FindControl("lblsalary");
Label l6 = (Label)rows.FindControl("lbldeptno");
Response.Redirect("save.aspx?id=" + l1.Text + "&name=" + l2.Text +
"&designation=" + l3.Text + "&doj=" + l4.Text + "&salary=" + l5.Text + "&deptno=" +
l6.Text);
}
}
}

Output:-
After Redirection:-

You might also like