SlideShare a Scribd company logo
2
Most read
13
Most read
14
Most read
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Department of Computer Science and engineering
LAB MANUAL
For
SOFTWARE TECHNOLOGY LAB - 5
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 1
Aim:Writea program in ASP.netusing drop down list.
Source:
< %@ Page Language= "C#" % >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" >
< script runat = "server" >
protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs
e)
{
Label1.Text = "You selected: <br /> ItemText: " +
DropDownList1.SelectedItem.Text.ToString () + " < br /> Value: " +
DropDownList1.SelectedValue.ToString () + " < br / > Index: " +
DropDownList1.SelectedIndex.ToString ();
}
</ script>
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head runat = "server" >
< title >DropDownList Example: AutoPostBack,Index, Item, Value </title >
</ head>
< body>
< form id="form1" runat= "server" >
< div >
< asp:Label ID= "Label1" runat = "server" Font- Size= "Large" ForeColor ="Olive" />
< br />
< asp:Label ID= "Label2" runat = "server" Text= "Favorite Control?" AssociatedControlID =
" DropDownList1" >
</ asp:Label >
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
< asp:DropDownList ID= "DropDownList1" runat = "server" OnSelectedIndexChanged= "
DropDownList1_SelectedIndexChanged" AutoPostBack= "true" BackColor= "BurlyWood" >
< asp:ListItem Value= "Navigation ToolBox Control" > TreeView</asp:ListItem >
< asp:ListItem Value= "Standard ToolBox Control" > AdRotator </asp:ListItem >
< asp:ListItem Value= "Data ToolBox Control" > XmlDataSource </asp:ListItem >
< asp:ListItem Value= "Login ToolBox Control" > LoginView</asp:ListItem >
</ asp:DropDownList >
</ div>
</ form>
</ body>
</ html>
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 2
Aim:Writea program in ASP.netusing Listbox.
Source:
<head runat="server">
<title> AdvanceListBox</title>
</head>
<body >
<form id="form1" runat="server">
<div style="background-color:#CCFFCC; width:300px" >
<b style="background-color:Silver;" >ListBox Advance Functionality</b>
<br />
<br />
<asp:ListBox ID="lstBrowser" runat="server"Width="200px" SelectionMode="Multiple"
AutoPostBack="True” onselectedindexchanged="lstBrowser_SelectedIndexChanged">
</asp:ListBox>
<br />
<br />
<asp:Label ID="lblFilter" runat="server" Font- Bold="True" Text="Filter: "></asp:Label>
<asp:TextBox ID="txtFilter" runat="server">
</asp:TextBox>
<br />
<br />
<asp:Label ID="lbl" runat="server" Font-Bold="True" Text="Output:"></asp:Label>
<asp:Label ID="lblOutput" runat="server">
</asp:Label>
<br />
<br />
</div>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
<asp:Button ID="btnDelete" runat="server"OnClick="btnDelete_Click" Text="Multiple
Delete" />
<asp:Button ID="btnSort" runat="server" OnClick="btnSort_Click" Text="Sort" />
<asp:Button ID="btnSelectAll" runat="server" OnClick="btnSelectAll_Click"
Text="Select All" />
<br />
<asp:Button ID="btnSelectNone" runat="server” OnClick="btnSelectNone_Click"
Text="Select None" />
<asp:Button ID="btnFindIem" runat="server” OnClick="btnFindIem_Click" Text="Find
Item" />
</form>
</body>
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 3
Aim:Writea program in ASP.netusing eventsin textbox.
Source:
<% @Page Language="C#" %>
<script runat ="server" >
private void convertoupper ( object sender ,EventArgs e )
{
string str = mytext . Value;
changed_text . InnerHtml = str . ToUpper ();
}
</script>
<!-- Layout -->
<html>
<head> <title> Change to Upper Case </title> </head>
<body>
<h3> Conversion to Upper Case </h3>
<form runat ="server" >
<input runat = "server" id="mytext" type ="text" />
<input runat = "server" id="button1" type ="submit" value="Enter..."
OnServerClick =" convertoupper " />
<hr />
<h3> Results: </h3>
<span runat ="server" id= "changed_text" />
</form>
</body>
</html>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 4
Aim: Write a program in ASP.netusing Radio button.
Source:
<@ Page Language= "C#" % >
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1-transitional.dtd" >
< script runat = "server" >
protected void RadioButton_CheckedChanged(object sender,System.EventArgs e)
{
if ( RadioButton1.Checked == true)
{
Response.Write("You Selected: Asp.Net");
}
else
{
Response.Write("You Selected: ColdFusion");
}
}
</ script>
< html xmlns = "http://www.w3.org/1999/xhtml" >
< head runat= "server" >
< title > RadioButton example: how to use RadioButton control in asp.net </title >
</ head>
< body>
< form id= "form1" runat ="server" >
< div >
<asp:RadioButton ID="RadioButton1" runat = "server" Text= "Asp.Net" GroupName = "
Software" AutoPostBack= "true" OnCheckedChanged="RadioButton_ CheckedChanged" />
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
<asp:RadioButton ID="RadioButton2" runat = "server" Text= "ColdFusion"
GroupName ="Software" AutoPostBack= "true" OnCheckedChanged= "RadioButton_
CheckedChanged" />
</ div >
</ form>
</ body>
</ html>
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 5
Aim:Writea program in ASP.Netfor validationin textbox.
Source:
<asp:RegularExpressionValidatoR>
Maximum character length Validation (Maximum 8 characters allowed)
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox1"
ID="RegularExpressionValidator1" ValidationExpression = "^[sS]{0,8}$" runat="server"
ErrorMessage="Maximum 8 characters allowed."></asp:RegularExpressionValidator>
Minimum character length Validation (Minimum 8 characters required)
<asp:TextBox ID="TextBox2" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox2"
ID="RegularExpressionValidator2" ValidationExpression = "^[sS]{8,}$" runat="server"
ErrorMessage="Minimum 8 characters required."></asp:RegularExpressionValidator>
Minimum and Maximum character length Validation
(Minimum 5 and Maximum 8 characters required)
<asp:TextBox ID="TextBox3" runat="server"></asp:TextBox>
<asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox3"
ID="RegularExpressionValidator3" ValidationExpression = "^[sS]{5,8}$" runat="server"
ErrorMessage="Minimum 5 and Maximum 8 characters
required."></asp:RegularExpressionValidatoR>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 6
Aim:Writea program in ASP.Netusing Data List controls.
Source:
<asp:DataList ID="DataList1" runat="server">
<HeaderTemplate>
<table border="1">
<tr>
<th>Employee Code</th>
<th>Employee Name</th>
<th>Basic</th>
<th>Dept Code</th>
</tr>
</HeaderTemplate>
<ItemTemplate> <tr bgcolor="#0xbbbb">
<td> <%# DataBinder.Eval(Container.DataItem,"EmpCode")%> </td>
<td> <%# DataBinder.Eval(Container.DataItem, "EmpName")%> </td>
<td> <%# DataBinder.Eval(Container.DataItem, "Basic")%> </td>
<td> <%# DataBinder.Eval(Container.DataItem, "DeptCode")%> </td>
</tr>
</ItemTemplate>
<FooterTemplate>
</FooterTemplate>
</asp:DataList>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Output:
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Experiment 7-10
Aim:Writea program in ASP.netfor Insertion, Deletion, Updationand
searching using ADO.net.
Source:
ADO.NET Entity Framework is an powerful tools to developed applications. This tutorial will help
you to insert, update, delete, select, search data into SQL Server by using ADO.NET Entity
Framework. For this we will use two tables Students and Countries. We will save Student ID, Name,
Address, Phone and Country of a Student in Students table. In Countries table there will be some
predefined country data. We will show the entire country list in a DropDownList and student
list in a GridView. Summary of the articles are:
 UI Design
 Database Design
