This is a migrated thread and some comments may be shown as answers.

RadConfirm-type dialog within RadWindow

3 Answers 67 Views
Window
This is a migrated thread and some comments may be shown as answers.
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
ToltingColtAcres asked on 27 Jan 2014, 06:57 PM
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

3 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 28 Jan 2014, 05:50 AM
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.
0
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
answered on 28 Jan 2014, 12:01 PM
Thanks for the sample. I'll work with this today in my app and see if I can get it working.
0
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
answered on 28 Jan 2014, 05:50 PM
This worked excellent. Thank you.
Tags
Window
Asked by
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
Answers by
Shinu
Top achievements
Rank 2
ToltingColtAcres
Top achievements
Rank 2
Veteran
Iron
Share this question
or