Thank you for using the AJAX Forums. I wanted to mention that my colleague has replied to this question in the ticketing system and I am posting this response to assist anyone in the community with a similar issue.
In order to capture ItemCommand arguments, use a Button column or a Button inside a template column to make the Post Back. Each of these can define a CommandName that distinguishes the ItemCommand in the event handler. This then allows access to the Item, its data key value and process it further. See Accessing Cells and Rows article for more information on accessing items, values in a RadGrid.
Here is an example that you can try. Create a new WebForms page and add the following Grid markup to it:
<telerik:RadGrid ID="RadGrid1" runat="server" Width="800px" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
<telerik:GridButtonColumn CommandName="FirstCommand" ButtonType="PushButton" Text="First Button"></telerik:GridButtonColumn>
<telerik:RadButton ID="RadButton1" runat="server" Text="Second Button" CommandName="SecondCommand"></telerik:RadButton>
And the following Code-behind:
protected void RadGrid1_NeedDataSource(object sender, Telerik.Web.UI.GridNeedDataSourceEventArgs e)
(sender as RadGrid).DataSource = Enumerable.Range(1, 3).Select(x => new
OrderID = x,
OrderDate = DateTime.Now.Date.AddHours(x),
Freight = x * .1,
ShipName = "Name " + x,
ShipCountry = "Country " + x
protected void RadGrid1_ItemCommand(object sender, Telerik.Web.UI.GridCommandEventArgs e)
GridDataItem dataItem = e.Item as GridDataItem;
var OrderID = dataItem.GetDataKeyValue("OrderID");
if (e.CommandName == "FirstCommand")
else if (e.CommandName == "SecondCommand")
I hope this helps. Kindly refer to the support ticket response if this doesn't resolve the issue. Thank you.
Eric R | Technical Support Engineer
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.