So all I am trying to do is enable editing for one of my GridView database so I can have "staff" update and edit the database when need be. In my gridview source I added AutoGenerateEditButton=True. However its telling me I need my data source to have an update command enabled. How do I go about this?? Any helps would be awesome.
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="edit.aspx.cs" Inherits="edit" %> <!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 runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" [b]AutoGenerateEditButton="true"[/b] BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="Guitar" DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="Vertical" onselectedindexchanged="GridView1_SelectedIndexChanged"> <FooterStyle BackColor="#CCCC99" /> <RowStyle BackColor="#F7F7DE" /> <Columns> <asp:BoundField DataField="Guitar" HeaderText="Guitar" ReadOnly="True" SortExpression="Guitar" /> <asp:BoundField DataField="Color" HeaderText="Color" SortExpression="Color" /> <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" /> <asp:BoundField DataField="AMP" HeaderText="AMP" SortExpression="AMP" /> <asp:BoundField DataField="Year" HeaderText="Year" SortExpression="Year" /> <asp:BoundField DataField="Original_Price" HeaderText="Original_Price" SortExpression="Original_Price" /> <asp:BoundField DataField="Sale_Price" HeaderText="Sale_Price" SortExpression="Sale_Price" /> </Columns> <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" /> <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" /> <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" /> <AlternatingRowStyle BackColor="White" /> </asp:GridView> <div> </div> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT [Guitar], [Color], [Type], [AMP], [Year], [Original Price] AS Original_Price, [Sale Price] AS Sale_Price FROM [Passwords]"> </asp:SqlDataSource> </form> </body> </html>
This post has been edited by kkgaming: 26 February 2008 - 03:45 PM

New Topic/Question
Reply




MultiQuote




|