KTTM
KTTM
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;
namespace Ontap
SqlConnection con;
con.Open();
if (con.State == ConnectionState.Open)
con.Close();
try
{
layknoi();
adap.Fill(dt);
catch
dt = null;
finally
dongketnoi();
return dt;
try
layknoi();
return cmd.ExecuteNonQuery();
}
finally
dongketnoi();
//Master Page
<!DOCTYPE html>
<html>
<head runat="server">
<title></title>
</asp:ContentPlaceHolder>
<style>
.container{
display:flex
.left{
width: 30%;
float: left;
.right{
width: 30%;
float: right;
</style>
</head>
<body>
<div class="container">
<div class="left">
<ItemTemplate>
</ItemTemplate>
</asp:DataList>
</div>
</asp:ContentPlaceHolder></div>
<div class="right">
</asp:Login>
</div>
</div>
</form>
</body>
</html>
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 Ontap
if (!IsPostBack)
DataTable dt = connection.laydata(query);
DataList1.DataSource = dt;
DataList1.DataBind();
else
DataList1.DataSource = null;
DataList1.DataBind();
Response.Redirect("SanPham.aspx?maDm=" + maDM);
//San Pham
</asp:Content>
<ItemTemplate>
<br />
<br />
<asp:Label ID="Label6" runat="server" Text="Label"></asp:Label>
<br />
<br />
</ItemTemplate>
</asp:DataList>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Ontap
if (Page.IsPostBack) return;
string q;
if (string.IsNullOrEmpty(maDm))
this.DataList1.DataSource = connection.laydata(q);
this.DataList1.DataBind();
Response.Redirect("ChiTiet.aspx?maHang=" + maHang);
//Chi tiet
</asp:Content>
<ItemTemplate>
<br />
<br />
<br />
<br />
<br />
</ItemTemplate>
</asp:DataList>
</asp:Content>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Ontap
{
Connection connection = new Connection();
if (Page.IsPostBack) return;
string q;
if (string.IsNullOrEmpty(maHang))
else
this.DataList2.DataSource = connection.laydata(q);
this.DataList2.DataBind();