C# Arithmetic and Number Programs
C# Arithmetic and Number Programs
NET Tasks :-
Date:- 22/09/2015
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
 
; &nbs
p;
<asp:Label ID="lbldisplay" runat="server"></asp:Label>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.Cs Code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Button1_Click(object sender, EventArgs e)
{
[Link] ="Adition is" +( Convert.ToInt32([Link]) +
Convert.ToInt32([Link])).ToString();
}
protected void Button3_Click(object sender, EventArgs e)
{
[Link] = "Sutraction is "+(Convert.ToInt32([Link]) -
Convert.ToInt32([Link])).ToString();
}
protected void Button2_Click(object sender, EventArgs e)
{
[Link] = "Multiplication is "+(Convert.ToInt32([Link]) *
Convert.ToInt32([Link])).ToString();
}
protected void Button4_Click(object sender, EventArgs e)
{
[Link] ="Division is"+ (Convert.ToInt32([Link]) /
Convert.ToInt32([Link])).ToString();
}
}
.aspx Code
<!DOCTYPE html>
<html xmlns="[Link]
<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>
.cs code
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Button2_Click(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32([Link]), sum = 0, r, m;
m = n;
while (n > 0)
{
r = n % 10;
sum = sum + (r * r * r);
n = n / 10;
}
if (sum == m)
{
[Link] = "This is Armstrong Number";
}
else
{
[Link] = "This is Not Armstrong";
}
}
}
.aspx code
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
int i, n = Convert.ToInt32([Link]);
long f = 1;
for (i = 1; i <= n; i++)
{
f = f * i;
}
[Link] = "factorial is" + [Link]();
}
}
.aspx code
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Button1_Click(object sender, EventArgs e)
{
series();
}
int n, f1 = 0, f2 = 1, f3 = 0;
public void series()
{
[Link]("Enter Any Limit");
n = Convert.ToInt32([Link]);
[Link](f1+" ");
while(f3<n)
{
f3 = f1 + f2;
[Link](f3 + ",");
f1 = f2;
f2 = f3;
}
}
}
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 67%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code :-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Submit_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32([Link]), rev=0, r,m;
m = n;
while (n > 0)
{
r = n % 10;
rev = (rev * 10) + r;
n = n / 10;
}
if (rev == m)
{
[Link] = "This is a palindrome Number";
}
else
{
[Link] = "This is not a palinddrome";
}
}
}
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Button2_Click(object sender, EventArgs e)
{
int n = Convert.ToInt32([Link]), i, sum = 0,D;
D=2*n;
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
sum = sum + i;
}
}
if(sum==D)
{
[Link]="This is a Perfect Number";
}
else
{
[Link]="This is not a Perfect Number";
}
}
}
.aspx code :-
<!DOCTYPE html>
<html xmlns="[Link]
<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">
</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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Submit_Click(object sender, EventArgs e)
{
int i, j, n1=Convert.ToInt32([Link]), n2=Convert.ToInt32([Link]), cnt = 0;
}
}
.aspx code :-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code :-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
int i, n = Convert.ToInt32([Link]), count = 0;
for (i = 1; i <= n; i++)
{
if (n % i == 0)
{
count++;
}
}
if (count == 2)
{
[Link] = "This is a prime number";
}
else
{
[Link] = "This is not a prime number";
}
}
}
<!DOCTYPE html>
<html xmlns="[Link]
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
string s=[Link];
[Link]=([Link](s));
}
}
public static class stringtools
{
public static string alphabet(string s)
{
char[] a=[Link]();
[Link](a);
return new string(a);
}
}
.aspx code :-
<!DOCTYPE html>
<html xmlns="[Link]
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Submit_Click(object sender, EventArgs e)
{
int i;string srev = ""; string s = [Link];
for (i=[Link]-1;i>=0;i--)
{
srev = srev + s[i];
}
if (srev==s)
{
[Link] = "This is Palindome";
}
else
{
[Link] = "This is not a palindrome";
}
}
}
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void Button1_Click(object sender, EventArgs e)
{
int i;string srev = ""; string s = [Link];
for (i = [Link] - 1; i >= 0; i--)
{
srev = srev+ s[i];
}
[Link] = [Link]();
}
}
Login Task
Home Page :-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Home Page"></asp:Label>
</div>
<div>
</div>
<div style="background-color: #000000;margin-top:310px">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label13" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />
 
