How to close radwindow and refersh the parent radgrid and stay on the page where opens the radwindow

2 posts, 0 answers
  1. JJ
    JJ avatar
    147 posts
    Member since:
    May 2010

    Posted 08 Feb 2013 Link to this post

    I have a radgrid, click a hyperlink column on the radgrid opens a rad window, after I edit the text field on the rad window, I need to close the radwindow and refresh the grid to show the text change. The grid has mutiple  pages. If I was on page 5 before open the radwinow, after close radwindow, grid gets refreshed and goes to page 1. Is there anyway that I can let the grid stays on page 5 after radwindow close?


    <telerik:GridHyperLinkColumn DataNavigateUrlFields="TagID, LanguageID2" SortExpression="TagName"  ShowFilterIcon="false"
                                           DataTextField="TagName" HeaderText="Tag Name" FilterControlWidth="100px" UniqueName="TagName"
                                           AutoPostBackOnFilter="true" CurrentFilterFunction="Contains"  
                                           DataNavigateUrlFormatString="javascript:function anon(){{window.radopen('MyPopUp.aspx?TID={0}&LID={1}','TranslationView');}};anon();">
                                           <HeaderStyle Width="100px" />
                                       </telerik:GridHyperLinkColumn>
    <
    script type="text/javascript">
          function OnClientClose(sender, args) {
                   top.location.href = top.location.href;
          }
      </script>
    Thanks!
  2. Vasil
    Admin
    Vasil avatar
    1547 posts

    Posted 13 Feb 2013 Link to this post

    Hello JJ,

    You didn't say what binding are you using server or client. I will assume that you are using server side binding, because of the AutoPostBackOnFilter that you are using.

    What you can do is as follows: during the PreRender of your page of your grid, save the grid.CurrentPageIndex into the session object or inside an asp:HiddenField. This way you will know what was the previous index.

    Then on client closing of your window, you can update another HiddenField's value (or use the same field based on your code logic), to indicate that you need to change the index server side.

    Then on Page_Load of your page  or in the ItemCommand of your grid set grid.CurrentPageIndex to the old value and then rebind the grid.

    Kind regards,
    Vasil
    the Telerik team
    If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top