GridView not updating
I've been trying to update a gridview and am not successful. The delete command is working. This was created using VisualStudio 2005
I took out the updating of the date fields and just put in the description field to update to keep this as simple as possible.
The database is not being updated with the new value.
Any help would be much apprecited.
Here's the code
<asp:GridView ID="GridView1"
runat="server"
AutoGenerateColumns="False"
DataSourceID="SqlDataSource1"
Width="720px" DataKeyNames="ID">
<Columns>
<asp:TemplateField HeaderText="ID" InsertVisible="False" SortExpression="ID">
<EditItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Bind("ID") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="phase_description" SortExpression="phase_description">
<EditItemTemplate>
<asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("phase_description") %>' AutoPostBack="true"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Bind("phase_description") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="phase_begin_date" SortExpression="phase_begin_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("phase_begin_date") %>' AutoPostBack="true"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Bind("phase_begin_date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="phase_end_date" SortExpression="phase_end_date">
<EditItemTemplate>
<asp:TextBox ID="TextBox3" runat="server" Text='<%# Bind("phase_end_date") %>' AutoPostBack="true"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="Label4" runat="server" Text='<%# Bind("phase_end_date") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1"
runat="server"
ConnectionString="<%$ ConnectionStrings:SurveyDatabaseConnectionString %>"
ProviderName="<%$ ConnectionStrings:SurveyDatabaseConnectionString.P roviderName %>"
SelectCommand="SELECT ID, phase_description, phase_begin_date, phase_end_date FROM Phase WHERE (fk_svy_id = ?)"
UpdateCommand="UPDATE Phase SET phase_description = @phase_desription WHERE ID = @ID"
DeleteCommand="DELETE FROM Phase WHERE ID = @ID">
<SelectParameters>
<asp:ControlParameter ControlID="SvyID" Name="fk_svy_id" PropertyName="Value" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
|