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

Is it broken? or am I doing it wrong?

2 Answers 41 Views
Window
This is a migrated thread and some comments may be shown as answers.
Stuart Hemming
Top achievements
Rank 2
Stuart Hemming asked on 18 Jan 2010, 03:22 PM
I have created a user control to act as a placeholder for a number of common dialogs and it works just as you would expect.

Except...

One of the windows needs a OnClientClose function and, each calling page is going to need to do something different. So, in my CommonDialogs control I have this ...
    function OpenCommonGroupSubscription(OnClientClose) { 
      var manager = $find("<%= wmCommonDialogs.ClientID %>"); 
      var wnd = manager.getWindowById("<%= winGroupSubscription.ClientID %>"); 
      if (OnClientClose != null && OnClientClose != "") { 
        wnd.add_close(OnClientClose); 
      } 
      wnd.show(); 
      return false
    } 

My calling code looks, called from the codebehind of the main page, looks like this ...
LocalManager.ResponseScripts.Add("OpenCommonGroupSubscription('SubscribeToGroups_ClientClose');"); 

And this is the definition of the function in the markup of the main page ...
      function SubscribeToGroups_ClientClose(sender, args) { 
        setTimeout(function() { 
          AjaxRequestWithTarget("<%= btnHiddenPostback.UniqueID %>""SubscribeToGroups;"); 
        }, 500); 
      }

Now, if I have the definition of the GroupSubscription window on the main page and I have the OnClientClose function name in the <RadWindow> definition, everything works, but the set up described above when the GroupSubscription window closes, I get a JavaScript error ...

a[b] is not a function
http://localhost/v1.1/MyApplication/Telerik.Web.UI.WebResource.axd?_TSM_HiddenField_=ctl00_RadScriptManager1_TSM&compress=1&_TSM_CombinedScripts_=%3b%3bSystem.Web.Extensions%2c+Version%3d3.5.0.0%2c+Culture%3dneutral%2c+PublicKeyToken%3d31bf3856ad364e35%3aen-GB%3a0d787d5c-3903-4814-ad72-296cea810318%3aea597d4b%3ab25378d2%3bTelerik.Web.UI%2c+Version%3d2009.3.1208.35%2c+Culture%3dneutral%2c+PublicKeyToken%3d121fae78165ba3d4%3aen-GB%3a6ed19be3-4ef3-4060-9b74-4985886ad7d9%3a16e4e7cd%3aed16cbdc%3af7645509%3a86526ba7%3a874f8ea2%3a11a04f7e%3a24ee1bba%3ae330518b%3a1e771326%3ac8618e41%3a8e6f0d33%3a6a6d718d%3aa7e79140%3ae524c98b%3a4cacbc31%3ab7778d6c%3aaa288e2d%3a58366029%3a19620875%3a33108d14%3abd8f85e4%3a39040b5c%3af85f9819
Line 6

If anyone can shed any light on this, I'd be grateful.
--
Stuart







2 Answers, 1 is accepted

Sort by
0
Stuart Hemming
Top achievements
Rank 2
answered on 18 Jan 2010, 03:31 PM
If it helps at all, the attached image shows the expanded detail of the error reported in FireBug ...

--
Stuart
0
Stuart Hemming
Top achievements
Rank 2
answered on 19 Jan 2010, 02:00 PM
And the answer is ...

I was doing it wrong. (No real surprises there!)

The problem was in my call the the JavaScript OpenCommonGroupSubscription() function in my code behind.

It took me ages to realise that the add_ and remove_ methods of RadWindow take pointers to the functions and not their names and, therefore, that I needed to pass the function in as a parameter, so the line should have read ...
LocalManager.ResponseScripts.Add("OpenCommonGroupSubscription(SubscribeToGroups_ClientClose);"); 

C'est la vie.

--
Stuart



Tags
Window
Asked by
Stuart Hemming
Top achievements
Rank 2
Answers by
Stuart Hemming
Top achievements
Rank 2
Share this question
or