當我單擊Telerik RadGrid上的一行時,我可以觸發以下方法。我可以引用任何列例如項目的[「描述」]Telerik Grid - 引用選定的項目
問題:如何以引用的DataKeyName「ID」
<telerik:RadGrid ID="RadGrid1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="LinqDataSource1" GridLines="None" OnItemDataBound="materialsGrid_ItemDataBound" OnItemCommand="RadGrid1_ItemCommand">
<ClientSettings EnableRowHoverStyle="true" AllowKeyboardNavigation="true" EnablePostBackOnRowClick="true">
<Selecting AllowRowSelect="True" />
</ClientSettings>
<MasterTableView DataKeyNames="Id" DataSourceID="LinqDataSource1" CssClass="listItems"
Width="98%">
protected void RadGrid1_ItemCommand(object source, Telerik.Web.UI.GridCommandEventArgs e)
{
GridDataItem item = (GridDataItem)e.Item;
string str = item["Description"].Text;
var Id = item["Id"];
不會item.OwnerTableView.DataKeyValues [「Id」]工作嗎? – Galilyou 2011-09-27 17:13:47