<%@ Page Language="C#"%>
<html>
	<head runat="server">
		<title>Atualizando dados com o controle GridView</title>
	</head>
	<body>
		<form id="form1" runat="server">
			<div>
				<asp:SqlDataSource
					id="SqlDataSource1"
					runat="server" ProviderName="System.Data.SqlClient"
					DataSourceMode="DataSet"
					ConnectionString="<%$ ConnectionStrings:nwind%>"
					SelectCommand="SELECT CustomerID, CompanyName FROM Customers"
					UpdateCommand="UPDATE Customers SET CompanyName=@CompanyName 
					WHERE CustomerID=@CustomerID">
					<UpdateParameters>
						<asp:Parameter Name="@CustomerID" Type="Int32" DefaultValue="0"/>
						<asp:Parameter Name="@CompanyName" Direction="Input" Type="String"/>
					</UpdateParameters>
				</asp:SqlDataSource>
				<asp:GridView ID="GridView1" DataKeyNames="CustomerID" 
				AutoGenerateEditButton="true" AutoGenerateColumns="false" 
				PagerSettings-Mode="Numeric" PagerSettings-PageButtonCount="10"
				AllowPaging="true" PageSize="5" DataSourceID="SqlDataSource1" runat="server">
					<Columns>
						<asp:BoundField DataField="CustomerID" ReadOnly="true"/>
						<asp:BoundField DataField="CompanyName"/>
					</Columns>
				</asp:GridView>
			</div>
		</form>
	</body>
</html>

