Slip 1
Slip 1
Slip 1
Q1
Create a XML document for student database and apply the style sheet effects and display on
webpage
students.xml:
<students>
<student>
<rollno>1</rollno>
<name>xyz</name>
</student>
<student>
<rollno>2</rollno>
<name>abc</name>
</student>
<student>
<rollno>3</rollno>
<name>erf</name>
</student>
</students>
style.xsl:
<xsl:template match="/">
<html>
<head>
</head>
Credit :- Raviraj
<body>
<table border="2">
<xsl:for-each select="students/student">
<tr>
<td>
<xsl:value-of select="name"/>
</td>
<td>
<xsl:value-of select="rollno"/>
</td>
</tr>
</xsl:for-each>
</table>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Q2
Name, Class, Phone, Email). Write a program to store the data in the
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
Credit :- Raviraj
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
try
con.Open();
cmd.ExecuteNonQuery();
con.Close();
catch (Exception x)
Response.Write(x.ToString());
finally
if (con.State == System.Data.ConnectionState.Closed)
else
con.close();
Credit :- Raviraj
}
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
<br />
<br />
<br />
Credit :- Raviraj
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<br />
<br />
<br />
<br />
<br />
<br />
Text="Retrive" />
<br />
<br />
<br />
<br />
</form>
<p>
</p>
</body>
</html>
SLIP 2:
Create a XML document for student database and apply the style sheet effects and display on
webpage.
Create a simple web page containing the student details (RollNo, Name, Class, Phone, Email).
Write a program to store the data in the database and retrieve it using Data reader in tabular
format.
Credit :- Raviraj
Create a simple web page with various sever controls to demonstrate setting and use of their
properties. (Example : AutoPostBack)
On click of a button control display the selected items from the listbox in a textbox. Also in the same
webpage display
label. Also change the font size of the same label according
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
TextBox1.Text=ListBox1.SelectedValue.ToString();
/* This will fetch the value from drop down list box to textbox*/
Label1.Text = DropDownList1.SelectedValue.ToString();
Label1.Font.Size = Convert.ToInt32(DropDownList2.SelectedValue.ToString());
if (CheckBox1.Checked)
Label2.Font.Underline = true;
else
Label2.Font.Underline = true;
Label2.ForeColor = System.Drawing.Color.Red;
if (CheckBox2.Checked)
Credit :- Raviraj
{
Label2.Font.Bold = true;
else
Label2.Font.Bold = true;
if (CheckBox3.Checked)
Label2.Font.Italic = true;
else
Label2.Font.Italic = true;
Label2.ForeColor = System.Drawing.Color.Green;
default.aspx
Credit :- Raviraj
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
<asp:ListItem>item1</asp:ListItem>
<asp:ListItem>item2</asp:ListItem>
<asp:ListItem>item1</asp:ListItem>
<asp:ListItem>item3</asp:ListItem>
<asp:ListItem>item4</asp:ListItem>
</asp:ListBox>
</div>
</div>
onselectedindexchanged="DropDownList1_SelectedIndexChanged">
<asp:ListItem>item1</asp:ListItem>
<asp:ListItem>item2</asp:ListItem>
<asp:ListItem>item1</asp:ListItem>
<asp:ListItem>item3</asp:ListItem>
<asp:ListItem>item4</asp:ListItem>
</asp:DropDownList>
Credit :- Raviraj
<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
<br />
<br />
<br />
<br />
onselectedindexchanged="DropDownList2_SelectedIndexChanged">
<asp:ListItem>10</asp:ListItem>
<asp:ListItem>12</asp:ListItem>
<asp:ListItem>13</asp:ListItem>
</asp:DropDownList>
</div>
<br />
</div>
</div>
Credit :- Raviraj
</form>
</body>
</html>
Q2 Create a simple web page to count the number of times the current
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<p>
</p>
Text="0"></asp:Label>
</form>
</body>
</html>
Default.aspx.cs.
Credit :- Raviraj
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
if (!this.IsPostBack)
ViewState["submitcount"] = 0;
ViewState["submitcount"] = (int)ViewState["submitcount"] + 1;
Label2.Text = ViewState["submitcount"].ToString();
SLIP 3 :
/*
Credit :- Raviraj
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace factorial
class Program
number = int.Parse(Console.ReadLine());
fact = number;
fact = fact * i;
Console.ReadLine();
/* FIBNONACCI*/
using System;
using System.Collections.Generic;
using System.Linq;
Credit :- Raviraj
using System.Text;
using System.Threading.Tasks;
namespace Fibonacci
class Fibonacci
int i,a=0,b=1,c,d;
d = Convert.ToInt32(Console.ReadLine());
Console.WriteLine(a);
Console.WriteLine(b);
for(i=3;i<=d;i++)
c = a + b;
Console.WriteLine(c);
a = b;
b = c;
Console.ReadKey();
/*Money Coversion*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
Credit :- Raviraj
namespace Money_Conversion
class Program
int choice;
choice = int.Parse(Console.ReadLine());
switch (choice)
case 1 :
dollar = Double.Parse(Console.ReadLine());
val = Double.Parse(Console.ReadLine());
break;
case 2 :
euro = Double.Parse(Console.ReadLine());
val1 = Double.Parse(Console.ReadLine());
break;
case 3:
Credit :- Raviraj
Double Yan, rupee2, val2;
Yan = Double.Parse(Console.ReadLine());
val2 = Double.Parse(Console.ReadLine());
break;
pound = Double.Parse(Console.ReadLine());
val3 = Double.Parse(Console.ReadLine());
break;
default:
Console.Write("Wrong Choice");
break;
} Console.ReadKey();
/*CUBE_OF_DIGIT*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace p
Credit :- Raviraj
{
class reverse
int no, c;
no = Convert.ToInt32(Console.ReadLine());
c = no * no * no;
Console.ReadKey();
operations.
Default.aspx:
<html xmlns="http://www.w3.org/1999/xhtml">
Credit :- Raviraj
<head id="Head1" runat="server">
<title></title>
</head>
<body>
<div>
ondayrender="Calendar1_DayRender"
onselectionchanged="Calendar1_SelectionChanged" ShowGridLines="True"
Width="220px">
ForeColor="#FFFFCC" />
</asp:Calendar>
Width="230px">
Height="8pt" />
Credit :- Raviraj
<TitleStyle BackColor="#333399" BorderStyle="Solid" Font-Bold="True"
</asp:Calendar>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
l1.Text = "<br>Gandhi Jayanti";
e.Cell.Controls.Add(l1);
e.Cell.Controls.Add(l2);
Calendar1.SelectedDayStyle.BackColor = System.Drawing.Color.Yellow;
Calendar1.SelectedDayStyle.ForeColor = System.Drawing.Color.Red;
Label1.Text = ts.TotalDays.ToString();
SLIP 4
Credit :- Raviraj
website -> add new item- >select
Web User Control (extension is ascx) and again default.aspx from list
WebControlUser.ascx.cs*
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
WebuserControl.ascx
></asp:Label>
Default.aspx.c
Credit :- Raviraj
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs"
Inherits="_Default" %>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Add new item as XML file and add following code in file
XML FILE.XML
<Advertisements>
<Ad>
<ImageUrl>Desert.jpg</ImageUrl>
<NavigateUrl>/*PLEASE CHANGE/*</</NavigateUrl>
Credit :- Raviraj
<AlternateText>book desert show</AlternateText>
<Impressions>5</Impressions>
<Keyword>desert </Keyword>
</Ad>
<Ad>
<ImageUrl>/*PLEASE CHANGE/*</ImageUrl>
<NavigateUrl>www.Koala.com</NavigateUrl>
<Impressions>5</Impressions>
<Keyword>desert </Keyword>
</Ad>
</Advertisements>
Warning all Tags begins with Capital letter and if spelling mistake then no out put no
error
Not as follows
</AlternateText>
Height =60
Width=600
Run
To change image Refresh so it will display . in impressions of xml file use different
number , like 1 , 5 , 7 etc. More impressions means it will display more time as compare to
other
Credit :- Raviraj
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<br />
</div>
</asp:XmlDataSource>
</form>
</body>
</html>
Slip 5
Q1 Create XML file employees with nodes (eid, ename, edept, salary). Bind the eid and ename to a
dropdownlist and the ename should be in the ascending order
XMLfile.xml
<employees>
<employee>
<eid>1</eid>
<ename>Abhishek</ename>
<edept>IT</edept>
<salary>5000</salary>
Credit :- Raviraj
</employee>
<employee>
<eid>2</eid>
<ename>Siddhesh</ename>
<edept>IT</edept>
<salary>4000</salary>
</employee>
<employee>
<eid>3</eid>
<ename>Akshita</ename>
<edept>IT</edept>
<salary>6000</salary>
</employee>
<employee>
<eid>4</eid>
<ename>Ashu</ename>
<edept>IT</edept>
<salary>9000</salary>
</employee>
</employees>
default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
Credit :- Raviraj
</head>
<body>
<div>
</asp:DropDownList>
</div>
</form>
</body>
</html>
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
empds.ReadXml(Server.MapPath("")+"\\XMLFile.xml");
empds.Tables[0].DefaultView.Sort = "ename";
DropDownList1.DataSource = empds.Tables[0];
Credit :- Raviraj
DropDownList1.DataTextField = "ename";
DropDownList1.DataValueField = "eid";
DropDownList1.DataBind();
Q2 Create simple web page that takes a number as input and display it
four times in a row (separated by blank spaces), and then four times
Like-
Enter a digit: 22
Expected Output:
22 22 22 22
22222222
22 22 22 22
22222222
default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
Credit :- Raviraj
<form id="form1" runat="server">
<div>
<br />
</div>
<br />
<br />
<br />
</form>
</body>
</html>
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
protected void Button1_Click(object sender, EventArgs e)
Label1.Text="";
int a = Convert.ToInt32(TextBox1.Text);
if (i % 2 == 0)
Label1.Text += a.ToString();
Label1.Text += "<br>";
else
Label1.Text += "<br>";
Slip 6
Credit :- Raviraj
Q1
display the number of days of the year between two specified years.
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
from date
<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />
Credit :- Raviraj
<asp:TextBox ID="TextBox3" runat="server" Height="118px" TextMode="MultiLine"
Width="176px"></asp:TextBox>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//years
Credit :- Raviraj
int Years = ToYear.Year - FromYear.Year;
//months
//TotalDays
//Total Months
//Total Hours
//Total Minutes
//Total Seconds
+ Convert.ToString(TotalMonths) + "\n";
+ Convert.ToString(Days) + "\n";
Credit :- Raviraj
Q2
dropdownlist control.
go to deafult.aspx
In dropdown enable autopostback -> and add new soruce -> add sql table next
after adding go to same option in gridview -> select connection and database and now in where
clause select rollno = rollno, Control and dropdownlist
Slip 7
Q1
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
Credit :- Raviraj
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
string st = TextBox1.Text;
Response.Write(st.ToUpper()+"<br>");
Response.Write(st.ToLower() + "<br>");
Response.Write(st.Substring(0,5) + "<br>");
Response.Write(st.IndexOf("llo") + "<br>");
Response.Write(st.StartsWith("hel") + "<br>");
Q2
1.On click of Radio Buttons each at the same time from two
label’s Text.
name from the dropdown list, its respective country code gets
displayed in a textbox.
1.Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
Credit :- Raviraj
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
<br />
<br />
<br />
<br />
<br />
</form>
</body>
</html>
Default.aspx.cs [Properties -> CHeckchange -> "Give name of method" -> fontchange]
Credit :- Raviraj
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Label1.Font.Name = ((RadioButton)sender).Text;
add items in it, after adding items, take one textbox and copy paste this code in the dropdown
method
TextBox1.Text =DropDownList.SelectedValue.ToString();
Credit :- Raviraj
Slip 8
Q1.
Create a simple application to call these two methods by the through the
delegate.
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Delegates
class DelegateTest
num += p;
return num;
num *= q;
return num;
Credit :- Raviraj
del1 m2 = new del1(display2);
m1(25);
m2(5);
Console.ReadKey();
Q2.
Create a simple web page to show how to write and read a cookie from a client's computer.
default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
<br />
Credit :- Raviraj
<br />
<br />
<br />
</div>
</form>
</body>
</html>
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Response.Cookies.Add(cookie1);
Credit :- Raviraj
protected void Button2_Click(object sender, EventArgs e)
TextBox1.Text=Request.Cookies["user1"].Value;
Slip 9
Q1.
Click on small arrow button on right side on textbox and add extender -> Htmleditor
Q2.
Create a web application to demonstrate use of Master Page with applying Styles and Themes
You need one master page, one default.aspx and one add theme and use this code
default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
Credit :- Raviraj
<head runat="server">
<title></title>
</head>
<body>
<div>
fsdfddsfaafdsf
</div>
</form>
</body>
</html>
Masterpage.master
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</asp:ContentPlaceHolder>
</head>
<body>
head
</div>
Credit :- Raviraj
</asp:ContentPlaceHolder>
foot
</div>
</form>
</body>
</html>
Theme/Stylesheet.css
body
border-style: groove;
border-color: #FFFF00;
.head
border-style: solid;
border-color: #FF0000;
.foot
border-style: solid;
border-color: #FF0000;
Slip 10
Credit :- Raviraj
Q1
Create a web applications to demonstrate Form Security and Windows Security with proper
Authentication and Authorization properties.
NA
Q2.
Create a web application to demonstrate GridView paging and Creating own table format using
GridView.
after that select one grid view in grid view enable the paging and after that on > this arrow click add
new conectiion,
Slip 11
Q1
Create a web application to bind data in a multiline textbox by querying in another textbox.
default.ascx
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
</head>
<body>
Credit :- Raviraj
<form id="form1" runat="server">
<div>
Width="204px" ></asp:TextBox>
ontextchanged="TextBox2_TextChanged"></asp:TextBox>
<br />
<br />
<br />
</div>
</form>
</body>
</html>
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
}
textdata = TextBox2.Text;
this.DataBind();
Q2.
File_>newproject->SelectClassLibrary->clickok
class library
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ClassLibrary1
int d = 1;
Credit :- Raviraj
{
d = d * i;
return d.ToString();
Clickondebug->buildsolutiontocreatDLL
FileDLLiscreatedinfolderbin
Go to Console Application
Now Rightclick on right side, Cosole Application and add reference of your Dll file and the rub this
code
Consoleapplication.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ClassLibrary1;
namespace ConsoleApplication2
class Program
Credit :- Raviraj
int z =Convert.ToInt32(ob.fact(5));
Console.ReadKey();
Slip 12
4.Reverse a number
/*fibo*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Fibonacci
class Fibonacci
int i,a=0,b=1,c,d;
d = Convert.ToInt32(Console.ReadLine());
Credit :- Raviraj
Console.WriteLine(a);
Console.WriteLine(b);
for(i=3;i<=d;i++)
c = a + b;
Console.WriteLine(c);
a = b;
b = c;
Console.ReadKey();
/*prime*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace prime1
class prime
int i, no;
int m, f = 0;
no = Convert.ToInt32(Console.ReadLine());
Credit :- Raviraj
m = no / 2;
if (no % i == 0)
f = 1;
break;
if(f==0)
Console.ReadKey();
/*reverse*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace p
class reverse
Credit :- Raviraj
{
no = Convert.ToInt32(Console.ReadLine());
temp = no % 10;
no = no / 10;
Console.WriteLine("reverse=" + rev);
Console.ReadKey();
/*vowel*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace vowel
class vowel
char ch;
Console.WriteLine("enter no=");
ch = Convert.ToChar(Console.ReadLine());
Credit :- Raviraj
if(ch=='a' || ch=='e' || ch=='i' || ch=='o' || ch=='u' )
Console.WriteLine("It is wovel");
else
Console.ReadKey();
Q2.
add table and show table data and put tsome details
and the add new data source in gridview right corner of table
SLIP 13
Q1
Default.aspx
Credit :- Raviraj
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
enter no 1
<asp:TextBox ID="TextBox1"
runat="server"></asp:TextBox>
<br />
<br />
<br />
enter no 2
<asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox>
<br />
<br />
<br />
answer
Text="Label"></asp:Label>
<br />
<br />
Credit :- Raviraj
<asp:Button ID="Button2" runat="server"
<br />
</div>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
EventArgs e)
try
int a, b;
a = Convert.ToInt32(TextBox1.Text);
b = Convert.ToInt32(TextBox2.Text);
int c = a / b;
Label1.Text = c.ToString();
catch (DivideByZeroException)
Credit :- Raviraj
Label1.Text = "can't divide by zero";
EventArgs e)
try
int[] a = { 6, 7 };
Label1.Text = a[2].ToString();
catch (IndexOutOfRangeException)
Q2
Create a simple web page to show data in Tree view control and datalist using web. Sitemap file
containing navigation information.
<studentdetail>
<student>
<sid>1</sid>
<sname>greatperson</sname>
Credit :- Raviraj
<sclass>TYIT</sclass>
</student>
<student>
<sid>2</sid>
<sname>Sonali</sname>
<sclass>TYCS</sclass>
</student>
<student>
<sid>3</sid>
<sname>hari </sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>4</sid>
<sname>Vedshree</sname>
<sclass>TYCS</sclass>
</student>
</studentdetail>
Default.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
</head>
<body>
Credit :- Raviraj
<form id="form1" runat="server">
<div>
<Nodes>
</asp:TreeNode>
NavigateUrl="~/Default.aspx"></asp:TreeNode>
Value="BLUE"></asp:TreeNode>
Properties"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<br />
<ItemTemplate>
<tr>
Credit :- Raviraj
Class : <%# Eval("sclass")%>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
<br/>
</form>
</body>
</html>
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
if (!IsPostBack)
BindData();
Credit :- Raviraj
ds.ReadXml(Server.MapPath("stdetail.xml"));
DataList1.DataSource = ds;
DataList1.DataBind();
else
DataList1.DataBind();
SLIP 14
Q1
and then create add -> new global asax and ctl c + ctrl v/*
Credit :- Raviraj
Default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Global.asax
<script runat="server">
Application["Nov"] = 0;
Credit :- Raviraj
}
Application.Lock();
Application["Nov"] = (int)Application["Nov"] + 1 ;
Application.UnLock();
// Note: The Session_End event is raised only when the sessionstate mode
</script>
default.aspx
Credit :- Raviraj
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
</div>
</form>
</body>
</html>
Q2
Create a registration form having text fields for accepting, Name, Age, Email, Address and Mobile
number. Perform the following
a new page and display all the information entered by the user and
Credit :- Raviraj
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<title></title>
<style type="text/css">
.style1
height: 30px;
</style>
</head>
<body>
<div>
<table style="width:100%;">
<tr>
<td class="style1">
Name
></asp:TextBox>
ControlToValidate="TextBox1" ErrorMessage="*"
ForeColor="Red"></asp:RequiredFieldValidator>
Credit :- Raviraj
ForeColor="Red" ValidationExpression="[a-zA-
Z]{5,25}"></asp:RegularExpressionValidator>
</td>
<td class="style1">
</td>
<td class="style1">
</td>
</tr>
<tr>
<td>
Age
ControlToValidate="TextBox2" ErrorMessage="*"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Email
ControlToValidate="TextBox3" ErrorMessage="*"
ForeColor="Red"></asp:RequiredFieldValidator>
Credit :- Raviraj
ControlToValidate="TextBox3" ErrorMessage="Invalid email" ForeColor="Red"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-
.]\w+)*"></asp:RegularExpressionValidator>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
Address
ControlToValidate="TextBox4" ErrorMessage="*"
ForeColor="Red"></asp:RequiredFieldValidator>
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
PhoneNo
ControlToValidate="TextBox5" ErrorMessage="*"
ForeColor="Red"></asp:RequiredFieldValidator>
ValidationExpression="\d{10}"></asp:RegularExpressionValidator>
Credit :- Raviraj
</td>
<td>
</td>
<td>
</td>
</tr>
<tr>
<td>
</td>
<td>
</td>
<td>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
Deault.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
public partial class _Default : System.Web.UI.Page
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
TextBox4.Text = "";
TextBox5.Text = "";
SLIP 15
Q1
Create a webpage with multiline textbox and two buttons, viz. saveContents and loadContents.
On click of saveContents button, contents from the textbox should be retained and on click of
loadContents button,
default.aspx
Credit :- Raviraj
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default"
%>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<div>
Width="196px"></asp:TextBox>
</div>
</form>
</body>
</html>
default.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
Credit :- Raviraj
public partial class _Default : System.Web.UI.Page
ViewState["data"] = TextBox1.Text;
TextBox1.Text = "";
TextBox1.Text = ViewState["data"].ToString();
Q2.
Store 3 objects of the furniture class having 3 data members (name, manufacturer, and cost) in 3
session objects.
Display a panel to include a listbox displaying the names of all three furniture objects, and a button
named “MoreInformation”.
On click of the button retrieve the selected object (from listbox) information and display it in a label.
Default.aspx
Credit :- Raviraj
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
onselectedindexchanged="ListBox1_SelectedIndexChanged"></asp:ListBox>
</div>
</div>
<div>
</div>
</form>
</body>
</html>
Default.aspx.cs
Credit :- Raviraj
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
if (!IsPostBack)
Session["s1"]=new Furniture("chair","xyz","1000");
Session["s2"]=new Furniture("chair1","eez","50");
Session["s3"]=new Furniture("chair2","xez","600");
ListBox1.Items.Add(((Furniture)Session["s1"]).name);
ListBox1.Items.Add(((Furniture)Session["s2"]).name);
ListBox1.Items.Add(((Furniture)Session["s3"]).name);
Credit :- Raviraj
}
if(ListBox1.SelectedIndex != -1)
if(ListBox1.SelectedIndex == 0 )
Label1.Text = ((Furniture)Session["s1"]).mani;
Label2.Text = ((Furniture)Session["s1"]).cost;
else if(ListBox1.SelectedIndex == 1)
Label1.Text = ((Furniture)Session["s2"]).mani;
Label2.Text = ((Furniture)Session["s2"]).cost;
else if(ListBox1.SelectedIndex == 2)
Label1.Text = ((Furniture)Session["s3"]).mani;
Label2.Text = ((Furniture)Session["s3"]).cost;
class Furniture
Credit :- Raviraj
public Furniture(string name, string mani, string cost)
this.name = name;
this.mani = mani;
this.cost = cost;
SLIP 16
Q1.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Interfaces
interface Addition
interface Multiplication
Credit :- Raviraj
double n1 = 120, n2 = 12.239;
double Result;
Result = n1 + n2;
Result = n1 * n2;
class Program
c.add(15, 20);
c.mul(20, 15);
Console.ReadLine();
Q2.
add table and show table data and put tsome details
Credit :- Raviraj
and create a default.aspx in that (grid view)
and the add new data source in gridview right corner of table
Credit :- Raviraj