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

GridClientDeleteColumn vs GridButtonColumn

6 Answers 370 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Balamurali Venkatesan
Top achievements
Rank 1
Balamurali Venkatesan asked on 16 Oct 2008, 10:26 PM


Iam trying to delete records from the radgrid.

I was using GridClientDeleteColumn and on the DeletedCommand had the logic to delete the records.

But the DeletedCommand is not getting triggered.

I chnaged the GridClientDeleteColumn  to GridButtonColumn and it worked.

Whats the difference betwen these two?Why don't we use GridClientDeleteColumn ?

Thanks
Bala

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 17 Oct 2008, 04:06 AM
Hi,

Deleting records  can be accomplished either by Performing the delete operation automatically by enabling automatic delete through a DataSource control or by executing the delete operation manually wiring theItemCommand or DeleteCommand event of the control.

    In addition to the server/ajax delete feature of Telerik RadGrid there is support for delete operation client-side. This allows you to delete records without making additional round trip to the server. In order to trigger client-sidedelete action you need to add GridClientDeleteColumn to the Columns collection.

Go through the following help document links to get more details on this regard.
Deleting records
Client-side delete


Regards
Shinu
0
Balamurali Venkatesan
Top achievements
Rank 1
answered on 17 Oct 2008, 01:39 PM
Hi Shinu,
Thanks for the information.

I see like the GridClientDeleteColumn is used to delete columns from ClientSide.

Can we use GridClientDeleteColumn to delete records from database.

Bcoz when I used GridClientDeleteColumn,the DeletedEvent /ItemDeleted is not firing.

Thanks
Bala
0
Daniel
Telerik team
answered on 17 Oct 2008, 04:03 PM
Hello Balamurali,

Appropriate server-side approach would be to either

use Autogenerated delete column
<telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateDeleteColumn="true" Width="800px" 

or to use GridButtonColumn
<telerik:GridButtonColumn CommandName="Delete" Text="Delete"
</telerik:GridButtonColumn> 

If you insist to use GridClientDeleteColumn you should handle DeleteCommand server-side as shown below:
protected void RadGrid1_DeleteCommand(object source, Telerik.Web.UI.GridCommandEventArgs e) 
    //your code 

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
0
Balamurali Venkatesan
Top achievements
Rank 1
answered on 17 Oct 2008, 04:07 PM
HI,

Thanks for ur response. Actually when i use GridCleintDeleteColumn the RadGrid1_DeleteCommand is not firing.
I have set the AutoDelete to true for this one.

When i use GridButtonColumn ,RadGrid1_DeleteCommand is firing and iam able to write my delete code.

Just want to know why the DeeleCommand is not firing for GridCleintDeleteColumn

Thanks
Bala


0
Shinu
Top achievements
Rank 2
answered on 20 Oct 2008, 05:40 AM
Hi Bala,

Generally GridClientDeleteColumn is designed to delete rows client-side and
submit these changes on the first post-back/ajax request. If you want to use
the delete command use normal GridButtonColumn with CommandName="Delete".

Shinu.

0
Daniel
Telerik team
answered on 20 Oct 2008, 01:25 PM
Hello Balamurali,

The event will be fired only after a postback occurs. Otherwise you can catch the client-side event.

For your convenience I created a simple example. Please delete a column of your choice and then either click Refresh command item button or Postback button.

I hope this helps.

Regards,
Daniel
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Grid
Asked by
Balamurali Venkatesan
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
Balamurali Venkatesan
Top achievements
Rank 1
Daniel
Telerik team
Share this question
or