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

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

1 Answer 19 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Naveen
Top achievements
Rank 1
Naveen asked on 12 Aug 2014, 03:18 PM
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!

1 Answer, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 1
answered on 13 Aug 2014, 08:13 AM
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.
Tags
General Discussions
Asked by
Naveen
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 1
Share this question
or