CommandArgument on GridButtonColumn

2 posts, 0 answers
  1. Fred
    Fred avatar
    2 posts
    Member since:
    Aug 2019

    Posted 03 Sep 2019 Link to this post

    As per this I am trying to add a delete button onto the radgrid using GridButtonColumn.

    I have followed through the sample that uses programmatic databinding using PageMethods webservices and am finding that when I get an ItemCommand postback server side the data item and the data key values are blank.  I have specified to use DataKeyValues and ClientDataKeyValues but everything on the server is empty.

    I have turned my attention to doing things client side instead and am trying to get the CommandArgument of the item which I can then use in the OnCommand javascript function.  I have tried using <%#Eval("GUID")%> but I get errors.  The link above suggests using a LinkButton instead.

    My question is this, if I use a LinkButton and presumably style that with a delete image, how do I add the rad window confirmation to that button?

  2. Attila Antal
    Attila Antal avatar
    514 posts

    Posted 06 Sep 2019 Link to this post

    Hi Fred,

    You've mentioned that you are using WebServices, which is a technique for binding the Grid on client-side. If that is the case, the grid does submit any data to be accessible on the server. Thus the data key values you are looking for are not available.

    When binding the grid on client-side, every operation must be client oriented using JavaScript. You will need to use the Client-Side APIs to work with the grid on client: RadGrid - Client Side Programming 

    Here is another article that can be useful when you want to access cells, values, controls and more: Accessing Cells and Rows

    To get the DataKeyValue on client-side, only the ClientDataKeyNames have to be populated.

    Once using client-side binding, the following server binding expressions will no longer be compatible: 



    Instead, you would need to use the approach described in the: Client Templates


    Kind regards,
    Attila Antal
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top