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

CommandArgument on GridButtonColumn

1 Answer 32 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Fred
Top achievements
Rank 1
Fred asked on 03 Sep 2019, 10:13 PM

As per this https://www.telerik.com/forums/add-delete-button-to-each-row-in-radgrid 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?

1 Answer, 1 is accepted

Sort by
0
Attila Antal
Telerik team
answered on 06 Sep 2019, 02:07 PM

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: 

<%#Eval("GUID")%>

 

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.
Tags
Grid
Asked by
Fred
Top achievements
Rank 1
Answers by
Attila Antal
Telerik team
Share this question
or