[test.aspx]

<%@ Page language="c#" Codebehind="test.aspx.cs" AutoEventWireup="false" Inherits="sc.test" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
    <HEAD>
        <title>test</title>
        <meta name="GENERATOR" Content="Microsoft Visual Studio .NET 7.1">
        <meta name="CODE_LANGUAGE" Content="C#">
        <meta name="vs_defaultClientScript" content="_javascript_">
        <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5 ">
    </HEAD>
    <body MS_POSITIONING="GridLayout">
        <form id="Form1" method="post" runat="server">
            <div>Click <a href="" to Test</div>
        </form>
        <script language="_javascript_">
        function doTest()
        {
            sc.test.Add(1,100,_callback);
        }
        function _callback(res)
        {
            alert(res.value);
        }
        </script>
    </body>
</HTML>

[test.aspx.cs]

using System;
using System.Collections;
using System.ComponentModel ;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using AjaxPro;
namespace sc
{
    public class test : System.Web.UI.Page
    {
        private void Page_Load(object sender, System.EventArgs e)
        {
            Utility.RegisterTypeForAjax(typeof(sc.test));
        }

        [AjaxMethod]
        public int Add(int a,int b)
        {
            return a+b;
        }

        override protected void OnInit(EventArgs e)
        {
            InitializeComponent();
            base.OnInit(e);
        }
       
        private void InitializeComponent()
        {   
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
    }
}

when i click the link "HERE",it comes out with a script error:undefined 'sc'.In another app,the codes are almost the same,but no error is thrown.what's the prob?
--
-------Wang E--------
(Well,gmail doesn't support html style signature,that's disappointing.)
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ajax.NET Professional" group.

To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]

For more options, visit this group at http://groups.google.com/group/ajaxpro

The latest downloads of Ajax.NET Professional can be found at http://www.ajaxpro.info/

Don't forget to read my blog at http://weblogs.asp.net/mschwarz/
-~----------~----~----~----~------~----~------~--~---

Reply via email to