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

Inline Delete?

1 Answer 108 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Darwin
Top achievements
Rank 1
Darwin asked on 21 Feb 2013, 05:41 PM
I have a page with two RadGrids.  The first grid allows you to add, edit, delete rows.  If you select a row, the second grid is updated to show data pertaining to the row selected in the first grid.  All of that works fine.  I have added a GridButtonColumn for the delete command in the first grid.  I make the control visible if there is no associated data in the second grid.  During the PreRender of the first grid, I call a stored procedure that returns data that I can use to determine whether the Delete control should be visible or not.  Unfortunately, that query is a long running query due to the sheer number of tables that have to be checked.  This causes the grid to take an exceedingly long time to run.  The query and tables have been tuned for the best performance.  It is simply a volume problem. 

If we filter the sproc by passing the id of the selected row, and call the sproc during the ItemCreated event, then the query runs quickly, however, that means were calling the sproc each time a row is rendered.  This is again impacting the database in a way we do not desire.

There are a few potential solutions to the problem.
1) throw away everything I've done and redesign the entire page.  As you can imagine, I'd prefer not to do that.
2) Do not hide the delete control at all and then  check to see whether it the row can be deleted when the control is clicked and notify the user that the row cannot be deleted.  Also not preferable.
3) IF there was a way to add a delete control to the GridEditCommandColumn and only display the delete control when appropriate, then we only have to call the sproc when the user clicks Edit.  But I don't see anything in the RadGrid documentation that would indicate that adding a delete control to the GridEditCommandColumn is even possible.

Any suggestions?

Thanks,
Darwin

1 Answer, 1 is accepted

Sort by
0
Darwin
Top achievements
Rank 1
answered on 21 Feb 2013, 10:53 PM
Never mind.  I made it work by checking e.Item.IsInEditMode in the ItemDataBound event.  If it is in edit mode, then I call the stored procedure and examine the results and hide or show the Delete control accordingly.  That solved my problem.
Tags
Grid
Asked by
Darwin
Top achievements
Rank 1
Answers by
Darwin
Top achievements
Rank 1
Share this question
or