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

GridButtonColumn and OnDeleteCommand

7 Answers 316 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
L
Top achievements
Rank 1
L asked on 20 Mar 2012, 07:44 PM
Hello,

I used a GridButtonColumn of my RadGrid as a "Delete Column" :

 <trk:RadGrid ID="gridTaskList" runat="server" OnDeleteCommand="gridTasksList_OnDeleteCommand">
...
<trk:GridButtonColumn ConfirmText="Are you sure?" ConfirmDialogType="RadWindow"
 ConfirmTitle="Delete"          ButtonType="LinkButton"              CommandName="Delete" UniqueName="DeleteColumn" />
...


If I used this column as a link button (by default), the event OnDeleteCommand of the RadGrid is fired.
If I specified the column as an ImageButton, the event OnDeleteCommand  is not fired.

<trk:GridButtonColumn ConfirmText="Are you sure?" ConfirmDialogType="RadWindow"
 ConfirmTitle="Delete"          ButtonType="ImageButton"              CommandName="Delete" UniqueName="DeleteColumn" />

I'm using the OnNeedDataSource event to populate the grid and I databind my grid in each PageLoad.

Thank you in advance. 

7 Answers, 1 is accepted

Sort by
0
Accepted
James Campbell
Top achievements
Rank 1
answered on 21 Mar 2012, 03:00 AM
Hi L,

Are you calling DataBind()  in your Page_Load event? If so try removing this and see if you still have the same issue. This has been reported in the past:

http://www.telerik.com/community/forums/aspnet/grid/gridbuttoncolumn-and-ondeletecommand.aspx

Thank you,
Jim

If this helped answer your question please mark this as answered. Thank you.
0
L
Top achievements
Rank 1
answered on 21 Mar 2012, 02:51 PM
Thanks for your quick answer.

Yes, I removed the Databind() from the Load event and is working, but I do need to rebind the grid in each PageLoad, because I have this event

protected void btnUpdatePlanner_Command(object sender, CommandEventArgs e)
        {
            var item = gridSPlanner.Items[int.Parse(e.CommandArgument.ToString())];
            var daily = (VM.Planner)item.DataItem;
            
            Presenter.UpdateLast(daily.AppointmentId, daily.UnitNumber, daily.CustomerName);
            Presenter.LoadPlanner();
        }
If I remove the call to the DataBind(), then, daily is null

Is there something else I can do?

Thanks in advance.
0
Accepted
James Campbell
Top achievements
Rank 1
answered on 21 Mar 2012, 03:48 PM
Take a look at some of the binding techniques in the grid demo: http://demos.telerik.com/aspnet-ajax/grid/examples/overview/defaultcs.aspx

Any questions let me know.
Thanks,
Jim

If this helped answer your question, please mark as answered, thank you.
0
L
Top achievements
Rank 1
answered on 21 Mar 2012, 05:18 PM
Thanks for your answer.

Let me give you more details about the problem I'm trying to solve. I have a page with four grids. These grids gets populated based on 4 sets of conditions applied to a data set that I get from an outside resource.

Each row in the grid exposes functionality to interact with it. This interaction may cause 'item 1' from 'grid 1' to jump to  'grid 2' and become there 'item n'.  The developer that implemented this page achieved the behavior of moving one item from one grid to the other by re-binding all four grids every time an action in any grid in any row occurred. 

Which binding technique you recommend me to solve my problem?
0
Accepted
James Campbell
Top achievements
Rank 1
answered on 22 Mar 2012, 02:02 AM
Just don't put it in Page Load, you can try creating a method that contains the binding and call thyat from page load and see if the error stops, you will want to rebind after any changes are made.


Any other questions let me know.

Thank you,
Jim

If this helped answer your original question, please mark this as answered. Thank you.

0
L
Top achievements
Rank 1
answered on 22 Mar 2012, 06:24 PM
Thanks James, I will try that and I will let you know but I'm sure that will solve the problem, but has page has too many little things going on so I have to be careful when making the change.

Thanks again for your daily follow up, I have marked all your answers.
0
James Campbell
Top achievements
Rank 1
answered on 22 Mar 2012, 06:35 PM
L,

Glad I could help, please let me know how you make out and have a great day.

Thanks,
Jim
Tags
Ajax
Asked by
L
Top achievements
Rank 1
Answers by
James Campbell
Top achievements
Rank 1
L
Top achievements
Rank 1
Share this question
or