1) DESIGN ASP.
NET WEB FROM USING HTML SERVER CONTROLS TO ENTER JOB SEEKERS DETAIL
INPUT:
<html>
<body>
@{
if (IsPost)
{
string companyname = Request["CompanyName"];
string contactname = Request["ContactName"];
<p>You entered: <br>
Company Name: @companyname <br>
Contact Name: @contactname </p>
}
else
{
<form method="post" action="">
Company Name:<br>
<input type="text" name="CompanyName" value=""><br>
Contact Name:<br><br>
<input type="text" name="ContactName" value=""><br><br>
<input type="submit" value="Submit" class="submit">
</form>
}
}
</body>
</html>
OUTPUT:
2) Write An [Link] Application To Retrive Form Date And Display It Hte Client Browser In A Table
Format
INPUT:
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="[Link]"
Inherits="[Link]" %>
<!DOCTYPE html>
<html xmlns="[Link]
<head runat="server">
<title></title>
<style type="text/css">
.auto-style1 {
width: 100%;
}
.auto-style2 {
width: 100px;
}
.auto-style3 {
width: 95px;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="auto-style1">
<tr>
<td class="auto-style2">
<asp:Label runat="server" Text="User Name" ID="usernamelabelId"></asp:Label></td>
<td>
<asp:TextBox ID="UsernameId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label runat="server" Text="Email ID"></asp:Label></td>
<td>
<asp:TextBox ID="EmailId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="auto-style2">
<asp:Label runat="server" Text="Contact"></asp:Label></td>
<td>
<asp:TextBox ID="ContactId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td class="auto-style2"></td>
<td>
<asp:Button ID="ButtonId" runat="server" Text="Submit" OnClick="ButtonId_Click" /></td>
</tr>
</table>
</div>
<div>
<asp:Label ID="Label1" runat="server"></asp:Label>
</div>
</form>
<table class="auto-style1">
<tr>
<td class="auto-style3">
<asp:Label ID="Label2" runat="server"></asp:Label></td>
<td>
<asp:Label ID="Label5" runat="server"></asp:Label></td>
</tr>
<tr>
<td class="auto-style3">
<asp:Label ID="Label3" runat="server"></asp:Label></td>
<td>
<asp:Label ID="Label6" runat="server"></asp:Label></td>
</tr>
<tr>
<td class="auto-style3">
<asp:Label ID="Label4" runat="server"></asp:Label></td>
<td>
<asp:Label ID="Label7" runat="server"></asp:Label></td>
</tr>
</table>
</body>
</html>
OUTPUT:
3) Create an application using Date grid control to access information’s from table in SQL Server.
INPUT:
using [Link];
using [Link];
using [Link];
namespace DataGridSQLExample
{
/// <summary>
/// Interaction logic for [Link]
/// </summary>
public partial class MainWindow : Window
{
AdventureWorksLT2008Entities dataEntities = new AdventureWorksLT2008Entities();
public MainWindow()
{
InitializeComponent();
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
var query =
from product in [Link]
where [Link] == "Red"
orderby [Link]
select new { [Link], [Link], CategoryName = [Link],
[Link] };
[Link] = [Link]();
}
}
}
OUTPUT:
4) Create an application using Data grid control to access information’s from table in SQL server.
INPUT:
private void btnRefresh_Click(object sender, EventArgs e)
{
//set the connection string
string connString = @"Server =.\SQL2K17; Database = SampleDB; Trusted_Connection =
True;"try
{
//sql connection object
using (SqlConnection conn = new SqlConnection(connString))
{
//retrieve the SQL Server instance version
string query = @"SELECT [Link],
[Link],
[Link],
[Link],
[Link] AS locationCode,
[Link] AS locationDescr
FROM [Link] e
INNER JOIN [Link] l
ON [Link] = [Link];"//define the SqlCommand object
SqlCommand cmd = new SqlCommand(query, conn);
//Set the SqlDataAdapter object
SqlDataAdapter dAdapter = new SqlDataAdapter(cmd);
//define dataset
DataSet ds = new DataSet();
//fill dataset with query results
[Link](ds);
//set DataGridView control to read-only
[Link] = true//set the DataGridView control's data source/data
table
[Link] = [Link][0];
//close connection
[Link]();
}
}
catch (Exception ex)
{
//display error message
[Link]("Exception: " + [Link]);
}
}
OUTPUT:
5) Create an application using Data list control to access information’s from table in SQL Server and display the
result in neat format.
INPUT:
1. using System;
2. using [Link];
3. using [Link];
4. using [Link];
5. using [Link];
6. using [Link];
7. using [Link];
8. using [Link];
9. using [Link];
10.
11. public partial class UI_DataList : [Link]
12. {
13. string connection = [Link]["connstring"].C
onnectionString;
14. protected void Page_Load(object sender, EventArgs e)
15. {
16. if (!IsPostBack)
17. {
18. GetEmpDataList();
19. }
20. }
21. protected void btnSave_Click(object sender, EventArgs e)
22. {
23. using (SqlConnection con = new SqlConnection(connection))
24. {
25. using (SqlCommand cmd = new SqlCommand("sp_InsertEmployeeData",
con))
26. {
27. [Link] = [Link];
28.
29. [Link]("@EmpName", [Link]).V
alue = [Link]();
30. [Link]("@Contact", [Link]).Value
= [Link]();
31. [Link]("@EmailId", [Link]).Val
ue = [Link]();
32.
33. [Link]();
34. [Link]();
35. [Link]();
36.
37. Clear();
38. [Link]("<script type=\"text/javascript\">alert('Record Insert
ed Successfully');</script>");
39. GetEmpDataList();
40. }
41. }
42. }
43. void Clear()
44. {
45. [Link] = [Link];
46. [Link] = [Link];
47. [Link] = [Link];
48. }
49. private void GetEmpDataList()
50. {
51. using (SqlConnection con = new SqlConnection(connection))
52. {
53. SqlDataAdapter sd = new SqlDataAdapter("sp_FillData", con);
54. [Link] = [Link];
55. DataTable dt = new DataTable();
56.
57. [Link](dt);
58.
59. if ([Link] > 0)
60. {
61. [Link] = dt;
62. [Link]();
63. }
64. }
65. }
66. protected void DataListEmp_DeleteCommand(object source, DataListComman
dEventArgs e)
67. {
68. int EmpID = Convert.ToInt32([Link][[Link]].ToSt
ring());
69.
70. using (SqlConnection con = new SqlConnection(connection))
71. {
72. using (SqlCommand cmd = new SqlCommand("sp_DeleteEmployeeData",
con))
73. {
74. [Link] = [Link];
75. [Link]("@EmpID",EmpID);
76.
77. [Link]();
78. [Link]();
79. [Link]();
80.
81. [Link]("<script type=\"text/javascript\">alert('Record Delete
d Successfully');</script>");
82. GetEmpDataList();
83. }
84. }
85. }
86. protected void DataListEmp_EditCommand(object source, DataListCommandE
ventArgs e)
87. {
88. [Link] = [Link];
89. GetEmpDataList();
90. }
91. protected void DataListEmp_CancelCommand(object source, DataListComma
ndEventArgs e)
92. {
93. [Link] = -1;
94. GetEmpDataList();
95. }
96. protected void DataListEmp_UpdateCommand(object source, DataListComma
ndEventArgs e)
97. {
98. int EmpID = Convert.ToInt32([Link][[Link]].ToS
tring());
99.
100. TextBox txtName = (TextBox)[Link]("txtName");
101. TextBox txtContact = (TextBox)[Link]("txtContact");
102. TextBox txtEmail = (TextBox)[Link]("txtEmail");
103.
104. using (SqlConnection con = new SqlConnection(connection))
105. {
106. using (SqlCommand cmd = new SqlCommand("sp_UpdateEmployeeData
", con))
107. {
108. [Link] = [Link];
109.
110. [Link]("@EmpID", EmpID);
111. [Link]("@EmpName", [Link]).V
alue = [Link]();
112. [Link]("@Contact", [Link]).Value
= [Link]();
113. [Link]("@EmailId", [Link]).Val
ue = [Link]();
114.
115. [Link]();
116. [Link]();
117. [Link]();
118.
119. Clear();
120. [Link]("<script type=\"text/javascript\">alert('Record Updat
e Successfully');</script>");
121. [Link] = -1;
122. GetEmpDataList();
123. }
124. }
125. }
126. }
OUTPUT: