I have a RadGrid tied to a SqlDataSource, and I'm attempting to do the automatic delete method. However, I'm receiving the error that you must declare the scalar variable @id. I've looked over the code, and compared to the examples, and I just don't see where the error is.
This is for .NET FrameWork 3.5 and with Telerik 2009Q3 release, VS2010 B2. It's also maybe relevant that I'm using the RadAjaxManager to update the grid.
The error from FireBug console: 41|error|500|Must declare the scalar variable "@id".|
SqlDataSource
<asp:SqlDataSource runat="server" ID="areanoticeds" ConnectionString="<%$ ConnectionStrings:RD %>" CancelSelectOnNullParameter="false" OldValuesParameterFormatString="original_{0}" |
SelectCommand="SELECT * FROM [RCAreaNotices]" |
UpdateCommand="UPDATE [RCAreaNotices] SET [area]=@area, [notice]=@notice WHERE [id]=@id" |
InsertCommand="INSERT INTO [RCAreaNotices] ([area],[notice]) VALUES (@area,@notice)" |
DeleteCommand="DELETE FROM [RCAreaNotices] WHERE [id]=@id"> |
<UpdateParameters> |
<asp:Parameter Name="id" DbType="Int16" /> |
<asp:Parameter Name="area" DbType="String" Size="3" /> |
<asp:Parameter Name="notice" DbType="String" Size="200" /> |
<asp:Parameter Name="original_id" DbType="Int16" /> |
<asp:Parameter Name="original_area" DbType="String" Size="3" /> |
<asp:Parameter Name="original_notice" DbType="String" Size="200" /> |
</UpdateParameters> |
<InsertParameters> |
<asp:Parameter Name="area" DbType="String" Size="3" /> |
<asp:Parameter Name="description" DbType="String" Size="200" /> |
</InsertParameters> |
<DeleteParameters> |
<asp:Parameter Name="id" DbType="Int16" /> |
</DeleteParameters> |
</asp:SqlDataSource> |
RadGrid control
<telerik:RadGrid runat="server" ID="areanoticegrid" DataSourceID="areanoticeds" AllowAutomaticDeletes="true" AllowAutomaticInserts="true" AllowAutomaticUpdates="true" |
BorderStyle="None" AllowPaging="true" AllowSorting="true"> |
<MasterTableView AutoGenerateColumns="false" Width="100%" Caption="Area Notices" CommandItemDisplay="TopAndBottom" DataKeyNames="id" DataSourceID="areanoticeds"> |
<NoRecordsTemplate>No area notices in database.</NoRecordsTemplate> |
<Columns> |
<telerik:GridBoundColumn UniqueName="id" DataField="id" /> |
<telerik:GridBoundColumn UniqueName="area" HeaderText="Area" DataField="area" /> |
<telerik:GridBoundColumn UniqueName="notice" HeaderText="Notice" DataField="notice" /> |
<telerik:GridEditCommandColumn UniqueName="AreaNoticeEdit" HeaderText="Edit Item" ButtonType="ImageButton" EditImageUrl="img/edit.png" ItemStyle-HorizontalAlign="Center" HeaderStyle-Width="70px" /> |
<telerik:GridButtonColumn UniqueName="AreaNoticeDelete" CommandName="Delete" Text="Delete" HeaderText="Delete?" ButtonType="ImageButton" ImageUrl="img/trash.png" /> |
</Columns> |
</MasterTableView> |
<ClientSettings> |
<ClientEvents OnRowDblClick="RowDblClick" /> |
</ClientSettings> |
</telerik:RadGrid> |
Any thoughts?
Cheers.