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

Closing RadGrid Edit Form Modal Window

2 Answers 239 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Liam
Top achievements
Rank 1
Liam asked on 23 Jul 2009, 03:20 PM
I'm using a custom user control in my RadGrid to add new customer using the below markup.

<EditFormSettings EditFormType="WebUserControl" UserControlName="~/controls/customer/Details.ascx">  
<PopUpSettings Width="600px" Height="400px" Modal="true" /> 
</EditFormSettings> 

In the user control I have a save button which saves the data to the database and once this is done I want it to close the (modal edit) window and navigate the browser (parent) window to the customer preview screen.

So in my code behind I've placed the following (I've used this code for RadWindows before and it works fine).

string script = "<script language='javascript' type='text/javascript'>CloseAndRedirect('" + VOPCustomerID.ToString() + "');</script>";  
Page.ClientScript.RegisterStartupScript(this.GetType(), "Close", script); 

I have the below in the page (again, used this before with RadWindows and all is fine).

<script type="text/javascript">  
    function CloseAndRedirect(ss)  
    {  
        //Redirect to new url  
        GetRadWindow().BrowserWindow.location.href = '../Customer/Default.aspx?CustID=' + ss;  
        //closes the window  
        GetRadWindow().close();  
    }  
      
    //Get reference to window  
    function GetRadWindow()  
    {  
        var oWindow = null;  
        if (window.radWindow)  
            oWindow = window.radWindow;  
        else if (window.frameElement.radWindow)  
            oWindow = window.frameElement.radWindow;  
        return oWindow;  
    }          
</script> 

As I've said, I've used the above two pieces of code before with RadWindows and all is fine, they close and the browser window navigates to the new screen.

However with the Edit Form, the modal popup does close and then reopens and the browser does not navigate to the preview screen. When I tried removing the redirection in the JavaScript and only close the popup window the same happens, the window closes and then opens again.

Is there some other setting I need to set here?

Thanks.


Liam

2 Answers, 1 is accepted

Sort by
0
Iana Tsolova
Telerik team
answered on 28 Jul 2009, 11:35 AM
Hi Liam,

I went through your code and it looks fine to me. Therefore I suggest that you check out this online demo on window editing for RadGrid and see if you missed something out.

Kind regards,
Iana
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
Dustin Blair
Top achievements
Rank 1
answered on 24 Feb 2010, 08:42 PM
What a cop out!
Tags
Grid
Asked by
Liam
Top achievements
Rank 1
Answers by
Iana Tsolova
Telerik team
Dustin Blair
Top achievements
Rank 1
Share this question
or