使用部分post back打开RadWindow

本文关键字:打开 RadWindow back post 用部 | 更新日期: 2023-09-27 17:51:01

我想打开RadWindow弹出使用partial postback双击RadGrid行。但即使我使用UpdatePanel,它仍然与Full PostBack打开。下面是我的代码:

我的ASPX

<asp:UpdatePanel ID="upGrd" runat="server">
    <ContentTemplate>
    <telerik:RadGrid ID="grd" runat="server" AutoGenerateColumns="false">
           <MasterTableView>
                <Columns>
                     <telerik:GridBoundColumn HeaderText="Header" DataField="Field">
                     </telerik:GridBoundColumn>
                     ..................
                     ..................
                     ..................
                </Columns>
           </MasterTableView>   
           <ClientSettings EnableRowHoverStyle="true"> 
                <ClientEvents OnRowDblClick="grd_DblClick" />               
           </ClientSettings>
    </telerik:RadGrid>
    </ContentTemplate>
</asp:UpdatePanel>
<telerik:RadWindowManager ID="RadWindowManager2" runat="server" EnableShadow="true"
        DestroyOnClose="true">
        <Windows>
             <telerik:RadWindow runat="server" ID="winDetailForm" InitialBehaviors="Close" Modal="true" Title="Detail Form" RestrictionZoneID="ContentTemplateZone" VisibleOnPageLoad="False"  Height="550px" Width="700px">
                <ContentTemplate>
                     <asp:UpdatePanel ID="upPopUps" runat="server">
                          <ContentTemplate>
                                My data detail is here which is being shown in PopUp...
                          </ContentTemplate>
                     </asp:UpdatePanel>
                </ContentTemplate>
             </telerik:RadWindow>
        </Windows>
</telerik:RadWindowManager>  
<telerik:RadButton runat="server" ID="btnShowDetail" Text="Show Detail" OnClick="btnShowDetail_Click" Style="display: none"></telerik:RadButton>
<script type="text/javascript">
     function grd_DblClick(sender, args) 
     {
         var btnShowDetail = $find("<%=btnShowDetail.ClientID%>");
         btnShowDetail.click();
     }
</script>
我后面的代码是
protected void btnShowDetail_Click(object sender, EventArgs e)
{
     //Fill the PopUp with data and then show it...
     winDetailForm.VisibleOnPageLoad = true;
     winDetailForm.Visible = true;
}

使用部分post back打开RadWindow

请尝试使用下面的代码片段

问题是你的按钮(btnShowDetail)是在更新面板之外,这就是为什么它会打开完整的回发。

<asp:UpdatePanel ID="upGrd" runat="server">
    <ContentTemplate>
        <telerik:RadGrid ID="grd" runat="server" AutoGenerateColumns="false">
            <MasterTableView>
                <Columns>
                    <telerik:GridBoundColumn HeaderText="Header" DataField="ID">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
            <ClientSettings EnableRowHoverStyle="true">
                <ClientEvents OnRowDblClick="grd_DblClick" />
            </ClientSettings>
        </telerik:RadGrid>
        <telerik:RadWindowManager ID="RadWindowManager2" runat="server" EnableShadow="true"
            DestroyOnClose="true">
            <Windows>
                <telerik:RadWindow runat="server" ID="winDetailForm" InitialBehaviors="Close" Modal="true" Title="Detail Form" RestrictionZoneID="ContentTemplateZone" VisibleOnPageLoad="False" Height="550px" Width="700px">
                    <ContentTemplate>
                        My data detail is here which is being shown in PopUp...
                    </ContentTemplate>
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>
        <telerik:RadButton runat="server" ID="btnShowDetail" Text="Show Detail" OnClick="btnShowDetail_Click" Style="display: none"></telerik:RadButton>
    </ContentTemplate>
</asp:UpdatePanel>