SolutionCottage.com
Posted  12 Nov 2008 - 21:13:56

Category: ASP.net


gridview does not remove row, just refreshes

Issue:
You have a GridView set up together with a Datasource and wish to add the delete function. You specify this in the Datasource. You know the SQL works. When you hit the "Delete" link in the grid, the page just refreshes.

Solution: There are a few common reasons for this problem. Probably you are not sending the parameter to the SQL correctly, and subsequently nothing gets deleted.

Begin by checking is the Properties of the GridView. Notice the field "DataKeyNames". These are the variables you send to the DataSource. If you don't have one set, set this one to the argument you use for removal in the SQL, usually an "ID".

Next thing to check is the DataSource. Here you will have to make sure at least one "DeleteParameters" are present. This parameter will be the value of 1: your "OldValuesParameterFormat" format string and 2: your variable sent by the GridView.

Note:
The "OldValuesParameterFormat" is by default in this form: original_{0} where 0 is your variable from GridView. An example would be "Original_ID".

Update: When using RadGrid, check for the AllowAutomatic settings on the Master Table.








0 comments:








© SolutionCottage 2008-2011 7/26/2017 1:44:24 AM