; &nbs
p; &nb
sp; &n
bsp; &
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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void lbtnlogout_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
}
Login Page :-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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">
 
; &nbs
p; &nb
sp; &n
bsp; &
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"> </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">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
 
;
<asp:Label ID="Label12" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />
 
; &nbs
p; &nb
sp; &n
bsp; &
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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnlogin_Click(object sender, EventArgs e)
{
if([Link]==true)
[Link]("[Link]");
}
protected void LinkButton1_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
}
Registration Page :-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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">
 
; &nbs
p; &nb
sp; &n
bsp; &
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>
<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">[Link]</asp:ListItem>
<asp:ListItem>[Link]</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" />
<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">
<asp:Button ID="brnreset" runat="server" OnClick="brnreset_Click"
Text="Reset" />
 
; </td>
<td class="auto-style3"> <asp:Button ID="btnsubmit0" runat="server"
OnClick="btnsubmit_Click" Text="Submit" />
 
; &nbs
p;
<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">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label11" runat="server" ForeColor="White" Text="Developed By
Megafore Tech , Hyd"></asp:Label>
<br />
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
<asp:Label ID="Label12" runat="server" ForeColor="White" Text="Copyrights Belongs
To Megafore Technologies"></asp:Label>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
if ([Link] == true)
{
[Link]("[Link]");
}
}
protected void lbtnlogin_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
protected void brnreset_Click(object sender, EventArgs e)
{
[Link] = "";
[Link]="";
[Link]="";
[Link]="";
[Link] = "";
[Link] = "";
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
[Link] = false;
}
}
Submitted Page :-
.aspx code :-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div style="background-color: #000000;margin-bottom:100px">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
 
;
<asp:Label ID="Label2" runat="server" Font-Size="XX-Large" ForeColor="White"
Text="Acknowledgement"></asp:Label>
</div>
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void lbtnlogin1_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
}
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
}
Contact Us:-
.aspx code:-
<%@ Page Title="" Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeFile="Contact [Link]" Inherits="Contact_Us" %>
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
 
; &nbs
p; &nb
sp;
<asp:Label ID="Label5" runat="server" Font-Size="XX-Large" Text="Contact
Us"></asp:Label>
</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>
</p>
<p>
</p>
<p>
</p>
<p>
</p>
</asp:Content>
.cs code :-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
}
Home Page :-
.aspx code:-
<%@ Page Title="" Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeFile="[Link]" Inherits="Home" %>
 
; &nbs
p; &nb
sp; &n
bsp;
<asp:Image ID="Image1" runat="server" Height="292px"
ImageUrl="~/imags/[Link]" Width="474px" />
</p>
</asp:Content>
.cs code :-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
}
Login Page:-
.aspx code:-
<%@ Page Title="" Language="C#" MasterPageFile="~/[Link]"
AutoEventWireup="true" CodeFile="[Link]" Inherits="Login" %>
</script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<p>
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
<br />
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp;
 
; &nbs
p; &nb
sp;
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void lbtnnewregster_Click(object sender, EventArgs e)
{
[Link]("New [Link]");
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
}
Master Page:-
.aspx code:-
<%@ Master Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="MasterPage" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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">
 
; &nbs
p; &nb
sp; &n
bsp; &
nbsp; <asp:Label ID="Label1" runat="server" Text="Megafore Technologies"
Font-Size="XX-Large" ForeColor="White"></asp:Label>
<br />
 
