0

我在其 itemTemplate 中有一个带有超链接的 Rad Grid,超链接将打开一个 Radwindow

<asp:Content ContentPlaceHolderID="MenuPlaceHolder" runat="server" ID="Menus">
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">
        function ShowOnCar(id) {

            window.radopen("OnCar.aspx?SN=" + id, "ShowOnCar");
            return false;
        }

    </script>
</telerik:RadCodeBlock>
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="onCarLink">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager></asp:Content>

<asp:Content ID="SheetContent" ContentPlaceHolderID="SheetContentPlaceHolder" runat="Server">
<telerik:RadAjaxPanel ID="RadAjaxPanel1d" runat="server" LoadingPanelID="RadAjaxLoadingPanel1">
    <telerik:RadGrid ID="dt_lst_SN" runat="server" EnableEmbeddedSkins="false">
        <MasterTableView AutoGenerateColumns="False">
            <Columns>
                <telerik:GridTemplateColumn FilterControlAltText="Filter TemplateColumn column" UniqueName="TemplateColumn">
                    <ItemTemplate>
                        <asp:HyperLink ID="onCarLink" runat="server">
                            <asp:PlaceHolder runat="server" ID="TempPlaceholder" />
                        </asp:HyperLink>
                    </ItemTemplate>
                </telerik:GridTemplateColumn>
            </Columns>
        </MasterTableView>
    </telerik:RadGrid>
</telerik:RadAjaxPanel>
<telerik:RadWindowManager ID="RadWindowManager1" runat="server">
    <Windows>
        <telerik:RadWindow ID="ShowOnCar" runat="server" Title="Details" Height="400px" Width="650px"
            Left="150px" ReloadOnShow="true" ShowContentDuringLoad="false" Modal="true" />
    </Windows>
</telerik:RadWindowManager></asp:Content>

在后面的代码中,

Protected Sub dt_lst_SN_ItemDataBound(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridItemEventArgs) Handles dt_lst_SN.ItemDataBound
    If TypeOf e.Item Is GridDataItem Then
        Dim onCarLink As HyperLink = DirectCast(e.Item.FindControl("onCarLink"), HyperLink)
        onCarLink.Attributes("href") = "#"
        onCarLink.Attributes("onclick") = [String].Format("return ShowOnCar('{0}');", e.Item.Cells(dt_lst_SN.Columns.FindByUniqueName("SN_ID").OrderIndex).Text)
    End If
End Sub

此代码将正确打开 radwindow,但只打开一次!什么不见​​了?

4

1 回答 1

1

查找 JavaScript 错误、更改函数名称、RadWindow ID 等。尝试将链接的 href 设置为 javascript:void(0);

于 2012-10-08T12:52:29.507 回答