December Release WebMethod problems

Last post 01-18-2006 11:36 AM by tristianfernandez. 3 replies.

Sort Posts:

  • December Release WebMethod problems

    01-16-2006, 6:00 PM
    • Member
      150 point Member
    • DuncanFord
    • Member since 12-01-2005, 10:46 PM
    • Edmonton, Alberta
    • Posts 30

    I have downloaded the December release and included all of the .js files and Atlas dll. But now the code that I wrote with the October release fails. The code is not complicated.

     

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="test2.aspx.cs" Inherits="test2" %>

    <%@ Import Namespace="System.Web.Services" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml">

     

    <head runat="server">

    <title>Web Method on Page</title>

    <atlas:ScriptManager ID="ScriptManager1" runat="server" />

    <script type="text/C#" runat="server">

    [WebMethod]

    public string HelloWorld(string s)

    {

    Session["a"] = "a";

    return "Hello '" + s + "'";

    }

    </script>

    </head>

    <body>

    <form id="Form1" runat="server">

    Enter your name:

    <asp:TextBox id="nameTextBox" runat="server"></asp:TextBox>

    <button id="buttonGo" onclick="return OnbuttonGo_click()" >GO</button>

    </form>

    <script type="text/javascript" language="JavaScript">

    function OnbuttonGo_click()

    {

    //textbox string value passed as a param to the server method

    PageMethods.HelloWorld(document.getElementById("nameTextBox").value, OnWebRequestComplete1);

    return false;

    }

    function OnWebRequestComplete1(result)

    {

    alert(result);

    }

    </script>

    </body>

    </html>

     

     

    I always get the js following js errors 'Web in not defined'

     

    When I view source I get the following, and ideas?

     

     

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">


    <head><title>
     Web Method on Page
    </title><link href="App_Themes/IFMS/ControlStyles.css" type="text/css" rel="stylesheet" /><link href="App_Themes/IFMS/StyleSheet.css" type="text/css" rel="stylesheet" /></head>
    <body>
        <form name="Form1" method="post" action="test2.aspx" id="Form1">
    <div>
    <input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUKMTU3MTQ0NjYwNmRkbD9DWJ65Ak0fRi4Rp1uhlAFON/k=" />
    </div>


    <script src="ScriptLibrary/Atlas/Debug/Atlas.js" type="text/javascript"></script>
            Enter your name:
            <input name="nameTextBox" type="text" id="nameTextBox" class="textBox widthMedium" />
            <button id="buttonGo" onclick="return OnbuttonGo_click()" >GO</button>
           
       
    <script type="text/xml-script"><page xmlns:script="http://schemas.microsoft.com/xml-script/2005">
      <components />
    </page></script><script type="text/javascript">var PageMethods = new function() {
    var cm=Web.Net.PageMethodRequest.createProxyMethod;
    cm(this,"HelloWorld","s");
    }

    </script></form>

        <script type="text/javascript" language="JavaScript">
        function OnbuttonGo_click()
        {
            //textbox string value passed as a param to the server method
           //PageMethods.HelloWorld(document.getElementById("nameTextBox").value, OnWebRequestComplete1);
            //return false;
        }

        function OnWebRequestComplete1(result)
        {
            alert(result);
        }
        </script>

    </body>
    </html>

     

  • Re: December Release WebMethod problems

    01-17-2006, 3:15 AM
    • Member
      5 point Member
    • casearchu
    • Member since 01-17-2006, 8:06 AM
    • Posts 1

    Maybe you should write your web method in your code-behind file...

    i have tried this code .

    it's worked

  • Re: December Release WebMethod problems

    01-17-2006, 12:16 PM
    • Member
      150 point Member
    • DuncanFord
    • Member since 12-01-2005, 10:46 PM
    • Edmonton, Alberta
    • Posts 30

    I have actually tried putting my code in the code-behind and still get the error. I think the error is coming from the following line

    var cm=Web.Net.PageMethodRequest.createProxyMethod

    I did not create a new project, but instead have tried to upgrade my old project that used the October release.

    Is there any documentation that outlines how to properly update your code from the October release to the December release? The way I figured out how to set up my project was to create an new web site and selected the AJAX template to find out where to put all the new .js files and how to set up my web.config.

     

  • Re: December Release WebMethod problems

    01-18-2006, 11:36 AM

    I'm getting the same thing.   I believe it's because of a "js" include that I'm missing.   Let me know if you find the solution. 

    Here's how I did the includes (Inside a master page).

    <head id="Head1" runat="server">

    <script language="JScript" src="../home/common/generic.js"></script>

    <script language="VBScript" src="../home/common/generic.vbs"></script>

    <atlas:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering=true EnableScriptComponents=true >
    <Scripts>
    <atlas:ScriptReference Path="../home/common/ReleaseAtlas.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasCompat.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasCompat2.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasRunTime.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasUIDragDrop.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasUIGlitz.js" />
    <atlas:ScriptReference Path="../home/common/ReleaseAtlasUIMap.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlas.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasCompat.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasCompat2.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasRunTime.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasUIDragDrop.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasUIGlitz.js" />
    <atlas:ScriptReference Path="../home/common/DebugAtlasUIMap.js" />
    <atlas:ScriptReference Path="../home/common/DefinitionOver.js" />
       <atlas:ScriptReference Path="../home/common/Definitions.js" />
    </Scripts>
    </atlas:ScriptManager>
    <link href="../home/common/portal.css" rel="stylesheet" type="text/css"/>
    </head>

Page 1 of 1 (4 items)