This is a migrated thread and some comments may be shown as answers.

[Solved] Error using delete on grid

1 Answer 183 Views
Grid
This is a migrated thread and some comments may be shown as answers.
judo
Top achievements
Rank 1
judo asked on 27 Dec 2007, 01:39 PM
I'm trying to add a delete column to my RadGrid

I added the below column:

<telerik:GridButtonColumn CommandName="Delete" CurrentFilterFunction="NoFilter" FilterListOptions="VaryByDataType" Text="Delete" UniqueName="AutoGeneratedDeleteColumn" ConfirmText="Do you wish to delete this article?" SortExpression="articleid"></telerik:GridButtonColumn>

and added the appropriate command to my SQLDataSource:

DeleteCommand="delete from arts where articleid=@articleid"


However I still get the error Must declare the variable '@articleid'. whenever I try to delete a column. I have used the same where 'articleid=@articleid' for the update statement of the SQLDataSource which works fine so I don't know what is going wrong.

1 Answer, 1 is accepted

Sort by
0
Chris Gillies
Top achievements
Rank 1
answered on 28 Dec 2007, 03:09 PM
Hi Jude,

As I see your code you should have declared the RadGrid property DataKeyName="articleid" (the primary key of the datasource of the grid) and should have set the following parameters for the datasource you are using for the grid:
<DeleteParameters>
   <asp:Parameter Name="articleid" Type="..." />
</DeleteParameters>

Happy Holidays,
Chris
Tags
Grid
Asked by
judo
Top achievements
Rank 1
Answers by
Chris Gillies
Top achievements
Rank 1
Share this question
or