GridButtonColumn and OnDeleteCommand

8 posts, 3 answers
  1. L
    L avatar
    29 posts
    Member since:
    Mar 2012

    Posted 20 Mar 2012 Link to this post

    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. 
  2. Answer
    James Campbell
    James Campbell avatar
    90 posts
    Member since:
    Jul 2012

    Posted 20 Mar 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. L
    L avatar
    29 posts
    Member since:
    Mar 2012

    Posted 21 Mar 2012 Link to this post

    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.
  5. Answer
    James Campbell
    James Campbell avatar
    90 posts
    Member since:
    Jul 2012

    Posted 21 Mar 2012 Link to this post

    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.
  6. L
    L avatar
    29 posts
    Member since:
    Mar 2012

    Posted 21 Mar 2012 Link to this post

    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?
  7. Answer
    James Campbell
    James Campbell avatar
    90 posts
    Member since:
    Jul 2012

    Posted 21 Mar 2012 Link to this post

    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.

  8. L
    L avatar
    29 posts
    Member since:
    Mar 2012

    Posted 22 Mar 2012 Link to this post

    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.
  9. James Campbell
    James Campbell avatar
    90 posts
    Member since:
    Jul 2012

    Posted 22 Mar 2012 Link to this post

    L,

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

    Thanks,
    Jim
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017