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

RadWindow - Close & Sort Issue

3 Answers 79 Views
Window
This is a migrated thread and some comments may be shown as answers.
larry reames
Top achievements
Rank 1
larry reames asked on 05 May 2011, 02:51 PM
I have a RadWindow with a RadGrid. How can I close this window after the OnItemCommand event??

AHIA,
Larry...

<Windows>
           <telerik:RadWindow ID="GLLookupWindow" runat="server" Behaviors="Close" Width="900" Height="700" OnClientClose="UnhideIframe_OnClientClose">
            <ContentTemplate>
 
               <asp:Panel runat="server" ID="pnlGLLookup" Visible="true" TabIndex="-1">
 
                   <telerik:RadGrid AutoGenerateColumns="False" ID="GLLookup" OnItemCommand ="GLLookup_ItemCommand" AllowFilteringByColumn="true" OnItemCreated="GLLookup_ItemCreated"
                   DataSourceID="SqlDataSourceGLLookupwindow" AllowSorting="true" runat="server" PagerStyle-AlwaysVisible="true" AllowPaging="true" PageSize ="20" >
                       <GroupingSettings CaseSensitive="false" />
                       <MasterTableView DataKeyNames="GCMGRP,GCACCT,GCSACT,GCDEPT,GCDESC" >
                        <PagerStyle Mode="NumericPages" PageButtonCount="5" />
                           <Columns>
                               <telerik:GridBoundColumn HeaderText="Major" DataField="GCMGRP" UniqueName="GCMGRP" AllowFiltering="true"
                                   SortExpression="GCMGRP" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                               <telerik:GridBoundColumn HeaderText="Acct" DataField="GCACCT" UniqueName="GCACCT" AllowFiltering="true"
                                   SortExpression="GCACCT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                               <telerik:GridBoundColumn HeaderText="Sub" DataField="GCSACT" UniqueName="GCSACT" AllowFiltering="true"
                                   SortExpression="GCSACT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                                <telerik:GridBoundColumn HeaderText="Dept/Loc" DataField="GCDEPT" UniqueName="GCDEPT" AllowFiltering="true"
                                   SortExpression="GCDEPT" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                                <telerik:GridBoundColumn HeaderText="Description" DataField="GCDESC" UniqueName="GCDESC" AllowFiltering="true"
                                   SortExpression="GCDESC" HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center"
                                   HeaderStyle-VerticalAlign="Bottom" />
                           </Columns>
                           <ItemStyle Wrap="false" />
                              <PagerStyle Mode="NumericPages" AlwaysVisible="true"></PagerStyle>
                       </MasterTableView>
                       <ClientSettings EnablePostBackOnRowClick="true" >
                       </ClientSettings>
                   </telerik:RadGrid>
               </asp:Panel>
 
             
             
            </ContentTemplate>
           </telerik:RadWindow>
</Windows>

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 06 May 2011, 07:25 AM
Hello Larry,

You can achieve this by using the RegisterStartupScript() server method to invoke the client method to close windows. More information on invoking the client function will be available in the KB Article.
 "Calling radalert from codebehind"

Thanks,
Princy.
0
Accepted
Svetlina Anati
Telerik team
answered on 06 May 2011, 02:15 PM
Hello larry,

Your code should look like the following:


string script = String.Format("var win = $find('{0}'); if (win && win.isVisible()) win.close;", GLLookupWindow.ClientID);
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "closeWin", script, true);

Please, test it on your side and let us know how it goes.
 

Greetings,
Svetlina
the Telerik team

Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.

0
larry reames
Top achievements
Rank 1
answered on 06 May 2011, 04:21 PM
The solution you provided pointed me in the right direction (THANKS!!!!).  There was a syntax issue win.close() vs. win.close.  I also removed the win reference in the if statement, script did not fire when it was in there.

string script = String.Format("var win = $find('{0}'); if (win.isVisible()) win.close();", GLLookupWindow.ClientID);
ScriptManager.RegisterStartupScript(this.Page, Page.GetType(), "closeWin", script, true);
 

Thanks for you assistance!!!!

LarryR!!!!
Tags
Window
Asked by
larry reames
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Svetlina Anati
Telerik team
larry reames
Top achievements
Rank 1
Share this question
or