至于打开 RadWindow 的命令,我也会采用 Mark 提出的类似方式。没有理由将复选框用作按钮,因为这是此类控件的功能,您无需使用其状态而不是命令。
添加按钮列并设置其CommandName="something"
在网格中创建事件 itemCommand 并在后面的代码中添加如下内容:
if (e.CommandName == "something")
{
if (e.Item is RadGridDataItem)
{
RadGridDataItem item = e.Item as RadGridDataItem;
string script = "function f(){openRadWindow(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
}
}
添加你的 JS:
function openRadWindow() {
var radwindow = $find('<%=RadWindow1.ClientID %>');
radwindow.show();
}
添加您的 radWindow:
<telerik:RadWindow ID="RadWindow1" VisibleOnPageLoad="false" OnClientClose="//here you can generate the event to rebind your grid and show the update" runat="server" Width="450px" Height="650px" NavigateUrl="Window1.aspx" >
</telerik:RadWindow>
创建页面 Window1.aspx 并在其中详细说明加载文件的逻辑。
另一种更简单的方法是使用edit template form 而不是 radWindow 并在其中添加一个 asyncUploader 以及您可能需要填写的其他控件,以避免必须获取所有要关联的引用记录的输入。