or
<telerik:GridTemplateColumn HeaderText="Actions"> <ItemStyle Wrap="false" /> <ItemTemplate> <asp:Button ID="uxDeleteDeployment" runat="server" CommandName='<%# Eval("deploymentId") %>' ToolTip="Delete deployment" AlternateText="Delete deployment" ImageUrl="/_layouts/images/delete.gif" ImageAlign="AbsMiddle" Visible="false" OnClick="uxDeleteDeployment_Click" OnClientClick='<%# JsEncoder.Format(@"alert(""{0}""); return true", Eval("deploymentId")) %>' />
</ItemTemplate></telerik:GridTemplateColumn>
The OnClientClick code alert the value passed to it (in this case it is just a deploymentId -- the same binding that is used with CommandName). The importance of this will be explained below. Also note that I do not set CommandArgument so it will default to the "data key" which is the deploymentId.
In the uxDeleteDeployment_Click there is the following code:
var button = (Button)_sender;
throw new InvalidOperationException("Foo: " + button.CommandName + "|" + button.CommandArgument);
Now, there are the symptoms:
When an item on the FIRST PAGE is clicked the confirm dialog will show X (X is a particular but arbitrary deployment ID for the item) and the exception thrown on on the post-back is "Foo: X|X" -- this is correct behavior.
Now, when the SECOND PAGE is paged to and the button is clicked the confirm dialog will show X (X is a particular but arbitrary deployment ID for the item). However, the exception thrown on the post-back is "Foo: Y|Y" (note Y and not X!!!) where Y is the deploymentId of the item with the SAME PAGE POSITION but on the FIRST PAGE. For instance, Y is the deploymentId of Item #3 from the data-source if Item #13 (#3 in list on the SECOND PAGE) is clicked -- this is not correct behavior.
Additionally,
If the page-size is changed (default is 10) to 20 and item #13 is clicked, the OnClick callback will not be invoked -- rather the page will be refresh to show only the FIRST PAGE (page size of 10) but leaves "20" in the page-size field -- this is not correct behavior.
Other notes:
ViewStateMode does not change the symptoms/behavior. (ViewState is enabled because filtering is used; disabling the ViewState was just for a test and it had no noticeable effect.)
CommandName/CommandArgument have this same incorrect behavior inside of an ItemCommand for the grid (in the case above I discuss it in context of an OnClick applied to the individual button). In the case of ItemCommand the code 'e.Item.OwnerTableView.DataKeyValues[e.Item.ItemIndex]["deploymentId"];' results in the same value as CommandArgument (which is wrong).Removing the client-side event handler does not correct the behavior.
I have looked through the Demos and I can not find a case covering this use-case -- a custom OnClick/ItemCommand of a Particular Item being manually handled from the non-first page of a paged RadGrid control (The "Selected" demos do not count because the behavior is internal to the RadGrid control and not a manual event). It would be nice to see a test-case demonstrating this scenario as then I could look for fault elsewhere. However, as it is now, I cannot find this example demonstrated.
Any suggestions/fixes are appreciated.
Because of this error I must now go and validate all existing code to ensure this issue is not present elsewhere. Not a good feeling.

protected void HeaderContextMenu_ItemCreated(object sender, RadMenuEventArgs e) { switch (e.Item.Value) { case "GroupBy": case "UnGroupBy": case "bottomGroupSeperator": case "BestFit": case "bestFitSeparator": case "ColumnsContainer": case "filterMenuSeparator": e.Item.Attributes.Add("style", "display: none"); break; default: break; } }<asp:ScriptManager id="scriptmanager1" runat="server"/> <asp:content id="content1" contentplaceholder="contentplaceholder1" runat="server"> <asp:updatepanel id="up1" runat="sever"<telerik:RadGrid id="radgrid1"...> <exportSetting ignorePaging="true" openInNewWindow="true"> <pdf pageheight="297mm" pagewidth="210mm" </exportSetting> <masterTableView commanditemdisplay="top"> <command itemtemplate> <asp:imagebutton id="downloadpdf" runat="server" commandname="exporttopdf" imageurl="pdf.jpg" backcolor="white"> </command itemtemplate> ...... </asp:updatepanel> </asp:content>
