我已經找到了大量的搜索和一些實驗後的解決方案。
添加以下設置到RadGrid
元素:
<ClientSettings>
<ClientEvents OnRowCreated="rowCreated"></ClientEvents>
</ClientSettings>
這將每一個排在RadGrid
創建時間調用rowCreated
客戶端功能。
此外,添加下列客戶端腳本:
function rowCreated(sender, args){
var img = args.get_item().get_cell('Image').firstChild.onclick = imgClick;
}
function imgClick(e){
window.open(e.srcElement.currentSrc, "name", 'width=e.srcElement.naturalWidth,height=e.srcElement.naturalHeight,resizable=1');
}
被傳遞到get_cell()
的參數是telerik:GridImageColumn
的UniqueName
屬性,它應該有針對性的價值。使用該元素的firstChild
將以img
標籤爲目標。附加適當的onClick處理程序,並用處理程序打開一個新窗口。