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

RadWindow does not display

1 Answer 48 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Steve Holdorf
Top achievements
Rank 1
Steve Holdorf asked on 01 Oct 2013, 06:40 PM
I have a RadGrid using a standard grid hierarchy and am trying to open a RadWindow from within the OnItemCommand event when a radbutton column item is selected. When I select the button the code below does run (checked using a break point); however, the radwindow does not open and the radgrid itself appears to do a partial postback. Any Ideas why the rad window does not display? The code is  as follows:

protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
 {
         if (e.CommandName == "ButtonEdit")
         {
                 //opening window
                RadWindow newWindow = new RadWindow();

                 newWindow.ID = "RadWindow1";

                 newWindow.NavigateUrl = "Window1.aspx";

                 newWindow.VisibleOnPageLoad = true;

                 RadWindowManager1.Windows.Add(newWindow);
        }
   }

Also note, the RadWindowManager is valid as it is used elsewhere on the page with no problems.

Thanks,


Steve Holdorf

1 Answer, 1 is accepted

Sort by
0
Accepted
Jayesh Goyani
Top achievements
Rank 2
answered on 02 Oct 2013, 05:43 AM
Hello,

Please try with the below code snippet.

<form id="form1" runat="server">
    <div>
        <telerik:RadScriptManager ID="RadScriptManager1" runat="server"></telerik:RadScriptManager>
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server"></telerik:RadWindowManager>
        <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
            <AjaxSettings>
                <telerik:AjaxSetting AjaxControlID="RadGrid1">
                    <UpdatedControls>
                        <telerik:AjaxUpdatedControl ControlID="RadGrid1" LoadingPanelID="RadAjaxLoadingPanel1" />
                        <telerik:AjaxUpdatedControl ControlID="RadWindowManager1" />
                    </UpdatedControls>
                </telerik:AjaxSetting>
            </AjaxSettings>
        </telerik:RadAjaxManager>
        <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server"></telerik:RadAjaxLoadingPanel>
        <telerik:RadGrid ID="RadGrid1" runat="server" AutoGenerateColumns="false" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand">
            <MasterTableView CommandItemDisplay="Top" DataKeyNames="ID">
                <Columns>
                    <telerik:GridBoundColumn DataField="Name" UniqueName="Name" HeaderText="Name"></telerik:GridBoundColumn>
                    <telerik:GridButtonColumn Text="ButtonEdit" CommandName="ButtonEdit"></telerik:GridButtonColumn>
                </Columns>
            </MasterTableView>
        </telerik:RadGrid>
    </div>
</form>
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    dynamic data1 = new[] {
           new { ID = 1, Name ="Name_1",Customdate = DateTime.Now},
           new { ID = 2, Name = "Name_2",Customdate = DateTime.Now},
           new { ID = 3, Name = "Name_3",Customdate = DateTime.Now},
           new { ID = 4, Name = "Name_4",Customdate = DateTime.Now},
           new { ID = 5, Name = "Name_5",Customdate = DateTime.Now}
       };
    RadGrid1.DataSource = data1;
}
protected void RadGrid1_ItemCommand(object sender, GridCommandEventArgs e)
{
    if (e.CommandName == "ButtonEdit")
    {
        RadWindow newWindow = new RadWindow();
        newWindow.ID = "RadWindow1";
        newWindow.NavigateUrl = "Window1.aspx";
        newWindow.VisibleOnPageLoad = true;
        RadWindowManager1.Windows.Add(newWindow);
    }
}


Let me know if any concern.

Thanks,
Jayesh Goyani
Tags
Grid
Asked by
Steve Holdorf
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or