Intersoft WebDesktop Documentation
Retrieving simple types using WebForm service
Send Feedback
Intersoft WebDesktop > WebFlyPostBackManager > Tutorials > Retrieving simple types using WebForm service

Glossary Item Box

Objectives

This tutorial demonstrates the basic function of WebFlyPostBackManager to retrieve simple-type results from a WebForm (aspx) page.

  1. Drag WebFlyPostBackManager from Toolbox into a WebForm page.



  2. Create a WebForm in the same directory and named it "WebFormListener.aspx". Add the following code in code behind:

    C# Copy Code
    using System;
    using System.Data;
    using System.Configuration;
    using System.Collections;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Web.UI.HtmlControls;
    using ISNet.WebUI.WebDesktop;
    public partial class Samples_WebFlyPostbackManager_WebFormListener : System.Web.UI.Page
    {
    WebFlyPostBackListener listener = null;
        protected void Page_Load(object sender, EventArgs e)
    {
    listener = new WebFlyPostBackListener(this);
    }
        [WebFlyPostBackMethod()]
    public string HelloWorld()
    {
    return "Hello World";
    }
    }

  3. Set ServiceType to WebForm and ServiceUrl to WebFormListener.aspx (The URL path of the page) in the properties box. 

     

  4. Add a HTML button and name it "Call WebForm Service".
  5. Add the "OnResponseSuccess" Client Side Events of WebFlyPostBackManager.



  6. Add the following code in the client-side:

    Script Copy Code
    <script language="javascript">
    function DoClick()
    {
    var FPBMan = ISGetObject("WebFlyPostBackManager1");

    // call the HelloWorld method of the specified ServiceUrl
    FPBMan.HelloWorld();
    }

    function WebFlyPostBackManager1_OnResponseSuccess(controlId, methodName, returnValue)
    {
    alert("The return value of HelloWorld method is: " + returnValue);
    }
    </script>

  7. Invoke DoClick() function in onclick event like the following:

    Script Copy Code
    <input id="Button1" type="button" value="Call WebForm Service" onclick="DoClick()"/>
    

  8. When you click the button, it will retrieve the simple type result from the defined WebForm.
  9. Run the project and you will see something like following:

© 2012 Intersoft Solutions Corp. All Rights Reserved.