How to display a RadWindow from the code behind

3 posts, 1 answers
  1. Herman Gouw
    Herman Gouw avatar
    100 posts
    Member since:
    Aug 2012

    Posted 29 Sep 2010 Link to this post


    I am using Telerik RadControls for ASP.NET AJAX Q2 2010 in my current project.

    On one of the web pages there are 2 RadListBoxes (i.e. RadListBox1 and RadListBox2).

    When the user transfers any items from RadListBox1 to RadListBox2, the web page will display a RadWindow containing a legal waiver statement with 2 buttons, OK and Cancel. If the user clicks on Cancel button, the transfer operation will be cancelled.

    In order to do this, I need to display a RadWindows in RadListBox's event handler RadListBox_Transferring.

    I could not find any samples on how to do this.

    Can you please show me how to do the following:
    1. display the RadWindow in the code behind RadListBox_Transferring
    2. detect if the Cancel button is clicked on the RadWindow so that I can cancel the transfer operation (i.e. set e.Cancel to true).

    The code is as follows:
    <form id="form1" runat="server">
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server" />
        <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server">
            <telerik:RadListBox ID="RadListBox1" AllowDelete="false" AllowReorder="false"
                AllowTransfer="true" AutoPostBackOnTransfer="true" TransferMode="Move"
                TransferToID="RadListBox2" OnTransferring="RadListBox_Transferring"
                runat="server" />
            <telerik:RadListBox ID="RadListBox2" AutoPostBackOnTransfer="true"
                OnTransferring="RadListBox_Transferring" runat="server" />
        <telerik:RadWindowManager ID="RadWindowManager1" ReloadOnShow="true"
            ShowContentDuringLoad="false" runat="server" />

    public partial class ListBoxes : Page
        protected void Page_Load(object sender, EventArgs e)
            if (!IsPostBack)
                this.RadListBox1.Items.Add(new RadListBoxItem("Item1"));
                this.RadListBox1.Items.Add(new RadListBoxItem("Item2"));
        protected void RadListBox_Transferring(object sender, RadListBoxTransferringEventArgs e)
            if (e.DestinationListBox.ID == "RadListBox2")
                // Display RadWindow here
                // If user clicks the cancel button then do "e.Cancel = true;"

  2. Answer
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 29 Sep 2010 Link to this post

    Hello Herman,

    Here is the code that I tried to open the RadWindow from code.

    protected void Button1_Click(object sender, EventArgs e) 
        RadWindow newWindow = new RadWindow(); 
        newWindow.NavigateUrl = "Redirect.aspx" 
        newWindow.VisibleOnPageLoad = true

    You can also go through the following documentation for more information:
    Setting Server-Side Properties

  3. DevCraft R3 2016 release webinar banner
  4. Herman Gouw
    Herman Gouw avatar
    100 posts
    Member since:
    Aug 2012

    Posted 04 Oct 2010 Link to this post

    Thanks Princy.
Back to Top