Telerik Rad窗口仅打开一次

时间:2012-10-04 02:53:55

标签: asp.net vb.net telerik radgrid radwindow

我的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但只打开一次! 缺少什么?

1 个答案:

答案 0 :(得分:1)

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