6429 AWP Journal
6429 AWP Journal
DEPARTMENT OF INFORMATION
TECHNOLOGY
2024- 2025
Create an application that obtains four int values from the user
a. and displays the product. 25/6/2024
Create an application that receives the (Student Id, Student
b. Name, Course Name, Date of Birth) information from a set of 25/6/2024
students. The application should also display the information of
all the students once the data entered.
2. Working with Object Oriented C# and ASP .NET
c. Create a web application for inserting and deleting record from 20/8/2024
database.(Using Execute-Non Query)
Practical No:1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication3
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Code:
Output:
(C):Check whether the given number is prime or not
INPUT :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_Prime
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (num <= 1)
{
TextBox2.Text = num + " is neither prime nor composite ";
return;
}
OUTPUT :
Practical No:2
Working with Object Oriented C# and ASP .NET
Money Convertor
INPUT :
using System;
public CurrencyConverter()
{
dollars = 0;
euros = 0;
rupees = 0;
}
Dollars to Rupees :
Rupees to Dollars :
Euros to Rupees :
Rupees to Euro :
INPUT :
using System;
using System.Collections.Generic;
using System.Dynamic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 6429
{
public partial class WebForm1 : System.Web.UI.Page
{
convertTemp c;
protected void Page_Load(object sender, EventArgs e)
{
c = new convertTemp();
}
protected void Button1_Click(object sender, EventArgs e)
{
char ch;
ch = Convert.ToChar(TextBox1.Text);
if (ch == 'c')
{
c.celsius = float.Parse(TextBox2.Text);
c.convertToFaren();
TextBox3.Text= "celsius to faren "+c.faren;
}
if (ch == 'f')
{
c.faren = float.Parse(TextBox2.Text);
c.convertToCelsius();
TextBox3.Text = " faren to celsius " + c.celsius;
}
}
}
}
OUTPUT :
Faren to Celsius :
Celsius to Faren :
Practical No:3
Working with Web Forms and Controls
INPUT:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_3_A
{
public partial class Nilesh_Calendar : System.Web.UI.Page
{
protected void Calendar1_DayRender(Object sender,
System.Web.UI.WebControls.DayRenderEventArgs e)
{
if (e.Day.Date.Day == 5 && e.Day.Date.Month == 9)
{
e.Cell.BackColor = System.Drawing.Color.Yellow;
Label lbl = new Label();
lbl.Text = "<br>Teachers Day</br>";
e.Cell.Controls.Add(lbl);
}
if (e.Day.Date.Day == 13 && e.Day.Date.Month == 9)
{
Calendar1.SelectedDate = new DateTime(2024, 9, 12);
Calendar1.SelectedDates.SelectRange(Calendar1.SelectedDate,
Calendar1.SelectedDate.AddDays(10));
Label lbl1 = new Label();
lbl1.Text = "<br> Ganpati ";
e.Cell.Controls.Add(lbl1);
}
}
protected void Calendar1_SelectionChanged(object sender, EventArgs e)
{
Label1.Text = "Your Selected Date " +
Calendar1.SelectedDate.Date.ToString();
}
protected void Button1_Click(object sender, EventArgs e)
{
Calendar1.FirstDayOfWeek = FirstDayOfWeek.Sunday;
Calendar1.NextPrevFormat = NextPrevFormat.ShortMonth;
Calendar1.TitleFormat = TitleFormat.Month;
Label2.Text = "Today's Date: " + Calendar1.TodaysDate.ToShortDateString();
Label3.Text = "Ganpati vacation start: 07-09-2024";
TimeSpan d = new DateTime(2024, 9, 7) - Calendar1.SelectedDate;
Label4.Text = "Days remaining for Ganpati Vacation: " + d.Days.ToString();
TimeSpan d1 = new DateTime(2024, 12, 31) - Calendar1.SelectedDate;
Label5.Text = "Days remaining for New Year: " + d1.Days.ToString();
if (Calendar1.SelectedDate.ToShortDateString() == "7-9-2024")
Label3.Text = "<br>Ganpati Festival Start</br>";
if (Calendar1.SelectedDate.ToShortDateString() == "16-9-2024")
Label3.Text = "<br>Ganpati Festival End</br>";
}
protected void Button2_Click(object sender, EventArgs e)
{
Label1.Text = "";
Label2.Text = "";
Label3.Text = "";
Label4.Text = "";
Label5.Text = "";
Calendar1.SelectedDates.Clear();
}
}
}
OUTPUT:
On click of Submit:
On click of Reset:
B)Demonstrate the use of Treeview control performs the following operations.
a) Treeview control and datalist
b) Treeview operations
DESIGN:
INPUT:
Tree_Structure.aspx :
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="Tree_Structure.aspx.cs"
Inherits="Tree_Structure_6429.Tree_Structure" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<asp:TreeView ID="TreeView1" runat="server">
<Nodes>
<asp:TreeNode
ImageUrl="https://www.tutorialspoint.com/computer_programming/index.htm"
Text="PROGRAMMING LANGUAGES" Value="PROGRAMMING
LANGUAGES">
<asp:TreeNode NavigateUrl="https://www.w3schools.com/cpp/"
Text="C++" Value="C++"></asp:TreeNode>
<asp:TreeNode NavigateUrl="https://www.w3schools.com/java/"
Text="JAVA" Value="JAVA"></asp:TreeNode>
</asp:TreeNode>
<asp:TreeNode NavigateUrl="https://www.javatpoint.com/operating-
system" Text="OPERATING SYSTEM" Value="OPERATING SYSTEM">
<asp:TreeNode
NavigateUrl="https://www.microsoft.com/en-in/windows?r=1"
Text="WINDOWS" Value="WINDOWS"></asp:TreeNode>
<asp:TreeNode
NavigateUrl="https://support.apple.com/en-in/macos" Text="MAC"
Value="LINUX"></asp:TreeNode>
</asp:TreeNode>
</Nodes>
</asp:TreeView>
<asp:Label ID="Label1" runat="server" Text="Fetch data list Using XML
Data :"></asp:Label>
<div>
<asp:DataList ID="DataList1" runat="server"
OnSelectedIndexChanged="DataList1_SelectedIndexChanged">
<ItemTemplate>
<table class="table" border="1">
<tr>
<td>Roll Num : <%#Eval("sid") %><br/>
Name : <%#Eval("sname") %>
Class : <%#Eval("sclass") %>
</td>
</tr>
</table>
</ItemTemplate>
</asp:DataList>
</div>
</form>
</body>
</html>
Tree_Structure.aspx.cs :
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Tree_Structure_6429
{
public partial class Tree_Structure : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
{
BindData();
}
}
protected void BindData()
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("Tree_Structure.xml"));
if(ds!=null && ds.HasChanges())
{
DataList1.DataSource = ds;
DataList1.DataBind();
}
else
{
DataList1.DataBind();
}
}
protected void DataList1_SelectedIndexChanged(object sender, EventArgs
e)
{
}
}
}
Tree_Structure.xml :
<?xml version="1.0" encoding="utf-8" ?>
<studentdetail>
<student>
<sid>1</sid>
<sname>Pratham</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>2</sid>
<sname>Nilesh</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>3</sid>
<sname>Devdas</sname>
<sclass>TYIT</sclass>
</student>
<student>
<sid>4</sid>
<sname>Chetan</sname>
<sclass>TYIT</sclass>
</student>
</studentdetail>
OUTPUT:
Practical No:4
INPUT :
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace 6429_Validation
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
OUTPUT :
B)Create a web form to demonstrate use of Adrotator Control.
DESIGN:
WebForm1.aspx.cs:
INPUT :
<NavigateUrl>https://www.instagram.com/accounts/login/</NavigateUrl>
<AlternateText>Instagram</AlternateText>
<Impressions>20</Impressions>
<Keyword>instagram</Keyword>
</Ad>
<Ad>
<ImageUrl>whatsapp.png</ImageUrl>
<NavigateUrl>https://www.whatsapp.com/</NavigateUrl>
<AlternateText>WhatsApp</AlternateText>
<Impressions>20</Impressions>
<Keyword>whatsapp</Keyword>
</Ad>
<Ad>
<ImageUrl>telegram.jpg</ImageUrl>
<NavigateUrl>https://web.telegram.org/k/</NavigateUrl>
<AlternateText>Telegram</AlternateText>
<Impressions>20</Impressions>
<Keyword>telegram</Keyword>
</Ad>
</Advertisements>
OUTPUT :
Practical No.05
DESIGN:
INPUT:
WebUserControl1.ascx
<%@ Page Language="C#" AutoEventWireup="true"
CodeBehind="WebForm1.aspx.cs" Inherits="_6429_Niles.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
Name <asp:TextBox ID="TextBox2"
runat="server"></asp:TextBox><br />
</div>
</form>
</body>
</html>
Webform.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection.Emit;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_Niles
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
Label1.Text = "My Name is " + TextBox2.Text + " I am from " +
TextBox1.Text;
}
}
}
WebForm1.aspx:
<<%@ Register Src="~/WebUserControl1.ascx" TagPrefix="uc"
TagName="Student" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<uc:Student ID="studentcontrol" runat="server" />
</div>
</form>
</body>
</html>
Just add the above highlighted line in the “WebForm1.aspx” file to connect the
user control with the web Form.
OUTPUT:
PRACTICAL NO.06
INPUT:
Site1.Master:
<%@ Master Language="C#" AutoEventWireup="true"
CodeBehind="Site1.master.cs" Inherits="_6429_MasterPage.Site1" %>
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
<asp:ContentPlaceHolder ID="head" runat="server">
</asp:ContentPlaceHolder>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>Different Programming Languages</h1>
<a href="WebForm1.aspx">C Sharp</a>
<a href="WebForm4.aspx">Java</a>
<a href="WebForm5.aspx">Javascript</a>
<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">
</asp:ContentPlaceHolder>
</div>
</form>
</body>
</html>
WebForm1.aspx:
</p>
</asp:Content>
WebForm4.aspx:
Below is the Master page output which will be displayed on all the
WebForm Pages no separate page is there as it is the master page :
PRACTICAL NO.07
Working with Database
INPUT:
Creating database name tyit and table Student in that database-
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs"
Inherits="sqlServerOverview.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"
OnTextChanged="TextBox1_TextChanged"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" />
<asp:ListBox ID="ListBox1" runat="server"></asp:ListBox>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:StudentConnectionString %>" ProviderName="<%$
ConnectionStrings:StudentConnectionString.ProviderName %>" SelectCommand="SELECT
* FROM [tyit]"></asp:SqlDataSource>
</div>
</form>
</body>
</html>
Note
Data Source=.;Initial Catalog=Student;Integrated Security=True;Trust Server
Certificate=True
StudentConnectionString
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;
namespace WebApplication20
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("Xml.file1.xml"));
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Button ID="Button1" runat="server" Text="Read XML" OnClick="Button1_Click"
/>
<asp:GridView ID="GridView1" runat="server">
<Columns>
<asp:BoundField DataField="Name" HeaderText="Name"></asp:BoundField>
<asp:BoundField DataField="Age" HeaderText="Age"></asp:BoundField>
</Columns>
</asp:GridView>
<asp:Button ID="Button2" runat="server" Text="Write XML"
OnClick="Button2_Click"/>
</div>
</form>
</body>
</html>
STEPS TO FOLLOW IN DESIGN:
For ListBox:
The size of ListBox is increased because I had added the height in its tag:
namespace _6429_7_A
{
public partial class WebForm1 : System.Web.UI.Page
{
}
}
}
OUTPUT:
B)Create a web application to display records using a database.
DESIGN:
INPUT:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_7_B
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
OUTPUT:
PRACTICAL NO.08
DESIGN:
On INPUT Screen:
On Browser:
B)Create a web application to display Data Binding using Dropdownlist
control
DESIGN:
INPUT:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection.Emit;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_8_B
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack == false)
{
string connStr =
ConfigurationManager.ConnectionStrings["NileshConnectionString"].Connecti
onString;
SqlConnection con = new SqlConnection(connStr);
SqlCommand cmd = new SqlCommand("Select Distinct FirstName
from Student", con);
con.Open();
SqlDataReader reader = cmd.ExecuteReader();
DropDownList1.DataSource = reader;
DropDownList1.DataTextField = "FirstName";
DropDownList1.DataBind();
reader.Close();
con.Close();
}
}
}
}
}
OUTPUT:
C)Create a web application for inserting and deleting records from the database.
(Using Execute-Non Query)
DESIGN:
INPUT:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.Linq;
using System.Reflection.Emit;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_8_C
{
public partial class WebForm1 : System.Web.UI.Page
string collegeConnectionString =
ConfigurationManager.ConnectionStrings["NileshConnectionString"].ConnectionStri
ng;
cmd.Parameters.AddWithValue("@ID", TextBox1.Text);
cmd.Parameters.AddWithValue("@FirstName", TextBox2.Text);
cmd.Parameters.AddWithValue("@LastName", TextBox3.Text);
cmd.Parameters.AddWithValue("@Age", TextBox4.Text);
con.Open();
cmd.ExecuteNonQuery();
con.Close();
string collegeConnectionString =
ConfigurationManager.ConnectionStrings["NileshConnectionString"].ConnectionStri
ng;
con.Open();
cmd.ExecuteNonQuery();
con.Close();
}
OUTPUT:
For Inserting-
DESIGN:
Before this add the connection string in GridView Control and make the
changes in web.config file make ssl certificate yes instead of true by removing
all the spaces.
DESIGN:
DESIGN:
INPUT:
WebForm1.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.Xml;
using System.Data;
namespace _6429_10_A
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath("XMLFile1.xml"));
GridView1.DataSource = ds.Tables[0].DefaultView;
GridView1.DataBind();
}
}
}
XMLFile1.xml:
<?xml version="1.0" encoding="utf-8" ?>
<student>
<name>Devdas</name>
<age>19</age>
</student>
In the below GridView go to edit columns and then BoundField give
HeaderText and DataField value of GridView Control
OUTPUT:
DESIGN:
INPUT:
WebForm1.aspx.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace _6429_10_B
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
String time = DateTime.Now.ToLongTimeString();
Label2.Text = "Showing time from partial pannel" + time;
}
protected void Button2_Click(object sender, EventArgs e)
{
String time = DateTime.Now.ToLongTimeString();
Label3.Text = "Showing time from Total pannel" + time;
}
}
}
OUTPUT: