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

How to refresh RadWindow content OnLoad?

5 Answers 492 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Oleg
Top achievements
Rank 1
Oleg asked on 19 Dec 2012, 08:11 PM
I have RadGrid inside of RadWindows. I need to refresh RadGrid every time when RadWindow shows. How to do it?
<script type="text/javascript">
    function closeCustomConfirm() {
        $find("<%=rwApproveInstance.ClientID %>").close();
    }
    function ShowRadWindow() {
        var oWnd = $find("<%=rwApproveInstance.ClientID %>");
        oWnd.show();
    }
</script>
<telerik:RadWindowManager runat="server" ID="RadWindowManager1" >
    <Windows>
        <telerik:RadWindow ID="rwApproveInstance" Modal="true" Behaviors="Close, Move" VisibleStatusbar="false"
            Width="800px" Height="700px" runat="server" ReloadOnShow="True" ShowContentDuringLoad="False">
            <ContentTemplate>
                <div class="rwDialogPopup radconfirm">
                    <div>
                        <telerik:RadGrid ID="rgApprovalInstance" runat="server" AutoGenerateColumns="False"
                            CellSpacing="0" GridLines="None" OnNeedDataSource="rgApprovalInstance_NeedDataSource">
                            <MasterTableView DataKeyNames="FieldName">
                                <CommandItemSettings ExportToPdfText="Export to PDF"></CommandItemSettings>
                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
                                <Columns>
                                    <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" FilterControlAltText="Filter FieldName column"
                                        Groupable="False" HeaderText="FieldName" UniqueName="FieldName" DataField="FieldName">
                                        <HeaderStyle CssClass="documents-table" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn AllowFiltering="False" AllowSorting="False" DataField="FieldValue"
                                        FilterControlAltText="Filter FieldValue column" Groupable="False" HeaderText="FieldValue"
                                        ReadOnly="True" UniqueName="FieldValue">
                                        <HeaderStyle CssClass="documents-table" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                        </telerik:RadGrid>
                    </div>
                    <div>
                        <telerik:RadButton runat="server" ID="rbConfirm_Cancel" Text="Close" OnClientClicked="closeCustomConfirm">
                        </telerik:RadButton>
                    </div>
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

5 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 20 Dec 2012, 04:56 AM
Hi,

With respect to this forum thread there is no "reload" method for content template containers (in the framework) and the main reason for that is that there is no way to know what exactly the user /developer wants - should the content be reset, or should it preserve some values.

One suggestion is that you can refresh the ContentTemplate manually and you need to put the update panel directly in the ContentTemplate as shown below.

ASPX:
<telerik:RadWindow ID="rwApproveInstance" .........>
     <ContentTemplate>
       <asp:UpdatePanel ID="Updatepanel1" runat="server" UpdateMode="Conditional">
          <ContentTemplate>
               <telerik:RadGrid ID="RadGrid1">
                    ..............
               </telerik:RadGrid>
           </ContentTemplate>
        </asp:UpdatePanel>
   </ContentTemplate>
</telerik:RadWindow>

JS:
<script type="text/javascript">
    function OnClientShow(sender, args) {
        var grid = $find("<%= RadGrid1.ClientID %>")
        grid.get_masterTableView().rebind();
    }
</script>

Hope this helps.

Regards,
Princy.
0
Oleg
Top achievements
Rank 1
answered on 20 Dec 2012, 07:56 PM
Thanks for answer,
 
But for some reason this approach is not working for me. I am getting the error below. But I could rebind RadGrid and open RadWindow from the sever side code.
Cannot unregister UpdatePanel with ID 'Updatepanel1' since it was not registered with the ScriptManager. This might occur if the UpdatePanel was removed from the control tree and later added again, which is not supported.
Parameter name: updatePanel
0
Princy
Top achievements
Rank 2
answered on 21 Dec 2012, 03:54 AM
Hi,

Unfortunately i couldn't replicate the issue that you are facing at my end. After having some research I found that this forum thread discuss the same issue. Please take a look into that and let me know whether it helps.

Regards,
Princy.
0
Abitar
Top achievements
Rank 1
answered on 23 Oct 2015, 10:39 AM

Hello, 

Did anyone find a solution for this issue ?

 Regards,

Abitar

0
Oleg
Top achievements
Rank 1
answered on 23 Oct 2015, 07:52 PM

I could resolve the issue. You have to open RadWindows from code behind and refresh data manually.

string script1 = "function f(){$find(\"" + rwActivityGrid.ClientID + "\").show(); Sys.Application.remove_load(f);}Sys.Application.add_load(f);";
RadScriptManager.RegisterStartupScript(Page, Page.GetType(), "ShowRadWindowInstance", script1, true);
 
rgActivityGrid.DataSource = GetDataSource();
rgActivityGrid.DataBind();

    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" DefaultLoadingPanelID="radloadingprogressbar">
         <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="RadGrid1">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1"  LoadingPanelID="radloadingprogressbar"/>
                    <telerik:AjaxUpdatedControl ControlID="rwActivityGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
             <telerik:AjaxSetting AjaxControlID="btnSaveFilter" >
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelRenderMode="Inline"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="rwActivityGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="btnClearFilter">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadGrid1" UpdatePanelRenderMode="Inline"></telerik:AjaxUpdatedControl>
                    <telerik:AjaxUpdatedControl ControlID="rwActivityGrid" />
                </UpdatedControls>
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="radloadingprogressbar" runat="server" Skin="Web20" >
</telerik:RadAjaxLoadingPanel>
   
<telerik:RadWindowManager runat="server" ID="RadWindowManager1">
    <Windows>
        <telerik:RadWindow ID="rwActivityGrid" Modal="true" Behaviors="Close, Move" VisibleStatusbar="false"
            runat="server" ReloadOnShow="True" ShowContentDuringLoad="False" Width="950px"
            Height="500px">
            <ContentTemplate>
                <asp:ImageButton ID="imbPrint" ImageUrl="~/_layouts/CAPEXAFEWorkflowDashboardWebPart/printer_4.png" runat="server" OnClientClick="PrintContent();return false;" CssClass="printBtn" />
                <div id="divPrinting" class="rwDialogPopup radconfirm">
                    AFE / AFD Number:
                    <asp:Label ID="labAFENumber" runat="server" Text=""></asp:Label>
                    <div>
                        <telerik:RadGrid ID="rgActivityGrid" runat="server" AutoGenerateColumns="False" CellSpacing="0"
                            GridLines="None" OnItemDataBound="rgActivityGrid_ItemDataBound">
                            <MasterTableView>
                                <CommandItemSettings ExportToPdfText="Export to PDF" ShowExportToWordButton="true"
                                    ShowExportToExcelButton="true" ShowExportToCsvButton="true"></CommandItemSettings>
                                <RowIndicatorColumn Visible="True" FilterControlAltText="Filter RowIndicator column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <ExpandCollapseColumn Visible="True" FilterControlAltText="Filter ExpandColumn column">
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </ExpandCollapseColumn>
                                 <NoRecordsTemplate>
                <div style="text-align:center;height:40px;padding-top:20px;font-size:small;color:Red">
                   <span style="vertical-align: middle;text-align:center"> No Records To Display</span>
                </div>
                </NoRecordsTemplate>
                                <Columns>
                                    <telerik:GridBoundColumn DataField="ActivityName" FilterControlAltText="Filter column column"
                                        HeaderText="Activity Name" UniqueName="ActivityName">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Destination" FilterControlAltText="Filter column1 column"
                                        HeaderText="Destination" UniqueName="Destination">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="StartDate" FilterControlAltText="Filter column2 column"
                                        HeaderText="Start Date" UniqueName="StartDate">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="FinishDate" FilterControlAltText="Filter column3 column"
                                        HeaderText="Finish Date" UniqueName="FinishDate">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Status" FilterControlAltText="Filter column4 column"
                                        HeaderText="Status" UniqueName="Status">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Duration" FilterControlAltText="Filter column5 column"
                                        HeaderText="Duration" UniqueName="Duration">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="Final_Action" FilterControlAltText="Filter column6 column"
                                        HeaderText="Final Action" UniqueName="Final_Action">
                                        <ItemStyle Wrap="False" />
                                    </telerik:GridBoundColumn>
                                </Columns>
                                <EditFormSettings>
                                    <EditColumn FilterControlAltText="Filter EditCommandColumn column">
                                    </EditColumn>
                                </EditFormSettings>
                            </MasterTableView>
                            <FilterMenu EnableImageSprites="False">
                            </FilterMenu>
                        </telerik:RadGrid>
                    </div>
                </div>
            </ContentTemplate>
        </telerik:RadWindow>
    </Windows>
</telerik:RadWindowManager>

 

Tags
General Discussions
Asked by
Oleg
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Oleg
Top achievements
Rank 1
Abitar
Top achievements
Rank 1
Share this question
or