RadWindow causes page reload

6 posts, 0 answers
  1. Victor
    Victor avatar
    1 posts
    Member since:
    Feb 2008

    Posted 09 Feb 2008 Link to this post

    Hi, I have a button to programatically build the url for one RadWindow, but I have some strange problem showing the window, after the Window is closed, every control that must initiate an Ajax request forces a page reload on postback and the window apperas again.


    This is my code on the page

        <script type="text/javascript">
       
        function OpenFreqWindow()
        {
            var mgr =  $find('RadWindowManager1'); // GetRadWindowManager();
    //        alert(mgr);
            mgr.show();
            return false;
        }           
        function OpenWindow(url)
        {                     
            var mgr =  $find('RadWindowManager1'); // GetRadWindowManager();
            //alert(mgr);       
            var wnd = mgr.open(url, null);                              
            return false;
        }              
        </script>


    this is the RadWindowManager

        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" Skin="Vista" Animation="None" Behavior="Default" Behaviors="Default" InitialBehavior="None" InitialBehaviors="None" Left="" Top="">
            <Windows>
                <telerik:RadWindow runat="server" Animation="None" Behavior="Default" Behaviors="Default"
                    InitialBehavior="None" InitialBehaviors="None" Left="" NavigateUrl=""
                    Skin="Vista" Style="display: none;" Top="" Modal="True" Width="500px" Height="500px">
                </telerik:RadWindow>
            </Windows>
        </telerik:RadWindowManager>

    the code behind

        protected void btnShowWindow_Click(object sender, EventArgs e)
        {
                String url = "SomePage.aspx?source=fromWindow";
                GridItemCollection items = RadGrid1.Items;
                foreach (GridDataItem item in items)
                {
                    TableCell cell = item["CheckBoxTemplateColumn"];
                    CheckBox chkItem = cell.Controls[1] as CheckBox;
                    if (chkItem.Checked)
                    {
                        ++docCount;
                        url += "&doc"+docCount.ToString()+"=" + item["CustomerID"].Text;
                    }
                }
                InjectScript.Text = "<script type='text/javascript'>Sys.Application.add_load(function(){OpenWindow('" + url + "')})</script>";
            }
        }

    Can somebody help me with this issue? I've spent 2 days trying to figure out what's wrong

    Any help would be appreciated

    Thanks in advance
  2. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 12 Feb 2008 Link to this post

    Hello Victor,

    I am afraid that the provided information is not enough to determine what the reason for the problem might be and we are unable to reproduce it.

    To be able to help we need a better look over your exact setup - a sample project along with reproduction instructions will help us understand better your scenario and provide you with the appropriate solution. Please open a new support ticket and send us such sample - we will check it right away.



    Sincerely yours,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paul
    Paul avatar
    16 posts
    Member since:
    Mar 2009

    Posted 02 Jun 2009 Link to this post

    Hi

    I am having the same problem.  I have a page with a radgrid on it.  I have item buttons to display additional information in a radwindow.  When the button is clicked the page reloads/redisplays and then the radwindow pops up.  If the person had scrolled down the page then they are put back to the top of the page which is no good.

    This is the radwindowmanager definition.
        <telerik:RadWindowManager ID="RadWindowManager1" runat="server" VisibleStatusbar="false" 
            Width="768" Height="582" DestroyOnClose="true" ShowContentDuringLoad="false" ReloadOnShow="false"
        </telerik:RadWindowManager> 
     
     

    This is the button definition on the grid.
                                <telerik:GridTemplateColumn UniqueName="TemplateColumn" HeaderText="Bio"
                                    <ItemTemplate> 
                                        <asp:Button ID="BioButton" runat="server" OnCommand="bioButton_Command" CommandArgument='<%# DataBinder.Eval(Container.DataItem, "Child_Number").ToString().Trim()%>' 
                                            Text="Bio"></asp:Button> 
                                    </ItemTemplate> 
                                </telerik:GridTemplateColumn> 
     
     

    This is the code behind for the button.
            protected void bioButton_Command(object sender, CommandEventArgs e) 
            { 
                RadWindow newWindow = new RadWindow(); 
                newWindow.NavigateUrl = "BioDisplay.aspx?ChildToDisplay=" + e.CommandArgument; 
                newWindow.VisibleOnPageLoad = true
                newWindow.Modal = true
                newWindow.Behaviors = WindowBehaviors.Close; 
                RadWindowManager1.Windows.Add(newWindow); 
            } 
     
     

    How do I stop the main page from reloading?

    Thanks Paul
  5. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 03 Jun 2009 Link to this post

    Hello Paul,

    This behavior is expected - you are doing a postback. If you want to avoid that, you could use RadAjax and Ajax callbacks, or you could open the RadWindow by using its client-side API.



    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
  6. Seth
    Seth avatar
    90 posts
    Member since:
    Jun 2007

    Posted 26 Jun 2009 Link to this post

    Unfortunately opening the window client-side also causes a problem when you are scolled down the page.  The window is displayed at the center position of where you were scrolled, but the page is then scrolled back to the top of the page.  Is there a way around this?
  7. Georgi Tunev
    Admin
    Georgi Tunev avatar
    7207 posts

    Posted 29 Jun 2009 Link to this post

    Hi Seth,

    Please open a support ticket and send us a sample page where this issue could be reproduced. We will check it and get back to you.


    Best wishes,
    Georgi Tunev
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017