<telerik:RadGrid ID="radGrid" runat="server" AllowPaging="true" AllowCustomPaging="True"
GridLines="None" PageSize="20" AllowMultiRowSelection="true" ClientSettings-Selecting-AllowRowSelect="true"
AutoGenerateColumns="false" onneeddatasource="radGrid_NeedDataSource" OnItemCreated="radGrid_ItemCreated"
OnItemDataBound="radGrid_ItemDataBound" OnItemCommand="radGrid_ItemCommand"
DataKeyNames="ClientID">
<mastertableview datakeynames="ID" gridlines="None" width="100%">
<PagerTemplate> and so on ... </telerik:RadGrid>
場景: - 上面給出了我正在使用的Telerik RagGrid控件的標記。我試圖訪問的GridColumn,通常的方式的鍵值,如何從Telerik RadGrid獲取'KeyValue'?
Int32 key = Convert.ToInt32((e.Item as GridDataItem).GetDataKeyValue("ID"));
這是行不通的。有替代品嗎?
爲什麼在RadGrid上指定'DataKeyNames'屬性?嘗試刪除它並僅保留它'MasterTableView' –