You are on page 1of 43

1.

Using Window Forms Application, collect the user details like First Name, Middle Name,
Last Name, Gender, User Photo, Course name, Course Timing with Submit and Clear
button. Display the user detail in another form

Form1.cs

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

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

private void button1_Click_1(object sender, EventArgs e)


{
//filter the file you want to get
openFileDialog1.Filter = "img (*.jpg)|*.jpg|All files (*.*)|*.*";
//set an intial directory
openFileDialog1.InitialDirectory = @"C:\";
//Put the title in the dialog box
openFileDialog1.Title = "Please select an image.";
//validating result
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
//set the image to be stretch
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
//load the image in the picture box
pictureBox1.Image = Image.FromFile(openFileDialog1.FileName);
}
}

private void button2_Click(object sender, EventArgs e)


{
string gender;
if (radioButton1.Checked == true)
{
gender = radioButton1.Text;
}
else
{
gender = radioButton2.Text;
}

Form2 frm = new Form2(textBox1.Text, textBox2.Text, textBox3.Text,


textBox4.Text, comboBox2.Text, comboBox1.Text, gender, pictureBox1.Image);
frm.Imageform = pictureBox1.Image;
frm.ShowDialog();

private void button3_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
comboBox2.Text = "";
comboBox1.Text = "";
radioButton1.Checked = false;
radioButton2.Checked = false;
pictureBox1.Image = null;
pictureBox1.Update();

}
}
}
Form2.cs

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

namespace WindowsFormsApplication1
{
public partial class Form2 : Form
{
public Form2()
{
InitializeComponent();
}
public Image Imageform
{
get;
set;
}

public Form2(string fname,string mname,string lname,string adress,string


coursena,string courseti,string gender,Image imageform)
{
InitializeComponent();
label1.Text = fname;
label2.Text = mname;
label3.Text = lname;
label4.Text = adress;
label5.Text = coursena;
label6.Text = courseti;
label7.Text = gender;
pictureBox1.Image = imageform;
pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

}
}
2. Create a Window Forms Application containing different genre of movies and one
button to display the favourite genre selected by user.

Form3.cs

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

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

private void button1_Click(object sender, EventArgs e)


{
if (checkBox1.Checked)
{
MessageBox.Show(checkBox1.Text);
}
if (checkBox2.Checked)
{
MessageBox.Show(checkBox2.Text);
}
if (checkBox3.Checked)
{
MessageBox.Show(checkBox3.Text);
}
if (checkBox4.Checked)
{
MessageBox.Show(checkBox4.Text);
}

private void button2_Click(object sender, EventArgs e)


{
MessageBox.Show(comboBox1.Text);

}
}
}
3.Create a Window Forms Application to demonstrate any 3 mouse and keyboard event
each

Form1.cs

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

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

private void button1_MouseHover(object sender, EventArgs e)


{
label1.Text = "cursor on me";

private void button1_MouseLeave(object sender, EventArgs e)


{
label1.Text = "cursor not on me";
}

private void button1_MouseClick(object sender, MouseEventArgs e)


{
label1.Text = "you clicked me";
}
}
}
Form1.cs

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

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

private void richTextBox1_KeyDown(object sender, KeyEventArgs e)


{
label1.Text = "you pressed down key";

private void richTextBox1_KeyUp(object sender, KeyEventArgs e)


{
label1.Text = "you pressed up key";

private void richTextBox1_KeyPress(object sender, KeyPressEventArgs e)


{
label1.Text = "Key pressed : " + e.KeyChar;

}
}
}
4.Create a Window Forms Application to load an image into a picture box using file open
dialogue box

Form1.cs

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

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

private void button1_Click(object sender, EventArgs e)


{
OpenFileDialog ofd = new OpenFileDialog();
if (ofd.ShowDialog() == DialogResult.OK)
{
Bitmap bit = new Bitmap(ofd.FileName);
pictureBox1.Image = bit;
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom;
}
}

}
}
5. Create a WPF Application for auto complete text box with suitable windows icon.

6 Create a login WPF Application with Sql database.

loginscreen.xaml

