Net-informations.com
SiteMap  | About    

ASP.NET Detailsview Binding

The DetailsView control has very similar functionality to the GridView control. The GridView control shows all of the records from its data source control at once, but the DetailsView control displays one row from a data source at a time by rendering an HTML table.

detailsview

The DetailsView control is also often used in a master-details scenario where the selected record of the master control determines the record to display in the detail view. The DetailsView supports both declarative and programmatic databinding.

The following program shows how to bind a DetailsView from an ASP.NET application.

Default.aspx

  

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<title>Untitled Page</title>
</head>
<body>
	<form id="form1" runat="server">
	<div>
		<asp:DetailsView id="DetailsView1" DataSourceID="SqlDataSource1"
		AllowPaging =true Runat="server" />
		<asp:SqlDataSource ID="SqlDataSource1" runat="server"
		ConnectionString="<%$ ConnectionStrings:SQLDbConnection %>"
		SelectCommand="select * from stores" />
	</div>
	</form>
</body>
</html>






net-informations.com (C) 2016    Founded by raps mk
All Rights Reserved. All other trademarks are property of their respective owners.