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

RadWindow causes page reload

5 Answers 252 Views
Window
This is a migrated thread and some comments may be shown as answers.
Victor
Top achievements
Rank 1
Victor asked on 09 Feb 2008, 09:39 AM

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

5 Answers, 1 is accepted

Sort by
0
Georgi Tunev
Telerik team
answered on 12 Feb 2008, 11:54 AM
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
0
Paul
Top achievements
Rank 2
answered on 03 Jun 2009, 03:29 AM
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
0
Georgi Tunev
Telerik team
answered on 03 Jun 2009, 08:33 AM
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.
0
Seth
Top achievements
Rank 1
answered on 26 Jun 2009, 12:46 PM
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?
0
Georgi Tunev
Telerik team
answered on 29 Jun 2009, 06:33 AM
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.
Tags
Window
Asked by
Victor
Top achievements
Rank 1
Answers by
Georgi Tunev
Telerik team
Paul
Top achievements
Rank 2
Seth
Top achievements
Rank 1
Share this question
or