AWD Document
AWD Document
BY
Seat Number:
CERTIFICATE
This is to certify that the work entered in this journal is the work of Shri NAYAK MONIKA
RAVINDRA of T.Y.B.Sc.IT , division Information Technology , Subject: Advanced Web
Development, Roll No. 24 Uni. Exam No_____ has satisfactorily completed the required
number of practical and worked for the terms of the Year 2024-25 in the college laboratory
as laid down by the university.
namespace Practical1_A
{
class Program1
{
static void Main(string[] args)
{
int n1, n2;
Console.ReadKey();
}
}
}
Output:
namespace Practical1_B
{
class Program2
{
static void Main(string[] args)
{
int row,num=1;
Console.Write("\n");
for (int i=1; i<=row;i++)
{
for(int j=1; j<=i;j++)
{
Console.Write(num + "\t");
num++;
}
Console.Write("\n");
}
Console.ReadKey();
}
}
}
Output:
namespace Practical1_C
{
class Program3
{
static void Main(string[] args)
{
int a = 0, b = 1, c,num,count=1;
while (count<=num)
{
Console.Write(a +"\t");
c=a+b;
a = b;
b = c;
count++;
}
Console.ReadKey();
}
}
}
Output:
namespace Practical1_C {
class Program {
static void Main(string[] args) {
int num;
Boolean prime=true;
Console.ReadKey();
}
}
}
Output:
namespace Practical2_A
{
class Program1
{
static void Main(string[] args)
{
int num = 17;
object boxednum = num;
double ux = (double)bx;
Console.ReadKey();
}
}
}
Output:
namespace Practical2_B
{
class Program
{
delegate float Calculater(float a, float b);
static void Main(string[] args)
{
Calculater add = Add;
Calculater sub = Sub;
Console.WriteLine($"\nAddition is : {addition}");
Console.WriteLine($"Subtraction is : {subtraction}");
Console.ReadKey();
}
static float Add(float a, float b)
{
return a + b;
}
static float Sub(float a, float b)
{
return a - b;
} }
}
Output:
Console.WriteLine($"Area of Rectangle is :
{rect_area}");
Console.WriteLine($"Area of Circle is : {circle_area}");
Console.ReadKey();
}
}
}
Output:
Program_3A.aspx.cs
using System;
namespace Practical_3_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)
{
String s;
Output:
Practical3_B.aspx.cs
using System;
namespace Practical_3B
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
e.Cell.Controls.Add(new LiteralControl
("<br> Study Vacation"));
}
}
}
}
Output:
Practical3_C.aspx.cs
using System;
namespace Practical_3C
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
Output:
Practical4_A.aspx
Design:
Components: labels, textbox, button, Validaters [RequiredFieldValidator,
RangeValidator, CompareValidator, RegularExpressionValidator].
Steps: 1] in Web.config file add lines “ <addSettings> <add key =
’ValidationSettings : UnobtrusiveValidationMode‘ value=’None’/>
</appSettings> “
Practical4_A.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication16
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
XMLFile.xml
<?xml version="1.0" encoding="utf-8" ?>
<Advertisements>
<Ad>
<ImageUrl>Drone.jpg</ImageUrl>
<AlternetText>Autnomous Drone</AlternetText>
<Impressions>50</Impressions>
<Keyword>Drone</Keyword>
</Ad>
<Ad>
<ImageUrl>Car.jpg</ImageUrl>
<AlternetText>Autonomous Car</AlternetText>
<Impressions>50</Impressions>
<Keyword>Car</Keyword>
</Ad>
Output:
usercontrol.aspx
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<br />
<asp:Label ID="Label1" runat="server"
Text="Enter Name :"></asp:Label>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1"
runat="server" OnClick="Button1_Click"
style="height: 35px" Text="Submit" />
<br />
<br />
<asp:Label ID="Label2" runat="server"></asp:Label>
<br />
<br />
<uc1:WebUserControl runat="server" id="WebUserControl1"/>
</form>
</body>
</html>
Practical4_C.aspx.cs
using System;
namespace Practical_4C
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
usercontrol_C.aspx.cs
using System;
namespace Practical_4C
{
public partial class WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
Output:
Help_page.aspx
Design:
Output:
Webform2.aspx
namespace WebApplication7
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (IsPostBack)
{
if(ViewState["count"] != null)
{
int ViewstateVal = Convert.ToInt32
(ViewState["count"]) + 1;
else
{
ViewState["count"] = "1";
}
}
}
h.Value = TextBox1.Text;
Response.Cookies.Add(h);
Response.Redirect("WebForm2.aspx");
}
}
}
Output:
Database:
Output:
Insert data:
Delete data:
Database:
Practical6_B.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;
using System.Data.SqlClient;
namespace WebApplication25
{
public partial class WebForm1 : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("Data Source=DESKTOP-
AV1M30G \\SQLEXPRESS;Initial Catalog=tyit;Integrated
Security=True");
SqlDataAdapter da;
protected void Page_Load(object sender, EventArgs e)
{
GridView1.DataSource = ds;
GridView1.DataBind();
}
}
}
Output:
Practical7_A.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication12
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
HttpCookie c1 = new HttpCookie("creater");
Label1.Text=author;
Response.Cookies["comp"].Expires =
DateTime.Now.AddDays(-1);
if (CheckBox2.Checked == true)
{
Response.Cookies["comp"]["Apple"] = "Apple";
}
if (CheckBox3.Checked == true)
{
Response.Cookies["comp"]["Lenevo"] = "Lenevo";
}
if (CheckBox4.Checked == true)
{
Response.Cookies["comp"]["Acer"] = "Acer";
}
if(Request.Cookies["comp"].Values.ToString() != null)
{
if(Request.Cookies["comp"]["Dell"] != null)
{
Label3.Text += Request.Cookies["comp"]
["Dell"] + " " ;
}
if (Request.Cookies["comp"]["Apple"] != null)
{
Label3.Text += Request.Cookies["comp"]
["Apple"] + " ";
}
if (Request.Cookies["comp"]["Lenevo"] != null)
if (Request.Cookies["comp"]["Acer"] != null)
{
Label3.Text += Request.Cookies["comp"]
["Acer"] + " ";
}
}
else
{
Label3.Text = "Please Select Company";
}
Response.Cookies["comp"].Expires =
DateTime.Now.AddDays(-1);
}
}
}
Output:
WebForm2.aspx
Design:
namespace WebApplication13
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (uname == "Ram")
{
if (pass == "ram123")
{
return true;
}
}
return false;
}
protected void Button1_Click(object sender, EventArgs e)
{
if (authenticate(TextBox1.Text,TextBox2.Text))
{
FormsAuthentication.RedirectFromLoginPage(
TextBox1.Text, CheckBox1.Checked);
Session["Username"] = TextBox1.Text;
Response.Redirect("Webform2.aspx");
else
{
Response.Write("Invalid UserName or Password.");
}
}
}
}
Output:
If User is vaild:
If User is Invaild:
Database:
Practical8_A.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;
using System.Data.SqlClient;
namespace Practical_8A
{
public partial class WebForm1 : System.Web.UI.Page
{
SqlConnection cn = new SqlConnection("Data Source=DESKTOP-
AV1M30G \\SQLEXPRESS;Initial Catalog=tyit;Integrated
Security=True");
SqlCommand co = new SqlCommand();
SqlDataReader ds;
SqlParameter @p1, @p2, @p3, @p4;
co.Parameters.AddWithValue("@p1",TextBox1.Text);
co.Parameters.AddWithValue("@p2", TextBox2.Text);
co.Parameters.AddWithValue("@p3", TextBox3.Text);
co.Parameters.AddWithValue("@p4", TextBox4.Text);
TextBox1.Text = null;
TextBox2.Text = null;
TextBox3.Text = null;
TextBox4.Text = null;
}
protected void Button2_Click(object sender, EventArgs e)
{
co.CommandText = "delete from Student where Id='"
+ TextBox1.Text +"';";
co.ExecuteNonQuery();
TextBox1.Text = null;
TextBox2.Text = null;
TextBox3.Text = null;
TextBox4.Text = null;
}
protected void Button3_Click(object sender, EventArgs e)
{
co.CommandText = "Select * from Student;";
}
}
}
Output:
Insert:
Practical8_B.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace WebApplication24
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
try
{
throw new UserDefinedException
("New User Defined Exception");
}
catch (Exception ex)
Output:
Practical9_A.aspx
Design:
namespace WebApplication23
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
}
}
Output:
Insert:
Update: