title: Cannot read property 'length' of null: using `sender.set_selectedToggleStateIndex(val)` within a nested function that is used as a radprompt callback
body: <p>I'm getting "<strong>TypeError: Cannot read property 'length' of null</strong>" when calling <code>sender.set_selectedToggleStateIndex(val)</code> within a <strong>nested function</strong> that is used as a <strong>radprompt callback</strong>.</p>
  
  <p><strong>sender is a radbutton</strong> (ButtonType = Toggle; ToggleType = CustomToggle). </p>
  
  <p><em>Although this may not be relevant: the radButton is initiated in a radgrid via Custom GridTemplateColumn.</em></p>
  
  <pre><code>OnToggleValueChangingResultHandler = function (sender, e, args, result) {
      if ((result) ? result.isValid : false) {
          return true;
      } else {
          if (result.StatusCode == 200) {
              radprompt(result.message, OnToggleValueChangingPromptCallBackFn, 400, 350, null, result.title || "Prompt - Override", false);
          } else {
              radalert(result.message || "Internal Error Occurred!", 400, 350, result.title || "Alert - Error", null, null);
          }
          return false;
      }
      function OnToggleValueChangingPromptCallBackFn(promptArgs) {
          promptArgs = promptArgs || { "override": false, "note": "" };
          if (promptArgs.override &amp;&amp; promptArgs.note.length &gt; 0) {
              args.Override = promptArgs.override;
              args.OverrideNote = promptArgs.note;
              var result = Paysheet.XHR.POST(args._uri, args);
              result.isValid = true;
              if ((result) ? result.isValid : false) {
                  // $find(sender.id).set_selectedToggleStateIndex(args.newIndex);
                  sender.set_selectedToggleStateIndex(args.newIndex);
  
              } else {
                  if (result.StatusCode == 200) {
                      radalert(result.message || "Override request denied!", 400, 350, result.title || "Alert - Override Denied", null, null);
                  } else {
                      radalert(result.message || "Internal Error Occurred!", 400, 350, result.title || "Alert - Error", null, null);
                  }
              }
          } else {
              // ensuring the control retains the same value; for the prompt is async;
          }
      }
  }
  </code></pre>
  
  <p>This pattern seems to work properly with a radcombobox and a series of radtextboxes. Additionally, the eventArgs seem more robust. </p>
  
  <p>I suspect this issue is rooted in ClientState persistence and referencing: controlStates and/or viewState being lossed.</p>
  
  <p>If I attempt to call <code>sender.get_selectedToggleState()</code> or <code>sender.get_selectedToggleStateIndex()</code> in the PromptCallbackFn, I get an error stating <strong>this._functionality</strong> is undefined. _functionality seems to be in regards to controlstate.</p>
  
  <p><strong>Note:</strong></p>
  
  <p><code>sender.get_clientStateFieldID()</code> returns the ClientID properly, but <code>$find(sender.get_clientStateFieldID())</code> returns <code>null</code>.</p>
  
  <p><code>sender.get_toggleStateData()</code> returns the data properly. but
  <code>sender.get_toggleStates()</code> returns <code>null</code>.</p>
  
  <p><code>sender.get_parent()</code> returns null.</p>