GridView: Código
•<form id="form1" runat runat="server">
• <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1"
• DataKeyNames="ProductID ProductID" AllowPaging="True" AllowSorting="True">
• <Columns>
• <asp:CommandField DeleteText="Excluir“ CancelText="Cancelar “
• UpdateText="Atualizar" EditText="Editar"/>
• <asp:BoundField ReadOnly="True" HeaderText="Cod" DataField ="ProductID"/>
• <asp:BoundField HeaderText="Produto" DataField="ProductName"/>
• <asp:BoundField HeaderText="Estoque" DataField="UnitsInStock“
• DataFormatString="{0:n0}"/>
• <asp:BoundField HeaderText="Preco" DataField="UnitPrice“
• DataFormatString="{0:n2}"/>
• </Columns>
• </asp:GridView>
• <asp:SqlDataSource ID="SqlDataSource1" runat="server"
• ConnectionString="<%$ ConnectionStrings:myConnection%>"
• UpdateCommand="UPDATE [Products] SET [ProductName] = @ProductName..."
• SelectCommand="SELECT [ProductID], [ProductName] … FROM [Products]“
• InsertCommand="INSERT INTO [Products] ([ProductName] ..."
• DeleteCommand="DELETE FROM [Products] WHERE [ProductID] ...">
• </asp:SqlDataSource>
•</form>
•