试试这个代码:
ASPX:
<telerik:RadGrid ID="grid1" runat="server" Width="200px" AutoGenerateEditColumn="true" AutoGenerateColumns="true" DataSourceID="SqlDataSource2">
<ClientEvents OnRowDblClick="OnRowDblClick" />
</ClientSettings>
</telerik:RadGrid>
<telerik:RadWindowManager ID="radwinmgr" runat="server">
<Windows>
<telerik:RadWindow ID="win1" runat="server">
<ContentTemplate>
ID: <asp:Label ID="Label1" runat="server"></asp:Label><br />
Name: <asp:Label ID="Label2" runat="server"></asp:Label>
</ContentTemplate>
</telerik:RadWindow>
</Windows>
</telerik:RadWindowManager>
JS:
function OnRowDblClick(sender, eventArgs) {
var grid = sender;
var MasterTable = grid.get_masterTableView();
var row = MasterTable.get_dataItems()[eventArgs.get_itemIndexHierarchical()];
var cell = MasterTable.getCellByColumnUniqueName(row, "EmployeeID"); // get the value by uniquecolumnname
var FirstName = MasterTable.getCellByColumnUniqueName(row, "FirstName");
var ID = cell.innerHTML;
var name = FirstName.innerHTML;
var win1 = $find("<%=win1.ClientID%>");
var Label1 = document.getElementById("win1_C_Label1"); // accessing controls inside radwindow
Label1.innerHTML = ID; // assigning the column value to the control inside radwindow
var Label2 = document.getElementById("win1_C_Label2");
Label2.innerHTML = name;
win1.show();
}
或者
如果您要重定向到 radwindow open 上的另一个页面,请查看以下论坛链接。
如何在 radgrid 中双击一行时出现 rad 窗口
在这里,我们将参数作为查询字符串传递并在页面加载中对其进行评估。