ASP.NET AJAX - Dynamically open Multiple RadWindows from Code behind

2 posts, 0 answers
  1. Naveen
    Naveen avatar
    4 posts
    Member since:
    Jan 2012

    Posted 12 Aug 2014 Link to this post

    Hi,

    I have a Radgrid from where i have to select multiple rows and on click on button in RadToolBar, i need to open a seperate Radwindow for each Row selected from code behind. All the Radwindows should be minimised except the last one.

    Please suggest.

    Thanks in advance!
  2. Shinu
    Shinu avatar
    17764 posts
    Member since:
    Mar 2007

    Posted 13 Aug 2014 in reply to Naveen Link to this post

    Hi Naveen,

    Please try the below sample code snippet which works fine at my end.

    ASPX:
    <telerik:RadGrid ID="rgrdOrders" runat="server" AllowPaging="true" DataSourceID="sqldsOrders" AllowMultiRowSelection="true">
        <ClientSettings Selecting-AllowRowSelect="true">
        </ClientSettings>
    </telerik:RadGrid>
    <telerik:RadToolBar ID="rtoolbarOpenWin" runat="server" OnButtonClick="rtoolbarOpenWin_ButtonClick">
        <Items>
            <telerik:RadToolBarButton Text="Open Widow">
            </telerik:RadToolBarButton>
        </Items>
    </telerik:RadToolBar>

    C#:
    protected void rtoolbarOpenWin_ButtonClick(object sender, Telerik.Web.UI.RadToolBarEventArgs e)
    {
        int count;
        for (count = 1; count <= rgrdOrders.SelectedItems.Count; count++)
        {
            RadWindow newWindow = new RadWindow();
            newWindow.ID = "RadWindow" + count;
            newWindow.VisibleOnPageLoad = true;
            form1.Controls.Add(newWindow);
            if (count != rgrdOrders.SelectedItems.Count)
            {
                string script = "function f(){minimizeWindow('"+newWindow.ClientID+"'); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "key", script, true);
            }
        }
    }

    JavaScript:
    function minimizeWindow(rWindow) {
        var window = document.getElementById(rWindow);
        window.control.Minimize();
    }

    Thanks,
    Shinu.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top