; &nbs
p; &nb
sp; &n
bsp; &
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="~/[Link]"></asp:MenuItem>
<asp:MenuItem Text="About Us" Value="About Us" NavigateUrl="~/About
[Link]"></asp:MenuItem>
<asp:MenuItem Text="Contact Us" Value="Contact Us"
NavigateUrl="~/Contact [Link]"></asp:MenuItem>
<asp:MenuItem Text="Login" Value="Login"
NavigateUrl="~/[Link]"></asp:MenuItem>
</Items>
</asp:Menu>
<br />
</div>
<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">
 
; &nbs
p; &nb
sp; &n
bsp; &
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 />
 
; &nbs
p; &nb
sp; &n
bsp; &
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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void ImageButton1_Click(object sender, ImageClickEventArgs e)
{
[Link]("[Link]");
}
}
.cs code :-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsubmit_Click(object sender, EventArgs e)
{
[Link]("[Link]");
}
}
Task On Data Base :-
Connection oriented architecture 1st Method:-
Bus table:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Buses.[Link]"
Inherits="Table_Buses" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into buses values(" + [Link] + ",'" + [Link] +
"'," + [Link] + "," + [Link] + ",'" + [Link] + "')";
[Link]();
int i = [Link]();
[Link]();
[Link] = 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=" +
[Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete buses where bus_id=" +[Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
}
}
Table Company:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Company.[Link]"
Inherits="Table_Company" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into Company values(" + [Link] + ",'" +
[Link] + "','" + [Link] + "','" + [Link] + "','" +
[Link] + "')";
//string s = "insert into company values(@pid,@pname,@ptype,@pestd,@paddress)";
cmd = new SqlCommand(s, con);
//[Link]("@pid", [Link]);
//[Link]("@pname", [Link]);
//[Link]("@ptype", [Link]);
//[Link]("@pestd", [Link]);
//[Link]("@paddress", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = 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=" +
[Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s="delete company where com_id="+[Link];
cmd = new SqlCommand(s,con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
}
}
Table Employs :-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Table_Employee.[Link]"
Inherits="Table_Employee" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
<div>
</div>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into emp values(" + [Link] + ",'" + [Link] +
"','" + [Link] + "'," + [Link] + "," + [Link] + "," +
[Link] + ")";
[Link]();
int i = [Link]();
[Link]();
[Link] = 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=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete emp where emp_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
}
}
Table Manager:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</form>
</body>
</html>
.cs file:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btninsert_Click(object sender, EventArgs e)
{
string s = "insert into manager values(" + [Link] + ",'" +
[Link] + "'," + [Link] + "," + [Link] + "," +
[Link] + ")";
[Link]();
int i = [Link]();
[Link]();
[Link] = 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=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete manager where manager_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
protected void btnclear_Click(object sender, EventArgs e)
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
}
}
Table Bus:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
Table Company :-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnedt_Click(object sender, EventArgs e)
{
string s = "select *from company where com_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link]();
dr = [Link]();
if ([Link]())
{
[Link] = "";
[Link] = dr[0].ToString();
[Link] = dr[1].ToString();
[Link] = dr[2].ToString();
[Link] = dr[3].ToString();
[Link] = dr[4].ToString();
}
else
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "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=" +
[Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete company where com_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
Table Employee :-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btninsert_Click(object sender, EventArgs e)
{
[Link] = "";
[Link] = "";
[Link]="REcords not found";
}
}
}
Table manager:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnedit_Click(object sender, EventArgs e)
{
string s = "select *from manager where manager_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link]();
dr = [Link]();
if ([Link]())
{
[Link] = "";
[Link] = dr[0].ToString();
[Link] = dr[1].ToString();
[Link] = dr[2].ToString();
[Link] = dr[3].ToString();
[Link] = dr[4].ToString();
}
else
{
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "";
[Link] = "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=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Effected";
}
protected void btndelete_Click(object sender, EventArgs e)
{
string s = "delete company where manager_id=" + [Link];
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
Working With Strored Procedures:-
Customer table:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsave_Click(object sender, EventArgs e)
{
[Link]();
cmd = new SqlCommand("Inscust", con);
[Link] = [Link];
[Link]("@Cid", Convert.ToInt32([Link]));
[Link]("@Cname", [Link]);
[Link]("@CphoneNumber", Convert.ToInt32([Link]));
[Link]("@CAddrss", [Link]);
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Updatecust", con);
[Link] = [Link];
[Link]("@Cid", Convert.ToInt32([Link]));
[Link]("@Cname", [Link]);
[Link]("@CphoneNumber", [Link]);
[Link]("@CAddrss", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delcust", con);
[Link] = [Link];
[Link]("@Cid",Convert.ToInt32( [Link]));
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
Table Products:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Products" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 198px;
width: 645px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insprod", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@Quantity", Convert.ToInt32([Link]));
[Link]("@untprice", Convert.ToInt32([Link]));
[Link]("@PStatus", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "ROw (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("upadateprod", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@Quantity", Convert.ToInt32([Link]));
[Link]("@untprice", Convert.ToInt32([Link]));
[Link]("@PStatus", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delprod", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
Table sales:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 45%;
height: 60px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnSave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("inssales", con);
[Link] = [Link];
[Link]("@Billno", Convert.ToInt32([Link]));
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@TotalPrice", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("updatesales", con);
[Link] = [Link];
[Link]("@Billno", Convert.ToInt32([Link]));
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@TotalPrice", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("delsales", con);
[Link] = [Link];
[Link]("@Billno", Convert.ToInt32([Link]));
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
Table stock:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
height: 117px;
width: 461px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsave_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("insstock", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@Pstatus", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("updatestock", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]("@Pname", [Link]);
[Link]("@Pstatus", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("delstock", con);
[Link] = [Link];
[Link]("@Pid", Convert.ToInt32([Link]));
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Deleted";
}
}
DATABASE TASKS :-
Student db:-
Table bus:-
Table school:-
Table student
Table teachers
Table employee
Table manager:-
Table products:-
Table stock :-
Table Employee:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 207px;
}
</style>
<script>
function fempid()
{
if([Link]==0)
{
[Link]("lbl1").innerHTML="enter empid";
else
{
[Link]("lbl1").insertHTML="";
}
}
function fempname()
{
if ([Link] == 0) {
[Link]("lbl2").innerHTML = "enter empname";
else {
[Link]("lbl2").insertHTML = "";
}
}
function fempemailaddress()
{
if ([Link] == 0)
{
[Link]("lbl3").innerHTML = "enter empaddress";
else {
[Link]("lbl3").insertHTML = "";
}
}
function fempdeptid() {
if ([Link] == 0) {
[Link]("lbl4").innerHTML = "enter empdeptid";
else {
[Link]("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>
 
; &nbs
p;
</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>
 
;
</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>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void ddlemployee_SelectedIndexChanged(object sender, EventArgs e)
{
SqlDataAdapter da;
DataSet ds = new DataSet();
da = new SqlDataAdapter("select * from employee_details where emp_did=" +
[Link],sqlcon);
[Link](ds);
[Link] = ds;
[Link]();
Output:-
Database Output:-
Table Department:-
.aspx code:-
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnSave_Click(object sender, EventArgs e)
{
string s = "insert into department_table values(" + [Link] + ",'" +
[Link] + "')";
SqlCommand cmd;
cmd = new SqlCommand(s, sqlcon);
[Link]();
int i=[Link]();
[Link](); ;
[Link] = 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="[Link]"
Inherits="Counyries" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
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);
[Link] = [Link];
[Link]("@pcid", [Link]);
[Link]("@Pcname", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) inserted";
}
}
Output:-
Database Output:-
States:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]" Inherits="States"
%>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
SqlCommand cmd;
string s = "insert into States values(@psid,@psname,@pcid)";
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]("@psid", [Link]);
[Link]("@psname", [Link]);
[Link]("@pcid", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) inserted";
}
}
Output:-
Database output:-
Districts:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Districts" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsave_Click(object sender, EventArgs e)
{
SqlCommand cmd;
string s = "insert into Dstricts values(@pdid,@pdname,@psid)";
cmd = new SqlCommand(s, con);
[Link] = [Link];
[Link]("@pdid", [Link]);
[Link]("@pdname", [Link]);
[Link]("@psid", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
}
output:-
Database output:-
Comlete form with dropdown lists:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Customers" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
protected void btnsave_Click(object sender, EventArgs e)
{
[Link]();
cmd = new SqlCommand("Inscust", con);
[Link] = [Link];
[Link]("@Cid", Convert.ToInt32([Link]));
[Link]("@Cname", [Link]);
[Link]("@CphoneNumber", Convert.ToInt32([Link]));
[Link]("@CAddrss", [Link]);
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
protected void btnUpdate_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Updatecust", con);
[Link] = [Link];
[Link]("@Cid", Convert.ToInt32([Link]));
[Link]("@Cname", [Link]);
[Link]("@CphoneNumber", [Link]);
[Link]("@CAddrss", [Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Updated";
}
protected void btndelete_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("Delcust", con);
[Link] = [Link];
[Link]("@Cid",Convert.ToInt32( [Link]));
[Link]();
int i = [Link]();
[Link]();
[Link] = 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
Database output:-
Output for update:-
Database output:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Repeater" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
[Link] = ds;
[Link]();
}
public void gridviewwithsroredprocedure()
{
da = new SqlDataAdapter("selcustomer", con);
[Link] = ds;
[Link]();
}
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="[Link]"
Inherits="Gridaspx" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<Columns>
<asp:TemplateField HeaderText="Empid">
<ItemTemplate>
</asp:GridView>
<br />
<br />
 
;
<asp:Button ID="btnactive" runat="server" Text="Active" OnClick="btnactive_Click"
/>
 
; &nbs
p; &nb
sp;
<asp:Button ID="Btninactive" runat="server" Text="InActive"
OnClick="Btninactive_Click" />
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
Output:-
Task on gridview to find student Percentage:-
Date:-26/10/2015
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="_Default" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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 [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
//[Link] = [Link][0].Columns[0].ToString();
//[Link] = "460";
//[Link] = "b";
}
}
public void calculate1()
{
foreach(GridViewRow x in [Link])
{
Label l1 = (Label)[Link]("lblid");
Label l10 = (Label)[Link]("lblunit2");
Label l11 = (Label)[Link]("lblgrade1");
Label ltotal = (Label)[Link]("lbltotalmarks");
string s = "select Total_Marks from StudentMarks where ID=101";
SqlDataAdapter da = new SqlDataAdapter(s, con);
DataSet ds = new DataSet();
[Link](ds);
int p = (Convert.ToInt32([Link]) / 6);
if (p < 40)
{
[Link]=[Link]+"/600";
[Link]="F";
}
else if (p > 40 && p < 50)
{
[Link] = [Link] + "/600";
[Link] = "C";
}
else if (p > 51 && p < 60)
{
[Link] = [Link] + "/600";
[Link] = "B";
}
else if (p > 61 && p < 70)
{
[Link] = [Link] + "/600";
[Link] = "B+";
}
else if (p> 71 &&p < 80)
{
[Link] = [Link] + "/600";
[Link] = "A-";
}
else if (p > 81 &&p < 90)
{
[Link] = [Link] + "/600";
[Link] = "A";
}
else
{
[Link] = [Link] + "/600";
[Link] = "A+";
}
}
}
Output:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Gridview [Link]"
Inherits="Gridview_move" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
[Link]();
[Link]();
[Link]();
}
if ([Link] == "down")
{
i = Convert.ToInt32([Link]);
r1 = [Link][i];
r2 = [Link][i + 1];
int phonenumber =
Convert.ToInt32([Link][[Link]].[Link]());
//int phonenumber =
Convert.ToInt32([Link][[Link]].Values["Phone"].ToString());
int value1 = Convert.ToInt32([Link][0].Text);
int value2 = Convert.ToInt32([Link][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);
[Link] = [Link];
[Link]("@p1", phonenumber + 1);
[Link]("@p2", value1);
[Link]("@p3", phonenumber);
[Link]("@p4", value2);
[Link]();
[Link]();
[Link]();
}
get();
}
}
Ouput:-
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</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" />
<asp:Label ID="lblMessage" runat="server"></asp:Label>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
if (!IsPostBack)
{
get();
add();
}
}
public void get()
{
SqlDataAdapter da = new SqlDataAdapter("select * from customers",con);
DataTable ds = new DataTable();
[Link](ds);
[Link] = ds;
[Link]();
}
public void add()
{
GridViewRow r = [Link];
DropDownList d=(DropDownList)[Link]("ddlemployee");
[Link](0, "select");
[Link](1,"Activate");
[Link](2, "DeActivate");
[Link](3, "Prospect");
//s = [Link]();
//foreach (GridViewRow x in [Link])
//{
// DropDownList d3 = (DropDownList)[Link]("ddlstatus");
// [Link]("select");
//}
}
public void select(object sender, EventArgs e)
{
GridViewRow r = [Link];
DropDownList d = (DropDownList)[Link]("ddlemployee");
string s = [Link](); ;
foreach (GridViewRow x in [Link])
{
DropDownList d2 = (DropDownList)[Link]("ddlstatus");
[Link]();
[Link](s);
}
protected void Button1_Click(object sender, EventArgs e)
{
foreach (GridViewRow x in [Link])
{
DropDownList d = (DropDownList)[Link]("ddlstatus");
Label l=(Label)[Link]("lblid");
//string s="update customers set status=@p1 where Id=@p2";
//cmd=new SqlCommand(s,con);
//[Link] = [Link];
//[Link]("@p1",[Link]);
//[Link]("@p2",[Link]);
//[Link]();
//[Link]();
//[Link]();
//[Link] = "Status Updated Successfully";
string s;
if ([Link] == "Activate")
{
s = "update customers set status='1' where Id=" + [Link];
}
else if ([Link] == "DeActivate")
{
s = "update customers set status='2' where Id=" + [Link];
}
else
{
s = "update customers set status='3' where Id=" + [Link];
}
cmd=new SqlCommand(s,con);
[Link]=[Link];
[Link]();
[Link]();
[Link]();
[Link]="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="[Link]" Inherits="Save" %>
<!DOCTYPE html>
<html xmlns="[Link]
<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>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
}
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);
[Link]("@p1",[Link]);
[Link]("@p2",[Link]);
[Link]("@p3",[Link]);
[Link]("@p4",[Link]);
[Link]("@p5",[Link]);
[Link]("@p6",[Link]);
[Link]();
int i = [Link]();
[Link]();
[Link] = i + "Row (s) Inserted";
}
protected void btnupdate_Click(object sender, EventArgs e)
{
[Link] = [Link]["id"];
[Link] = [Link]["name"];
[Link] = [Link]["designation"];
[Link] = [Link]["doj"];
[Link] = [Link]["salary"];
[Link] = [Link]["deptno"];
}
}
Output:-
Source Page:-
.aspx code:-
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="[Link]"
Inherits="Gridview" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
</form>
</body>
</html>
.cs code:-
using System;
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
using [Link];
public partial class Gridview : [Link]
{
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();
[Link](ds);
[Link] = ds;
[Link]();
}
Output:-
After Redirection:-