Asp.Net-informations.com   Advertisement
     SiteMap

Detailsview Update

DetailsView generates a user interface similar to the Form View of a Microsoft Access database, and is typically used for updating/deleting any currently displayed record or for inserting new records. You can use the DetailsView control to update existing database records. In order to update an existing record, assign the value True to the DetailsView controls AutoGenerateEditButton property .

  AutoGenerateEditButton="true"

detailsview-update

If you want the DetailsView control to initially appear in Edit mode, then you can set the DetailsView controls DefaultMode property to the value Edit.

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"  DataKeyNames="stor_id"
		AllowPaging ="true" Runat="server" AutoGenerateEditButton="true" />
		<asp:SqlDataSource ID="SqlDataSource1" runat="server"
		ConnectionString="<%$ ConnectionStrings:SQLDbConnection %>"
		SelectCommand="select * from [stores]"
		UpdateCommand="UPDATE [stores] SET stor_name=@stor_name,stor_address=@stor_address,city=@city,
		state=@state, zip=@zip WHERE stor_id=@stor_id" />
	</div>
	</form>
</body>
</html>




ASP.NET Deatilsview - Related Contents


More Source Code :
|  Home  |   VB.NET  |   C#  |   ASP.NET  |   SiteMap  |   Terms of Use  |   About  |