Framework / Thin Web / Custom Requests
In This Topic
    Custom Requests
    In This Topic

    Custom Requests allow you to initiate an AJAX update of the ThinWeb control from the client. In order to do that you must first ensure that you can reference the ThinWeb client host div by setting a custom StateId on the server - for example:

    C#
    Copy Code
    thinWebControl.StateId = "ThinWebControl1";
    Visual Basic
    Copy Code
    thinWebControl.StateId = "ThinWebControl1";

    Then using JavaScript you can send custom requests to the control:

    JavaScript
    Copy Code

    <script language='javascript'>

    function UpdateThinWebControl() {

    NClientNode.GetFromId("ThinWebControl1").ExecuteCustomRequest("Custom Request Parameter");

    }

    </script>

    On the server you need to register a custom request callback that is executed when the client sends a custom request to the server:

    C#
    Copy Code

      protected void Page_Load(object sender, System.EventArgs e)
      {
       if (!thinWebControl.Initialized)
       {
        // Set manual ID so that it can be referenced in JavaScript
        thinWebControl.StateId = "ThinWebControl1";

        // register a custom request callback
        thinWebControl.CustomRequestCallback = new CustomRequestCallback();

       }
      }

      [Serializable]
      public class CustomRequestCallback : INCustomRequestCallback
      {
       #region INCustomRequestCallback Members

       void INCustomRequestCallback.OnCustomRequestCallback(NAspNetThinWebControl control, string argument)
       {
        // Modify the control document here and call Update to refresh the client content
        control.Update();
       }

       #endregion
      }

     Related Examples

    Nevron Chart\Web Forms\ThinWeb\Custom Requests