RadConfirm-type dialog within RadWindow

4 posts, 1 answers
  1. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 27 Jan 2014 Link to this post

    Have a main radWindow w/ WindowManager which opens a child window.

    Within that child window, when the user attempts to do a particular function, I would like to have the user confirm their choice, but have three options
    Yes, Yes (with Backup), No, and then, postback the user's choice to perform a server-side operation.

    I cannot figure out how to create a template for this to pop up from the child window, since it does not have a radWindowManager. If I attempt to add a separate radwindowmanager and template to the child window, all hell breaks loose in the application :)

    If anyone has some guidance as to how this is done, I would appreciate it.

    Thanks,
    Mike

  2. Answer
    Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 27 Jan 2014 in reply to ToltingColtAcres Link to this post

    Hi,

    Please have a look into the sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadWindow ID="RadWindow1" runat="server" VisibleOnPageLoad="true">
        <ContentTemplate>
           <telerik:RadButton ID="RadButton1" runat="server" Text="OpenWindow"                         OnClick="RadButton1_Click">
           </telerik:RadButton>
        </ContentTemplate>
    </telerik:RadWindow>
    <telerik:RadWindow ID="RadWindow2" runat="server">
        <ContentTemplate>
            <telerik:RadButton ID="btnCustomRadWindowConfirm" runat="server" Text="Custom RadWindow                       Confirm" OnClientClicking="CustomRadWindowConfirm" OnClick="Button_Click">
            </telerik:RadButton>
            <asp:Label ID="Label3" runat="server" EnableViewState="false" ForeColor="Green">
            </asp:Label>
            <telerik:RadWindow ID="confirmWindow" runat="server" VisibleTitlebar="false"                             VisibleStatusbar="false" Modal="true" Behaviors="None" Height="150px" Width="300px">
                <ContentTemplate>
                    <div style="margin-top: 30px; float: left;">
                        <div style="width: 60px; padding-left: 15px; float: left;">
                        </div>
                        <div style="width: 200px; float: left;">
                            <asp:Label ID="lblConfirm" Font-Size="14px" Text="Are you sure you                                      want to submit the page?" runat="server">
                                    </
    asp:Label>
                            <br />
                            <br />
                            <telerik:RadButton ID="btnYes" runat="server" Text="Yes"            AutoPostBack="false" OnClientClicked="YesOrNoClicked">
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnYesCallBack" runat="server" Text="YesCallBack" AutoPostBack="false" OnClientClicked="YesOrNoClicked">
                            </telerik:RadButton>
                            <telerik:RadButton ID="btnNo" runat="server" Text="No" AutoPostBack="false" OnClientClicked="YesOrNoClicked">
                            </telerik:RadButton>
                        </div>
                    </div>
                </ContentTemplate>
            </telerik:RadWindow>
        </ContentTemplate>
    </telerik:RadWindow>

    JavaScript:
    <script type="text/javascript">
        function CustomRadWindowConfirm(sender, args) {
            //Open the window
            $find("<%= confirmWindow.ClientID %>").show();
            //Focus the Yes button
            $find("<%= btnYes.ClientID %>").focus();
            //Cancel the postback
            args.set_cancel(true);
        }
        function YesOrNoClicked(sender, args) {
            var oWnd = $find("<%=confirmWindow.ClientID %>");
            oWnd.close();
            if (sender.get_text() == "YesCallBack") {
                $find("<%=btnCustomRadWindowConfirm.ClientID %>").click();
            }
        }
    </script>

    C#:
    protected void RadButton1_Click(object sender, EventArgs e)
    {
        RadWindow2.VisibleOnPageLoad = true;
    }
    protected void Button_Click(object sender, EventArgs e)
    {
        RadButton btn = sender as RadButton;
        Label3.Text = "The <strong>Custom RadWindow Button</strong> submitted the page at: " + DateTime.Now.ToString();
    }

    Let me know if you have any concern.
    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 28 Jan 2014 in reply to Shinu Link to this post

    Thanks for the sample. I'll work with this today in my app and see if I can get it working.
  5. ToltingColtAcres
    ToltingColtAcres avatar
    83 posts
    Member since:
    Nov 2010

    Posted 28 Jan 2014 in reply to ToltingColtAcres Link to this post

    This worked excellent. Thank you.
Back to Top