The first error is:
A run time error has occured.
Do you wish to debug?
Line: 3
Error: Syntax error
(This error is repeated 4 times)

The second error is:
Microsoft JScript runtime error: 'AjaxData' is undefined.
(I know exactly where this error is occuring, and believe that it is
related to the fact that the class AjaxData has not been properly
registered.

Here is the code that I am using:
The AjaxData class - saved in the App_Code folder of the project:
   Imports Microsoft.VisualBasic
   Imports System.Data

   Public Class AjaxData
       'Reference to web service that accesses the database
       Dim myAjax As New wsAjax.AjaxProcessData

      <AjaxPro.AjaxMethod()> _
       Public Function GetSubType(ByVal type As String) As DataView
           GetSubType = Nothing
           Dim dvwSubType As DataView

           dvwSubType = New
DataView(myAjax.GetSubType(type).Tables("SubType"))
           Return dvwSubType
       End Function
   End Class

My Javascript file ("AjaxDataProvider") - saved in a folder called
scripts:
   function LoadType(identifier)
            {
                var type =
identifier.options[identifier.selectedIndex].value;
                AjaxData.GetSubType(type, LoadType_CallBack);
            }


                        function LoadType_CallBack(response)
            {
                //if the server-side code threw an exception
                if (response.error != null)
                {
                    //we should probably do better than this
                    alert(response.error);
                    return;
                }

                var subTypeCode = response.value;
                //if the response wasn't what we expected
                if (subTypeCode == null || typeof(subTypeCode) !=
"object")
                {
                    return;
                }

                //if the user choses other disable the second
drop-down.
                switch (document.getElementById("ddlOrgType").value)
                {
                    case "Other":

document.getElementById("ddlSubType").style.display="none";

document.getElementById("txtOther").style.display="";

document.getElementById("ddlSubType").options.length = 0;
                        return;
                    case "Select Organisation Type":

document.getElementById("ddlSubType").style.display="";

document.getElementById("txtOther").style.display="none";

document.getElementById("ddlSubType").options.length = 0;
                        return;
                    default:

document.getElementById("ddlSubType").style.display="";

document.getElementById("txtOther").style.display="none";
                }

                //Get the states drop down
                var SubTypeList =
document.getElementById("ddlSubType");
                SubTypeList.options.length = 0; //reset the states
dropdown

                //Remember, its length not Length in JavaScript
                for (var i = 0; i < subTypeCode.length; ++i)
                {
                    //the columns of our rows are exposed like named
properties
                    SubTypeList.options[SubTypeList.options.length] =
                    new Option(subTypeCode[i].SubType,
subTypeCode[i].SubType);
                }
            }

The page_load event for my web page (Subscriptions):
 Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
        AjaxPro.Utility.RegisterTypeForAjax(GetType(AjaxData))
 End sub

The section out of my web config file:
   <httpHandlers>
      <add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory, AjaxPro.2"/>
   </httpHandlers>
located just before the
   <compilation debug="true" strict="false" explicit="true">

And the call to the javascript in the source of my web page along with
the reference to the javascript file:
<asp:DropDownList ID="ddlOrgType" onchange="LoadType(this)"
runat="server" Font-Names="Tahoma" Font-Size="XX-Small"
                                                    TabIndex="11"
AutoPostBack="True">
                                                </asp:DropDownList>

javascript file located in the <head> of the page
<script language="javascript" type="text/javascript"
src="Scripts/AjaxDataProvider.js"></script>

I am using the AjaxPro.dll which I only downloaded today, and it is
referenced in my bin folder.

Mike55


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to