使用部分回发打开RadWindow

时间:2014-03-20 09:59:42

标签: c# asp.net ajax updatepanel radgrid

我想通过双击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;
}

1 个答案:

答案 0 :(得分:0)

请尝试使用以下代码段。

问题是您的按钮(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>

如果有任何疑虑,请告诉我。