<Window x:Class="wpfloginscreen.loginscreen"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Login" Height="300" Width="300" FontSize="14" Background="green"
Loaded="Window_Loaded">
<Border Background="black" CornerRadius="20" Margin="10">
<StackPanel Margin="20">
<Label Content="Login" Foreground="white" FontSize="25"
HorizontalAlignment="Center"></Label>
<Separator></Separator>
<Label Content="Username" Foreground="White"/>
<TextBox Name="txtUsername" Background="Gray" Foreground="White"
FontSize="18"/>
<Label Content="Password" Foreground="White"/>
<TextBox Name="txtPassword" Background="Gray" Foreground="White"
FontSize="18" DataContext="{Binding}" />
<Button Name="btnSubmit" Background="Gray" Foreground="White"
FontSize="18" Content="Submit" Margin="60 10" Click="btnSubmit_Click"/>
</StackPanel>
</Border>
</Window>

loginscreen.xaml.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Data.SqlClient;

namespace wpfloginscreen
{
/// <summary>
/// Interaction logic for loginscreen.xaml
/// </summary>
public partial class loginscreen : Window
{
public loginscreen()
{
InitializeComponent();
}

private void Window_Loaded(object sender, RoutedEventArgs e)


{

private void btnSubmit_Click(object sender, RoutedEventArgs e)


{
SqlConnection sqlcon = new SqlConnection("Data Source=Server1;Initial
Catalog=tejasvi15;Integrated Security=True;");
try
{
if (sqlcon.State == System.Data.ConnectionState.Closed)
sqlcon.Open();
string query = "SELECT COUNT(1) FROM Loginforwpf WHERE
Username=@Username AND loginpassword=@loginpassword ";

SqlCommand sqlcmd = new SqlCommand(query, sqlcon);


sqlcmd.CommandType = System.Data.CommandType.Text;
sqlcmd.Parameters.AddWithValue("@Username",
txtUsername.Text);
sqlcmd.Parameters.AddWithValue("@loginpassword",
txtPassword.Text);
int count = Convert.ToInt32(sqlcmd.ExecuteScalar());
if(count==1)
{
MainWindow dashboard = new MainWindow();
dashboard.Show();
this.Close();
}
else
{
MessageBox.Show("Username and Password is incorrect");
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
finally
{
sqlcon.Close();
}

}
}
}

MainWindow.xaml

<Window x:Class="wpfloginscreen.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Label Content="Dashboard"/>
</Grid>
</Window>
7 Develop a database application to store the details of an employee using ADO.NET
using windows forms.
Form1.cs
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.SqlClient;

namespace WindowsFormsApplication8
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
SqlConnection con = new SqlConnection("Data Source=Server1;Initial
Catalog=tejasvi15;Integrated Security=True");
private void textBox3_TextChanged(object sender, EventArgs e)
{

private void textBox1_TextChanged(object sender, EventArgs e)


{

private void textBox2_TextChanged(object sender, EventArgs e)


{

private void textBox5_TextChanged(object sender, EventArgs e)


{

private void textBox4_TextChanged(object sender, EventArgs e)


{

private void label1_Click(object sender, EventArgs e)


{

private void label4_Click(object sender, EventArgs e)


{

private void button1_Click(object sender, EventArgs e)


{
SqlCommand comm = new SqlCommand("insert into
Employee(Nameofemp,Ageofemp,Sexofemp,Adressofemp,Contactofemp) values ('" +
textBox1.Text + "','" + textBox2.Text + "','" + textBox3.Text + "','" + textBox4.Text + "','" +
textBox5.Text + "')", con);
con.Open();
comm.ExecuteNonQuery();
MessageBox.Show("Record inserted successfully");
con.Close();

private void button2_Click(object sender, EventArgs e)


{
textBox1.Text = "";
textBox2.Text = "";
textBox3.Text = "";
textBox4.Text = "";
textBox5.Text = "";
}
}
}
8 Develop a sample student database application using ADO.NET to perform CRUD
operations

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.SqlClient;
using System.Data;

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


{
SqlConnection con = new SqlConnection("Data Source=Server1;Initial
Catalog=tejasvi15;Integrated Security=True");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
LoadRecord();
}
}
protected void Button1_Click(object sender, EventArgs e)
{

con.Open();
SqlCommand comm=new SqlCommand("Insert into Studentinfo_tab
values('"+Int16.Parse(TextBox1.Text)
+"','"+TextBox2.Text+"','"+DropDownList1.SelectedValue+"','"+double.Parse(TextBox3.Text)
+"','"+TextBox4.Text+"')",con);
comm.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Succesfully
inserted');",true);
LoadRecord();
}
void LoadRecord()
{
SqlCommand comm1 = new SqlCommand("select * from Studentinfo_tab",con);
SqlDataAdapter d = new SqlDataAdapter(comm1);
DataTable dt = new DataTable();
d.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Button2_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm = new SqlCommand("update Studentinfo_tab set Studentname='" +
TextBox2.Text + "',Adress='" + DropDownList1.SelectedValue + "',Age='" +
double.Parse(TextBox3.Text)+"',Contact='"+TextBox4.Text+"' where
Studentid='"+Int16.Parse(TextBox1.Text)+"'", con);
comm.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Succesfully
updated');", true);
LoadRecord();
}
protected void Button3_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm = new SqlCommand("delete Studentinfo_tab where Studentid='" +
Int16.Parse(TextBox1.Text) + "'", con);
comm.ExecuteNonQuery();
con.Close();
ScriptManager.RegisterStartupScript(this, this.GetType(), "script", "alert('Succesfully
deleted');", true);
LoadRecord();
}
protected void Button4_Click(object sender, EventArgs e)
{
SqlCommand comm1 = new SqlCommand("select * from Studentinfo_tab where
Studentid='" + Int16.Parse(TextBox1.Text) + "'", con);
SqlDataAdapter d = new SqlDataAdapter(comm1);
DataTable dt = new DataTable();
d.Fill(dt);
GridView1.DataSource = dt;
GridView1.DataBind();
}
protected void Button5_Click(object sender, EventArgs e)
{
con.Open();
SqlCommand comm1 = new SqlCommand("select * from Studentinfo_tab where
Studentid='" + Int16.Parse(TextBox1.Text) + "'", con);
SqlDataReader r=comm1.ExecuteReader();
while (r.Read())
{
TextBox2.Text = r.GetValue(1).ToString();
DropDownList1.SelectedValue = r.GetValue(2).ToString();
TextBox3.Text = r.GetValue(3).ToString();
TextBox4.Text = r.GetValue(4).ToString();
}
}
}

Web.config
<?xml version="1.0"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>
<add name="ApplicationServices" connectionString="data source=.\
SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\
aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient"/>
</connectionStrings>
<system.web>
<compilation debug="true" targetFramework="4.0"/>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
</authentication>
<membership>
<providers>
<clear/>
<add name="AspNetSqlMembershipProvider"
type="System.Web.Security.SqlMembershipProvider"
connectionStringName="ApplicationServices" enablePasswordRetrieval="false"
enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false"
maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6"
minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10"
applicationName="/"/>
</providers>
</membership>
<profile>
<providers>
<clear/>
<add name="AspNetSqlProfileProvider"
type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices"
applicationName="/"/>
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear/>
<add name="AspNetSqlRoleProvider"
type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices"
applicationName="/"/>
<add name="AspNetWindowsTokenRoleProvider"
type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
</providers>
</roleManager>
</system.web>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"/>
</system.webServer>
</configuration>
9 Create a asp.net web application using standard controls.

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

<!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>
<style type="text/css">
.style1
{
width: 100%;
}
.style2
{
height: 23px;
}
.style3
{
height: 23px;
width: 306px;
}
.style4
{
width: 306px;
}
.style5
{
width: 306px;
height: 25px;
}
.style6
{
height: 25px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

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


<tr>
<td class="style3">
<asp:Label ID="Label15" runat="server"></asp:Label>
</td>
<td class="style2">
&nbsp;</td>
<td class="style2">
&nbsp;</td>
</tr>
<tr>
<td class="style3">
<asp:Label ID="Label1" runat="server" Text="Your name"></asp:Label>
</td>
<td class="style2">
<asp:TextBox ID="TextBox1" runat="server" Width="342px"
ontextchanged="TextBox1_TextChanged"></asp:TextBox>
&nbsp;&nbsp;
<asp:Label ID="Label14" runat="server"></asp:Label>
</td>
<td class="style2">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label2" runat="server"
Text="Upload your gardening experience file"></asp:Label>
</td>
<td>
<asp:FileUpload ID="FileUpload1" runat="server" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button6" runat="server" onclick="Button6_Click"
Text="Upload" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label13" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label3" runat="server" Text="View a rose
image"></asp:Label>
</td>
<td>
<asp:Image ID="Image1" runat="server" Height="50px"
ImageUrl="~/images/ROSE.jfif" Visible="false"/>
&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;&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;&nbsp;&nbsp;&nbsp;
<asp:ImageButton ID="ImageButton1" runat="server" Height="50px"
ImageUrl="~/images/camera.jfif" onclick="ImageButton1_Click" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label6" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label4" runat="server" Text="Select your favourite
flower"></asp:Label>
</td>
<td>
<asp:ListBox ID="ListBox1" runat="server">
<asp:ListItem>Select</asp:ListItem>
<asp:ListItem>Rose</asp:ListItem>
<asp:ListItem>Lotus</asp:ListItem>
<asp:ListItem>Tulips</asp:ListItem>
<asp:ListItem>Sunflower</asp:ListItem>
</asp:ListBox>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button
ID="Button2" runat="server" onclick="Button2_Click" Text="Selected" />

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label7" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label5" runat="server" Text="Select color of
flower"></asp:Label>
</td>
<td>
<asp:DropDownList ID="DropDownList1" runat="server">
<asp:ListItem>Select any</asp:ListItem>
<asp:ListItem>Red roses</asp:ListItem>
<asp:ListItem>Black roses</asp:ListItem>
<asp:ListItem>Yellow roses</asp:ListItem>
</asp:DropDownList>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;
<asp:Button ID="Button3" runat="server" onclick="Button3_Click"
Text="selected" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;
<asp:Label ID="Label8" runat="server"></asp:Label>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
&nbsp;</td>
<td>
<asp:HyperLink ID="HyperLink1" runat="server"
NavigateUrl="~/images/ROSE.jfif">click here</asp:HyperLink>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
&nbsp;</td>
<td>
<asp:LinkButton ID="LinkButton1" runat="server"
PostBackUrl="~/Default3.aspx">See howe to grow roses</asp:LinkButton>
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style5">
<asp:Label ID="Label9" runat="server"></asp:Label>
&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<br />
<asp:Label ID="Label10" runat="server"></asp:Label>
<br />
<asp:Label ID="Label11" runat="server"></asp:Label>
</td>
<td class="style6">
<asp:CheckBox ID="CheckBox1" runat="server" Text="Roses have
thorns" />
&nbsp;
<asp:CheckBox ID="CheckBox2" runat="server" Text="Roses different
colors" />
&nbsp;&nbsp;
<asp:CheckBox ID="CheckBox3" runat="server"
Text="Could be used for rose syrup" />
&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Button ID="Button4" runat="server" onclick="Button4_Click"
Text="checked" />
</td>
<td class="style6">
</td>
</tr>
<tr>
<td class="style4">
<asp:Label ID="Label12" runat="server"></asp:Label>
</td>
<td>
<asp:RadioButton ID="RadioButton1" runat="server" Text="rose is fragrant"
oncheckedchanged="RadioButton1_CheckedChanged" />
&nbsp;&nbsp;
<asp:RadioButton ID="RadioButton2" runat="server" Text="no smell for
roses"
oncheckedchanged="RadioButton2_CheckedChanged" />
&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;&nbsp;&nbsp;
<asp:Button ID="Button5" runat="server" onclick="Button5_Click"
Text="done" />
</td>
<td>
&nbsp;</td>
</tr>
<tr>
<td class="style4">
&nbsp;</td>
<td>
&nbsp;</td>
<td>
&nbsp;</td>
</tr>
</table>

</div>
<asp:Button ID="Button1" runat="server" Text="submit" onclick="Button1_Click" />

&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;&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;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<asp:Label ID="Label16" runat="server"></asp:Label>
</form>
</body>
</html>
Default3.aspx

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


Inherits="Default3" %>

<!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>
<form id="form1" runat="server">
<div>

When growing roses, it’s important to choose a site receiving at least six hours
of sun each day. Rose bushes must also be located in well-drained, fertile soil.
Plant dormant roses in early spring (or fall). Potted plants can be planted any
time between spring and fall, but preferably spring.

How to Take Care of Roses:


Caring for rose bushes is important to their overall health and vigor, especially
when it comes to watering. Roses require at least an inch (2.5 cm.) of water
weekly throughout their growing season, beginning in spring or following spring
planting. While overhead watering is suitable before the onset of new growth, it
is often better to water these plants at the soil line using soaker hoses or
similar means. Rose bushes are very susceptible to fungal diseases, such as
black spot and powdery mildew, especially when their foliage is kept too wet.
Fertilizer for roses should also be applied in spring, following the label
instructions carefully. However, with the addition of well-rotted manure each
spring, this is usually adequate. Mulching your rose bush will help retain
moisture and may also offer some winter protection. Pruning is another aspect to
consider when caring for rose bushes. This often takes place once leaf buds
appear in spring. Make cuts about 1/4 inch (6 mm.) above the bud eyes and prune
out any twiggy or unhealthy branches.

</form>
</body>
</html>
10 Create a web form to collect user details like Name (Required field validator),
password (Range validate), confirm password (compare validator), email (regular
expression validator), country name and phone number (range validator) with suitable
validation controls. Display validation summary. If validation is successful display the
user details.

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

<!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>
<style type="text/css">
.style1
{
width: 68%;
}
.style2
{
width: 244px;
}
.style4
{
width: 288px;
}
.style5
{
width: 207px;
}
#Password1
{
width: 190px;
}
#Password2
{
width: 189px;
}
.style6
{
width: 244px;
height: 26px;
}
.style7
{
width: 207px;
height: 26px;
}
.style8
{
width: 288px;
height: 26px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>

<table class="style1">
<tr>
<td class="style2">
User Id:</td>
<td class="style5">
<asp:TextBox ID="txt_userid" runat="server"
Width="195px"></asp:TextBox>
</td>
<td class="style4">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txt_userid" Display="Dynamic"
ErrorMessage="Field is mandatory" ForeColor="Red"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
<tr>
<td class="style2">
Password</td>
<td class="style5">
<asp:TextBox ID="txt_password" runat="server" Width="192px"
TextMode="Password" ></asp:TextBox>
</td>
<td class="style4">
<asp:CustomValidator ID="CustomValidator1" runat="server"
ControlToValidate="txt_password" Display="Dynamic"
ErrorMessage="Invalid password" ForeColor="Red"
onservervalidate="CustomValidator1_ServerValidate"
SetFocusOnError="True"
ValidateEmptyText="True">Invalid password</asp:CustomValidator>
</td>
</tr>
<tr>
<td class="style6">
Confirm Password</td>
<td class="style7">
<asp:TextBox ID="confirmbox" runat="server" Width="190px"
TextMode="Password"></asp:TextBox>
</td>
<td class="style8">
<asp:CompareValidator ID="CompareValidator1" runat="server"
ControlToCompare="txt_password" ControlToValidate="confirmbox"
Display="Dynamic" ErrorMessage="Password mismatch"
ForeColor="Red"
SetFocusOnError="True">Password mismatch</asp:CompareValidator>
</td>
</tr>
<tr>
<td class="style2">
Email Id</td>
<td class="style5">
<asp:TextBox ID="txt_emailid" runat="server"
Width="191px"></asp:TextBox>
</td>
<td class="style4">
<asp:RegularExpressionValidator ID="RegularExpressionValidator1"
runat="server"
ControlToValidate="txt_emailid" Display="Dynamic"
ErrorMessage="Invalid Emailid" ForeColor="Red"
SetFocusOnError="True"
ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\
w+)*">Invalid Emailid</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="style2">
DOB</td>
<td class="style5">
<asp:TextBox ID="dob" runat="server" ontextchanged="dob_TextChanged"
Width="191px"></asp:TextBox>
</td>
<td class="style4">
<asp:RangeValidator ID="RangeValidator1" runat="server"
ControlToValidate="dob"
Display="Dynamic" ErrorMessage="Age between 18-45"
ForeColor="Red"
SetFocusOnError="True" Type="Date">Age between
18-45</asp:RangeValidator>
</td>
</tr>
<tr>
<td class="style2">
Country</td>
<td class="style5">
<asp:DropDownList ID="Countryselect" runat="server" >
<asp:ListItem Value="Select">Select a country</asp:ListItem>
<asp:ListItem>India</asp:ListItem>
<asp:ListItem>USA</asp:ListItem>
<asp:ListItem>Canada</asp:ListItem>
<asp:ListItem>Dubai</asp:ListItem>
<asp:ListItem>China</asp:ListItem>
</asp:DropDownList>
</td>
<td class="style4">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="Countryselect" Display="Dynamic"
ErrorMessage="country required" ForeColor="Red" InitialValue="Select"
SetFocusOnError="True">*</asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="style2">
Mobile no:</td>
<td class="style5">
<asp:TextBox ID="phno" runat="server" Width="189px"></asp:TextBox>
</td>
<td class="style4">
<asp:RegularExpressionValidator ID="RegularExpressionValidator2"
runat="server"
ControlToValidate="phno" Display="Dynamic"
ErrorMessage="RegularExpressionValidator" ForeColor="Red"
SetFocusOnError="True" ValidationExpression="\d{10}">10 digit mobile
no</asp:RegularExpressionValidator>
</td>
</tr>
</table>

</div>
<asp:Button ID="Button1" runat="server" Text="submit" />
</form>
</body>
</html>

11 Create a web application using master page or which displays course list on left pane
on selecting the course its content.
MasterPage.master
<%@ Master Language="C#" AutoEventWireup="true"
CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>

<!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>
<asp:ContentPlaceHolder id="head" runat="server">
</asp:ContentPlaceHolder>
<style type="text/css">
.style1
{
width: 900px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table align="center" class="style1">
<tr>
<td>
<asp:Image ID="Image1" runat="server" Height="229px"
ImageUrl="~/images/dog.jfif" Width="897px" />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
</td>
</tr>
<tr>
<td>
<asp:ContentPlaceHolder ID="ContentPlaceHolder2" runat="server">
</asp:ContentPlaceHolder>
</td>
</tr>
<tr>
<td>
<asp:Image ID="Image2" runat="server" Height="150px"
ImageUrl="~/images/dog2.jfif" Width="25%" />
</td>
</tr>
</table>
<asp:ContentPlaceHolder id="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>

home.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"


AutoEventWireup="true" CodeFile="home.aspx.cs" Inherits="home" %>

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


<style type="text/css">
.style2
{
width: 100%;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
<table class="style2">
<tr>
<td>
<h2>Welcome to DoggieBoogie.com</h2></td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>
<td>
&nbsp;</td>
</tr>
<tr>

nested.master
<%@ Master Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true" CodeFile="nested.master.cs" Inherits="nested" %>

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


<style type="text/css">
.style4
{
width: 100%;
}
.style5
{
width: 361px;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"
Runat="Server">
<table class="style4">
<tr>
<td class="style5" style="vertical-align:top">
<asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click"
PostBackUrl="~/home.aspx" >Home</asp:LinkButton>
</td>
<td style="vertical-align:top">
<table class="style4">
<tr>
<td>
&nbsp;</td>
</tr>
</table>
</td>
</tr>
<tr>
<td class="style5" style="vertical-align:top">
<asp:LinkButton ID="LinkButton2" runat="server"
PostBackUrl="~/About.aspx">Aboutus</asp:LinkButton>
</td>
<td style="vertical-align:top">
&nbsp;</td>
</tr>
<tr>
<td class="style5" style="vertical-align:top">
<asp:LinkButton ID="LinkButton3" runat="server"
PostBackUrl="~/Default.aspx">Contact</asp:LinkButton>
</td>
<td style="vertical-align:top">
&nbsp;</td>
</tr>
<tr>
<td class="style5" style="vertical-align:top">
<asp:LinkButton ID="LinkButton4" runat="server"
PostBackUrl="~/Default3.aspx">Jobs</asp:LinkButton>
</td>
<td style="vertical-align:top">
&nbsp;</td>
</tr>
</table>
</asp:Content>

Default2.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/nested.master"


AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %>

About.aspx

<%@ Page Title="About Us" Language="C#" MasterPageFile="~/MasterPage.master"


AutoEventWireup="true"
CodeFile="About.aspx.cs" Inherits="About" %>

<asp:Content ID="BodyContent" runat="server"


ContentPlaceHolderID="ContentPlaceHolder2">
<h2>
About
</h2>
<p>
<h2>This website gives you a list of food dogs can have
And helps you to know , how to take care of your dog</h2>
</p>
</asp:Content>
Default3.aspx

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master"


AutoEventWireup="true" CodeFile="Default3.aspx.cs" Inherits="Default3" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2"


Runat="Server">
<h2>To apply for jobs in our organisation</h2>
<h3>Send your resume to<br />email:doggieofficial@gmail.com</h3>
</asp:Content>
Default.aspx
<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/MasterPage.master"
AutoEventWireup="true"
CodeFile="Default.aspx.cs" Inherits="_Default" %>

<asp:Content ID="ContentPlaceHolder1" runat="server"


ContentPlaceHolderID="ContentPlaceHolder2">
<h2>
Contact Us
</h2>
<p>
<H3> PH NO: 9365402468</H3>
</p>
<p>
<h3> EMAIL: doggieboogie@gmail.com</h3>
</p>
</asp:Content>
12 Create a web application using master page with a title DATA CENTER. In which
display the employee information. Display the table data selected from databases in grid
view control with add, edit, delete records.

You might also like