sachin T
sachin T

Reputation: 27

How to close rad window in c# on button Click using JS

i have tried to close window(radWindow) using asp.net C#, but error on java script function is that 'object required' ,How can i solve this?

My java script and asp.net code is

 <script type="text/JavaScript">
      function Close() {
           GetRadWindow().Close();
       }

  </script>

Asp.net code is

 <asp:Button ID="btnSubmit" runat="server" Text="Submit Request" Height="27px" OnClick= "btnSubmit_Click" OnClientClick="Close();return false;" />

Optional try using C# for same operation as

C# code for button is

 protected void btnSubmit_Click(object sender, EventArgs e)
 {
    //Server code
   ScriptManager.RegisterStartupScript(this,GetType(), "close", "Close();", true);
 }

Upvotes: 1

Views: 4628

Answers (2)

zey
zey

Reputation: 6103

You call GetWindow() but you don't have this function .
Just add this code ,

 function GetWindow()
    {
        var oWindow = null;
        if (window.radWindow) oWindow = window.radWindow;
        else if (window.frameElement.radWindow) oWindow = window.frameElement.radWindow;
        return oWindow;
    }

Upvotes: 1

Binson Eldhose
Binson Eldhose

Reputation: 749

This post may help you lot

http://www.telerik.com/community/forums/aspnet-ajax/window/getradwindow-close-cause-unspecified-error.aspx

i had same issues in the past but manged by the logic from the above post

Upvotes: 0

Related Questions