我已经找到了大量的搜索和一些实验后的解决方案。
添加以下设置到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处理程序,并用处理程序打开一个新窗口。