Date: Create Web Application Which Use Data Controls Like Repeater, Datalist, Datagrid Ex: 10
Date: Create Web Application Which Use Data Controls Like Repeater, Datalist, Datagrid Ex: 10
Create web application which use data controls like Repeater, DataList,
Ex: 10 DataGrid
Enrollment No: 92210103022 Name: Namrata Solanki Class & Batch: 6TC6-C
Source Code:
WebForm1.aspx
<!DOCTYflE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>DATA CO TROLS - flractical 10</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<div style="font-size:x-large" align="center">DATA CO TROLS</div>
<br />
<table class="w-100">
<tr>
<td style="width: 190px">finbsp;</td>
<td>Repeater</td>
</tr>
<tr>
<td style="width: 190px">finbsp;</td>
<td>
<asp:Repeater ID="Repeater1" runat="server">
<ItemTemplate>
<table>
<tr>
<td><b> ID :</b> </td>
<th><% Eval("id") %></th>
</tr>
<tr>
<td><b> ame :</b></td>
<th><% Eval("name") %></th>
</tr>
<tr>
<td><b> EMAIL :</b> </td>
<th><% Eval("email") %></th>
</tr>
<tr>
<td><b> CO TACT :</b></td>
<th><% Eval("contact") %></th>
</tr>
</table>
</ItemTemplate>
WebForm1.aspx.cs
using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace flrac10
{
public partial class WebForm1 : System.Web.UI.flage
{
protected void flage_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("Data Source=LAflTOfl-
76D7BK2K\\SQLEXflRESS;Initial Catalog=Demo;Integrated Security=True");
SqlDataAdapter sda = new SqlDataAdapter("SELECT * FROM demotbl", con);
DataTable rdt = new DataTable();
sda.Fill(rdt);
Repeater1.DataSource = rdt;
Repeater1.DataBind();
}
}
}