Creation of Entity Data Model
 Select Operation
 Insert Operation
 Update Operation
 Delete Operation
 Search Operation
UI Design
Create a new asp.net,C# project. Design your UI. You can use the following asp.net code.
<table>
<tr> <td style=”width: 120px”> Student ID </td>
<td> <asp:TextBox ID=”txtID” runat=”server” Enabled=”False”></asp:TextBox> </td>
</tr>
<tr> <td style=”width: 120px”> Student Name</td>
<td> <asp:TextBox ID=”txtName” runat=”server” Width=”250px”></asp:TextBox> </td>
</tr>
<tr>
<td> Address </td>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
<td> <asp:TextBox ID=”txtAddress” runat=”server” TextMode=”MultiLine”
Width=”250px”>
</asp:TextBox>
</td>
</tr>
<tr>
<td> Phone </td>
<td> <asp:TextBox ID=”txtPhone” runat=”server”> </asp:TextBox> </td>
</tr>
<tr>
<td> Country </td>
<td> <asp:DropDownList ID=”ddlCountry” runat=”server” Width=”200px”
DataSourceID=”EntityDataSource1″ DataTextField=”country_name”
DataValueField=”country_id”>
</asp:DropDownList>
</td>
</tr>
<tr>
<td> &nbsp;</td>
<td> <asp:Button ID=”btnAdd” runat=”server”Text=”Add” Width=”80px”
onclick=”btnAdd_Click” />
<asp:Button ID=”btnDelete” runat=”server” onclick=”btnDelete_Click” Text=”Delete”
Width=”80px” />
<asp:Button ID=”btnEdit” runat=”server” onclick=”btnEdit_Click” Text=”Edit”
Width=”80px” />
<asp:Button ID=”btnClear” runat=”server” onclick=”btnClear_Click” Text=”Clear”
Width=”80px” />
</td>
</tr>
<tr>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
<td> &nbsp;</td>
<td> &nbsp;</td>
</tr>
<tr>
<td> &nbsp; </td>
<td> <asp:TextBox ID=”txtSearch” runat=”server”>
</asp:TextBox>
<asp:Button ID=”btnSearch” runat=”server” onclick=”btnSearch_Click” Text=”Search”
Width=”80px” />
</td>
</tr>
</table>
<asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”False”
Width=”600px” AutoGenerateSelectButton=”True” onselectedindexchanged=”GridView1_
SelectedIndexChanged”>
<Columns>
<asp:BoundField DataField=”student_id” HeaderText=”ID” />
<asp:BoundField DataField=”student_name” HeaderText=”Name” />
<asp:BoundField DataField=”address” HeaderText=”Address” />
<asp:BoundField DataField=”phone” HeaderText=”Phone” />
<asp:BoundField DataField=”country_id” HeaderText=”Country ID” />
<asp:BoundField DataField=”country_name” HeaderText=”Country Name” />
</Columns>
</asp:GridView>
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Database Design:
Create two table Students and Countries in your database. Sample scripts for both tables are given
below:
CREATE TABLE [dbo].[Students](
[StudentID] [bigint] IDENTITY(1,1) NOT NULL,
[StudentName] [nvarchar](100) NULL,
[Address] [nvarchar](150) NULL,
[Phone] [nvarchar](50) NULL,
[CountryID] [nchar](2) NOT NULL,
CONSTRAINT [PK_student] PRIMARYKEY
CLUSTERED
(
[StudentID] ASC)WITH (PAD_INDEX= OFF,STATISTICS_
NORECOMPUTE = OFF,IGNORE_DUP_KEY =
OFF, ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_
LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
CREATE TABLE [dbo].[Countries](
[CountryID] [nchar](2) NOT NULL,
[CountryName] [nvarchar](150) NOT NULL,
[Nationality] [nvarchar](100) NULL,
CONSTRAINT [PK_country] PRIMARY KEY
CLUSTERED
(
[CountryID] ASC
)WITH (PAD_INDEX= OFF, STATISTICS_
NORECOMPUTE = OFF,IGNORE_DUP_KEY =
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
OFF, ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_
LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
Select Operation
Make an object of Data Model in .cs page like this
TestDBEntities oTestDBEntities = new TestDBEntities();
Write the following code in page load event.
if (!IsPostBack)
{
Load_Country();
}
To select data form country table write the following code.
public List<Country> LoadCountry()
{
var result = from Con in oTestDBEntities.Countriesselect Con;
return result.ToList();
}
To bind the country DropDownList writes the following code:
public void Load_Country()
{
ddlCountry.DataSource = LoadCountry();
ddlCountry.DataTextField = “CountryName”;
ddlCountry.DataValueField = “CountryID”;
ddlCountry.DataBind();
}
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
To select data form students table write the following code.
public IList<object> LoadStudent()
{
var result = from std in oTestDBEntities.Students join Con in
oTestDBEntities.Countries on
std.CountryID equals Con.CountryID select new { std.StudentID, std.StudentName,
std.Address,std.Phone, std.CountryID, Con.CountryName };
IList<Object> items = new List<Object>();
foreach (var per in result)
{
items.Add(per);
}
return items;
}
To bind the student GridView writes the following code:
public void Load_Student()
{
GridView1.DataSource = LoadStudent();
GridView1.DataBind();
}
Call Load_Student() function in page load event.
Write the following code to show data of selected students in UI.
protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{
GridViewRow row = GridView1.SelectedRow;
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
txtID.Text = row.Cells[1].Text;
txtName.Text = row.Cells[2].Text;
txtAddress.Text = row.Cells[3].Text;
txtPhone.Text = row.Cells[4].Text;
ddlCountry.Text = row.Cells[5].Text;
}
Insert Operation
To insert or save data in to database write the following code.
oStudent.StudentName = txtName.Text;
oStudent.Phone = txtPhone.Text;
oStudent.Address = txtAddress.Text;
oStudent.CountryID =
ddlCountry.SelectedValue.ToString();
InsertData(oStudent);
Load_Student();
public void InsertData(Student oStudent)
{
oTestDBEntities.Students.AddObject(oStudent);
oTestDBEntities.SaveChanges();
}
Update Operation
To update the record of a student write the following code.
oStudent.StudentID = Convert.ToInt16(txtID.Text) ;
oStudent.StudentName = txtName.Text;
oStudent.Phone = txtPhone.Text;
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
oStudent.Address = txtAddress.Text;
oStudent.CountryID = ddlCountry.SelectedValue.ToString();
UpdateData(oStudent);
Load_Student();
public void UpdateData(Student oStudent)
{
var result = (from st in oTestDBEntities.Students
where st.StudentID == oStudent.StudentID
select st).Single();
result.StudentName = oStudent.StudentName;
result.Address = oStudent.Address;
result.Phone = oStudent.Phone;
result.CountryID = oStudent.CountryID;
oTestDBEntities.Students.ApplyCurrentValues
(result);
oTestDBEntities.SaveChanges();
}
Delete Operation:
To delete data from the database write the following code.
oStudent.StudentID = Convert.ToInt16(txtID.Text) ;
DeleteData(oStudent);
Load_Student();
public void DeleteData(Student oStudent)
{
var result = (from st in oTestDBEntities.Students
where st.StudentID == oStudent.StudentID
select st).Single();
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
oTestDBEntities.Students.DeleteObject(result);
oTestDBEntities.SaveChanges();
}
Search Operation
oStudent.StudentID = Convert.ToInt 16(txtSearch.Text);
GridView1.DataSource = SearchStudent (oStudent);
GridView1.DataBind();
public IList<object> SearchStudent(Student oStudent)
{
IList<Object> items = new List<Object>();
var result = from std in oTestDBEntities.Students join Con in oTestDBEntities.Countries on
std.CountryID equals Con.CountryID where std.StudentID == oStudent.StudentID select new
{ std.StudentID, std.StudentName, std.Address,std.Phone, std.CountryID,
Con.CountryName };
foreach (var per in result)
{
items.Add(per);
}
return items;
ON
)
. SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR
CSE/8th
/ST-5 Lab/PreparedbyVivekKumarSinha
Output:

More Related Content

PPT
Java tutorial PPT
PPT
ADO.NET
PDF
Asp.net Lab manual
PPTX
Sql queries presentation
PPTX
Java constructors
PPT
Asp.net control
PPTX
Object oriented programming in python
PPTX
Classes, objects in JAVA
Java tutorial PPT
ADO.NET
Asp.net Lab manual
Sql queries presentation
Java constructors
Asp.net control
Object oriented programming in python
Classes, objects in JAVA

What's hot (20)

PPTX
Classes objects in java
PPS
Procedures functions structures in VB.Net
DOCX
Employee management system1
PPT
Introduction to JavaScript
PPTX
Windows form application - C# Training
PPT
RichControl in Asp.net
PDF
Employee management system in Software Engineering
PPT
Collection Framework in java
PPTX
OOPS in Java
PDF
Bca sem 6 php practicals 1to12
PPTX
PHP FUNCTIONS
DOCX
Placement management system
PPTX
Java swing
PPTX
Introduction to php
PPTX
Boxing & unboxing
PDF
Payroll Management System Complete Report
PPS
Java Exception handling
PPTX
OOPS In JAVA.pptx
PPTX
Lab #2: Introduction to Javascript
Classes objects in java
Procedures functions structures in VB.Net
Employee management system1
Introduction to JavaScript
Windows form application - C# Training
RichControl in Asp.net
Employee management system in Software Engineering
Collection Framework in java
OOPS in Java
Bca sem 6 php practicals 1to12
PHP FUNCTIONS
Placement management system
Java swing
Introduction to php
Boxing & unboxing
Payroll Management System Complete Report
Java Exception handling
OOPS In JAVA.pptx
Lab #2: Introduction to Javascript
Ad

Viewers also liked (16)

PDF
Unit Testing on Android - Droidcon Berlin 2015
DOCX
Mech nacp lab
PDF
Company Profile - Compressed
DOCX
Computer applications in civil engineering lab
PPTX
Teks ekposisi
DOC
Cn lab manual
DOC
Computer hardware and simulation lab manual
DOC
Softwareenggineering lab manual
DOCX
Graphics User Interface Lab Manual
DOCX
Oops lab manual
DOC
Java final lab
DOC
Network security Lab manual
PDF
Eurest Breakfast White Paper
PDF
WebRTC on Mobile
DOCX
Graphics practical lab manual
DOC
COMPUTER GRAPHICS LAB MANUAL
Unit Testing on Android - Droidcon Berlin 2015
Mech nacp lab
Company Profile - Compressed
Computer applications in civil engineering lab
Teks ekposisi
Cn lab manual
Computer hardware and simulation lab manual
Softwareenggineering lab manual
Graphics User Interface Lab Manual
Oops lab manual
Java final lab
Network security Lab manual
Eurest Breakfast White Paper
WebRTC on Mobile
Graphics practical lab manual
COMPUTER GRAPHICS LAB MANUAL
Ad

Similar to Lab manual asp.net (20)

PDF
ASP.NET Overview - Alvin Lau
PPTX
An ADF Special Report
PDF
Reporting solutions for ADF Applications
PPT
Web based development
DOC
Pl sql using_xml
PPTX
Retrofit Web Forms with MVC & T4
DOC
Ad java prac sol set
PPT
Silicon Valley CodeCamp 2008: High performance Ajax with ExtJS and ASP.NET
ODP
Practical catalyst
PPTX
10 performance and scalability secrets of ASP.NET websites
PPTX
Sql storeprocedure
PPTX
Using the Tooling API to Generate Apex SOAP Web Service Clients
PPTX
Implementation of GUI Framework part3
PPTX
Honey I Shrunk the Database
PPT
SynapseIndia dotnet client library Development
PDF
Bootstrat REST APIs with Laravel 5
PDF
Rich Portlet Development in uPortal
PDF
Java Web Programming [5/9] : EL, JSTL and Custom Tags
PDF
Android L01 - Warm Up
PPTX
Hadoop cluster performance profiler
ASP.NET Overview - Alvin Lau
An ADF Special Report
Reporting solutions for ADF Applications
Web based development
Pl sql using_xml
Retrofit Web Forms with MVC & T4
Ad java prac sol set
Silicon Valley CodeCamp 2008: High performance Ajax with ExtJS and ASP.NET
Practical catalyst
10 performance and scalability secrets of ASP.NET websites
Sql storeprocedure
Using the Tooling API to Generate Apex SOAP Web Service Clients
Implementation of GUI Framework part3
Honey I Shrunk the Database
SynapseIndia dotnet client library Development
Bootstrat REST APIs with Laravel 5
Rich Portlet Development in uPortal
Java Web Programming [5/9] : EL, JSTL and Custom Tags
Android L01 - Warm Up
Hadoop cluster performance profiler

More from Vivek Kumar Sinha (20)

DOCX
Software engg unit 4
DOCX
Software engg unit 3
DOCX
Software engg unit 2
DOCX
Software engg unit 1
DOCX
Data structure
PPTX
Mathematics basics
PDF
E commerce 5_units_notes
DOCX
Subject distribution
DOCX
Revision report final
DOC
Lession plan mis
DOC
Lession plan dmw
DOC
Faculty planning
PPT
Final presentation on computer network
DOCX
Np syllabus summary
PPT
Internet of things
PPT
Induction program 2017
PDF
E magzine et&amp;t
DOC
Mechanical engineering department (1)
Software engg unit 4
Software engg unit 3
Software engg unit 2
Software engg unit 1
Data structure
Mathematics basics
E commerce 5_units_notes
Subject distribution
Revision report final
Lession plan mis
Lession plan dmw
Faculty planning
Final presentation on computer network
Np syllabus summary
Internet of things
Induction program 2017
E magzine et&amp;t
Mechanical engineering department (1)

Recently uploaded (20)

PPTX
web development for engineering and engineering
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
Well-logging-methods_new................
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
Digital Logic Computer Design lecture notes
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
PPT on Performance Review to get promotions
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
web development for engineering and engineering
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
Well-logging-methods_new................
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
Digital Logic Computer Design lecture notes
OOP with Java - Java Introduction (Basics)
UNIT 4 Total Quality Management .pptx
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
Embodied AI: Ushering in the Next Era of Intelligent Systems
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
Operating System & Kernel Study Guide-1 - converted.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPT on Performance Review to get promotions
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
bas. eng. economics group 4 presentation 1.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Foundation to blockchain - A guide to Blockchain Tech

Lab manual asp.net

  • 1. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Department of Computer Science and engineering LAB MANUAL For SOFTWARE TECHNOLOGY LAB - 5
  • 2. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 1 Aim:Writea program in ASP.netusing drop down list. Source: < %@ Page Language= "C#" % > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" > < script runat = "server" > protected void DropDownList1_SelectedIndexChanged(object sender, System.EventArgs e) { Label1.Text = "You selected: <br /> ItemText: " + DropDownList1.SelectedItem.Text.ToString () + " < br /> Value: " + DropDownList1.SelectedValue.ToString () + " < br / > Index: " + DropDownList1.SelectedIndex.ToString (); } </ script> < html xmlns = "http://www.w3.org/1999/xhtml" > < head runat = "server" > < title >DropDownList Example: AutoPostBack,Index, Item, Value </title > </ head> < body> < form id="form1" runat= "server" > < div > < asp:Label ID= "Label1" runat = "server" Font- Size= "Large" ForeColor ="Olive" /> < br /> < asp:Label ID= "Label2" runat = "server" Text= "Favorite Control?" AssociatedControlID = " DropDownList1" > </ asp:Label >
  • 3. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha < asp:DropDownList ID= "DropDownList1" runat = "server" OnSelectedIndexChanged= " DropDownList1_SelectedIndexChanged" AutoPostBack= "true" BackColor= "BurlyWood" > < asp:ListItem Value= "Navigation ToolBox Control" > TreeView</asp:ListItem > < asp:ListItem Value= "Standard ToolBox Control" > AdRotator </asp:ListItem > < asp:ListItem Value= "Data ToolBox Control" > XmlDataSource </asp:ListItem > < asp:ListItem Value= "Login ToolBox Control" > LoginView</asp:ListItem > </ asp:DropDownList > </ div> </ form> </ body> </ html> Output:
  • 4. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 2 Aim:Writea program in ASP.netusing Listbox. Source: <head runat="server"> <title> AdvanceListBox</title> </head> <body > <form id="form1" runat="server"> <div style="background-color:#CCFFCC; width:300px" > <b style="background-color:Silver;" >ListBox Advance Functionality</b> <br /> <br /> <asp:ListBox ID="lstBrowser" runat="server"Width="200px" SelectionMode="Multiple" AutoPostBack="True” onselectedindexchanged="lstBrowser_SelectedIndexChanged"> </asp:ListBox> <br /> <br /> <asp:Label ID="lblFilter" runat="server" Font- Bold="True" Text="Filter: "></asp:Label> <asp:TextBox ID="txtFilter" runat="server"> </asp:TextBox> <br /> <br /> <asp:Label ID="lbl" runat="server" Font-Bold="True" Text="Output:"></asp:Label> <asp:Label ID="lblOutput" runat="server"> </asp:Label> <br /> <br /> </div>
  • 5. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha <asp:Button ID="btnDelete" runat="server"OnClick="btnDelete_Click" Text="Multiple Delete" /> <asp:Button ID="btnSort" runat="server" OnClick="btnSort_Click" Text="Sort" /> <asp:Button ID="btnSelectAll" runat="server" OnClick="btnSelectAll_Click" Text="Select All" /> <br /> <asp:Button ID="btnSelectNone" runat="server” OnClick="btnSelectNone_Click" Text="Select None" /> <asp:Button ID="btnFindIem" runat="server” OnClick="btnFindIem_Click" Text="Find Item" /> </form> </body> Output:
  • 6. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 3 Aim:Writea program in ASP.netusing eventsin textbox. Source: <% @Page Language="C#" %> <script runat ="server" > private void convertoupper ( object sender ,EventArgs e ) { string str = mytext . Value; changed_text . InnerHtml = str . ToUpper (); } </script> <!-- Layout --> <html> <head> <title> Change to Upper Case </title> </head> <body> <h3> Conversion to Upper Case </h3> <form runat ="server" > <input runat = "server" id="mytext" type ="text" /> <input runat = "server" id="button1" type ="submit" value="Enter..." OnServerClick =" convertoupper " /> <hr /> <h3> Results: </h3> <span runat ="server" id= "changed_text" /> </form> </body> </html>
  • 7. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Output:
  • 8. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 4 Aim: Write a program in ASP.netusing Radio button. Source: <@ Page Language= "C#" % > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1-transitional.dtd" > < script runat = "server" > protected void RadioButton_CheckedChanged(object sender,System.EventArgs e) { if ( RadioButton1.Checked == true) { Response.Write("You Selected: Asp.Net"); } else { Response.Write("You Selected: ColdFusion"); } } </ script> < html xmlns = "http://www.w3.org/1999/xhtml" > < head runat= "server" > < title > RadioButton example: how to use RadioButton control in asp.net </title > </ head> < body> < form id= "form1" runat ="server" > < div > <asp:RadioButton ID="RadioButton1" runat = "server" Text= "Asp.Net" GroupName = " Software" AutoPostBack= "true" OnCheckedChanged="RadioButton_ CheckedChanged" />
  • 9. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha <asp:RadioButton ID="RadioButton2" runat = "server" Text= "ColdFusion" GroupName ="Software" AutoPostBack= "true" OnCheckedChanged= "RadioButton_ CheckedChanged" /> </ div > </ form> </ body> </ html> Output:
  • 10. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 5 Aim:Writea program in ASP.Netfor validationin textbox. Source: <asp:RegularExpressionValidatoR> Maximum character length Validation (Maximum 8 characters allowed) <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox1" ID="RegularExpressionValidator1" ValidationExpression = "^[sS]{0,8}$" runat="server" ErrorMessage="Maximum 8 characters allowed."></asp:RegularExpressionValidator> Minimum character length Validation (Minimum 8 characters required) <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox2" ID="RegularExpressionValidator2" ValidationExpression = "^[sS]{8,}$" runat="server" ErrorMessage="Minimum 8 characters required."></asp:RegularExpressionValidator> Minimum and Maximum character length Validation (Minimum 5 and Maximum 8 characters required) <asp:TextBox ID="TextBox3" runat="server"></asp:TextBox> <asp:RegularExpressionValidator Display = "Dynamic" ControlToValidate = "TextBox3" ID="RegularExpressionValidator3" ValidationExpression = "^[sS]{5,8}$" runat="server" ErrorMessage="Minimum 5 and Maximum 8 characters required."></asp:RegularExpressionValidatoR>
  • 11. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Output:
  • 12. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 6 Aim:Writea program in ASP.Netusing Data List controls. Source: <asp:DataList ID="DataList1" runat="server"> <HeaderTemplate> <table border="1"> <tr> <th>Employee Code</th> <th>Employee Name</th> <th>Basic</th> <th>Dept Code</th> </tr> </HeaderTemplate> <ItemTemplate> <tr bgcolor="#0xbbbb"> <td> <%# DataBinder.Eval(Container.DataItem,"EmpCode")%> </td> <td> <%# DataBinder.Eval(Container.DataItem, "EmpName")%> </td> <td> <%# DataBinder.Eval(Container.DataItem, "Basic")%> </td> <td> <%# DataBinder.Eval(Container.DataItem, "DeptCode")%> </td> </tr> </ItemTemplate> <FooterTemplate> </FooterTemplate> </asp:DataList>
  • 13. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Output:
  • 14. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Experiment 7-10 Aim:Writea program in ASP.netfor Insertion, Deletion, Updationand searching using ADO.net. Source: ADO.NET Entity Framework is an powerful tools to developed applications. This tutorial will help you to insert, update, delete, select, search data into SQL Server by using ADO.NET Entity Framework. For this we will use two tables Students and Countries. We will save Student ID, Name, Address, Phone and Country of a Student in Students table. In Countries table there will be some predefined country data. We will show the entire country list in a DropDownList and student list in a GridView. Summary of the articles are:  UI Design  Database Design Creation of Entity Data Model  Select Operation  Insert Operation  Update Operation  Delete Operation  Search Operation UI Design Create a new asp.net,C# project. Design your UI. You can use the following asp.net code. <table> <tr> <td style=”width: 120px”> Student ID </td> <td> <asp:TextBox ID=”txtID” runat=”server” Enabled=”False”></asp:TextBox> </td> </tr> <tr> <td style=”width: 120px”> Student Name</td> <td> <asp:TextBox ID=”txtName” runat=”server” Width=”250px”></asp:TextBox> </td> </tr> <tr> <td> Address </td>
  • 15. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha <td> <asp:TextBox ID=”txtAddress” runat=”server” TextMode=”MultiLine” Width=”250px”> </asp:TextBox> </td> </tr> <tr> <td> Phone </td> <td> <asp:TextBox ID=”txtPhone” runat=”server”> </asp:TextBox> </td> </tr> <tr> <td> Country </td> <td> <asp:DropDownList ID=”ddlCountry” runat=”server” Width=”200px” DataSourceID=”EntityDataSource1″ DataTextField=”country_name” DataValueField=”country_id”> </asp:DropDownList> </td> </tr> <tr> <td> &nbsp;</td> <td> <asp:Button ID=”btnAdd” runat=”server”Text=”Add” Width=”80px” onclick=”btnAdd_Click” /> <asp:Button ID=”btnDelete” runat=”server” onclick=”btnDelete_Click” Text=”Delete” Width=”80px” /> <asp:Button ID=”btnEdit” runat=”server” onclick=”btnEdit_Click” Text=”Edit” Width=”80px” /> <asp:Button ID=”btnClear” runat=”server” onclick=”btnClear_Click” Text=”Clear” Width=”80px” /> </td> </tr> <tr>
  • 16. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha <td> &nbsp;</td> <td> &nbsp;</td> </tr> <tr> <td> &nbsp; </td> <td> <asp:TextBox ID=”txtSearch” runat=”server”> </asp:TextBox> <asp:Button ID=”btnSearch” runat=”server” onclick=”btnSearch_Click” Text=”Search” Width=”80px” /> </td> </tr> </table> <asp:GridView ID=”GridView1″ runat=”server” AutoGenerateColumns=”False” Width=”600px” AutoGenerateSelectButton=”True” onselectedindexchanged=”GridView1_ SelectedIndexChanged”> <Columns> <asp:BoundField DataField=”student_id” HeaderText=”ID” /> <asp:BoundField DataField=”student_name” HeaderText=”Name” /> <asp:BoundField DataField=”address” HeaderText=”Address” /> <asp:BoundField DataField=”phone” HeaderText=”Phone” /> <asp:BoundField DataField=”country_id” HeaderText=”Country ID” /> <asp:BoundField DataField=”country_name” HeaderText=”Country Name” /> </Columns> </asp:GridView>
  • 17. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Database Design: Create two table Students and Countries in your database. Sample scripts for both tables are given below: CREATE TABLE [dbo].[Students]( [StudentID] [bigint] IDENTITY(1,1) NOT NULL, [StudentName] [nvarchar](100) NULL, [Address] [nvarchar](150) NULL, [Phone] [nvarchar](50) NULL, [CountryID] [nchar](2) NOT NULL, CONSTRAINT [PK_student] PRIMARYKEY CLUSTERED ( [StudentID] ASC)WITH (PAD_INDEX= OFF,STATISTICS_ NORECOMPUTE = OFF,IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_ LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] CREATE TABLE [dbo].[Countries]( [CountryID] [nchar](2) NOT NULL, [CountryName] [nvarchar](150) NOT NULL, [Nationality] [nvarchar](100) NULL, CONSTRAINT [PK_country] PRIMARY KEY CLUSTERED ( [CountryID] ASC )WITH (PAD_INDEX= OFF, STATISTICS_ NORECOMPUTE = OFF,IGNORE_DUP_KEY =
  • 18. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha OFF, ALLOW_ROW_LOCKS = ON,ALLOW_PAGE_ LOCKS = ON) ON [PRIMARY] ) ON [PRIMARY] Select Operation Make an object of Data Model in .cs page like this TestDBEntities oTestDBEntities = new TestDBEntities(); Write the following code in page load event. if (!IsPostBack) { Load_Country(); } To select data form country table write the following code. public List<Country> LoadCountry() { var result = from Con in oTestDBEntities.Countriesselect Con; return result.ToList(); } To bind the country DropDownList writes the following code: public void Load_Country() { ddlCountry.DataSource = LoadCountry(); ddlCountry.DataTextField = “CountryName”; ddlCountry.DataValueField = “CountryID”; ddlCountry.DataBind(); }
  • 19. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha To select data form students table write the following code. public IList<object> LoadStudent() { var result = from std in oTestDBEntities.Students join Con in oTestDBEntities.Countries on std.CountryID equals Con.CountryID select new { std.StudentID, std.StudentName, std.Address,std.Phone, std.CountryID, Con.CountryName }; IList<Object> items = new List<Object>(); foreach (var per in result) { items.Add(per); } return items; } To bind the student GridView writes the following code: public void Load_Student() { GridView1.DataSource = LoadStudent(); GridView1.DataBind(); } Call Load_Student() function in page load event. Write the following code to show data of selected students in UI. protected void GridView1_SelectedIndexChanged(object sender, EventArgs e) { GridViewRow row = GridView1.SelectedRow;
  • 20. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha txtID.Text = row.Cells[1].Text; txtName.Text = row.Cells[2].Text; txtAddress.Text = row.Cells[3].Text; txtPhone.Text = row.Cells[4].Text; ddlCountry.Text = row.Cells[5].Text; } Insert Operation To insert or save data in to database write the following code. oStudent.StudentName = txtName.Text; oStudent.Phone = txtPhone.Text; oStudent.Address = txtAddress.Text; oStudent.CountryID = ddlCountry.SelectedValue.ToString(); InsertData(oStudent); Load_Student(); public void InsertData(Student oStudent) { oTestDBEntities.Students.AddObject(oStudent); oTestDBEntities.SaveChanges(); } Update Operation To update the record of a student write the following code. oStudent.StudentID = Convert.ToInt16(txtID.Text) ; oStudent.StudentName = txtName.Text; oStudent.Phone = txtPhone.Text;
  • 21. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha oStudent.Address = txtAddress.Text; oStudent.CountryID = ddlCountry.SelectedValue.ToString(); UpdateData(oStudent); Load_Student(); public void UpdateData(Student oStudent) { var result = (from st in oTestDBEntities.Students where st.StudentID == oStudent.StudentID select st).Single(); result.StudentName = oStudent.StudentName; result.Address = oStudent.Address; result.Phone = oStudent.Phone; result.CountryID = oStudent.CountryID; oTestDBEntities.Students.ApplyCurrentValues (result); oTestDBEntities.SaveChanges(); } Delete Operation: To delete data from the database write the following code. oStudent.StudentID = Convert.ToInt16(txtID.Text) ; DeleteData(oStudent); Load_Student(); public void DeleteData(Student oStudent) { var result = (from st in oTestDBEntities.Students where st.StudentID == oStudent.StudentID select st).Single();
  • 22. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha oTestDBEntities.Students.DeleteObject(result); oTestDBEntities.SaveChanges(); } Search Operation oStudent.StudentID = Convert.ToInt 16(txtSearch.Text); GridView1.DataSource = SearchStudent (oStudent); GridView1.DataBind(); public IList<object> SearchStudent(Student oStudent) { IList<Object> items = new List<Object>(); var result = from std in oTestDBEntities.Students join Con in oTestDBEntities.Countries on std.CountryID equals Con.CountryID where std.StudentID == oStudent.StudentID select new { std.StudentID, std.StudentName, std.Address,std.Phone, std.CountryID, Con.CountryName }; foreach (var per in result) { items.Add(per); } return items; ON )
  • 23. . SHRI RAWATPURA SARKAR INSTITUTE OF TECHNOLOGY-II NEW RAIPUR CSE/8th /ST-5 Lab/PreparedbyVivekKumarSinha Output: