Hi guys, I have recently upgraded to the new AjaxPro v6+ from the v.5
edition, and now I cannot get any of the Ajax functions to work. I
know that I am probably doing something really stupid but I am at a bit
of a loss and I would love to get it working so that I can starting
practicing with it.
I have referenced the AjaxPro.dll when compiling my dll, and I have the
following code in my dll:
Imports System
Imports System.Data
Imports System.Data.SQLClient
Imports System.Web
Imports System.Configuration
Imports AjaxPro
NAMESPACE VBNETSample
Public Class Global
Inherits System.Web.HttpApplication
Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
AjaxPro.Utility.HandlerPath = "ajaxpro"
End Sub
End Class
Public Class AjaxTable
Inherits System.Web.UI.Page
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
AjaxPro.Utility.RegisterTypeForAjax(GetType(VBNETSample.AjaxTable))
End Sub
<AjaxPro.AjaxMethod()> Public Function ReturnTable(did as Integer)
As System.Data.DataSet
Dim ds1 as New DataSet()
Ds1 = New Dataset
Dim cnn as New
SqlConnection(ConfigurationSettings.AppSettings("conn1"))
Dim da As New SqlDataAdapter("SELECT id, positions FROM
disciplines
WHERE did="& did &" ORDER BY positions ASC",cnn)
da.Fill(ds1, "disciplines")
cnn.close
Return ds1
End Function
End Class
END NAMESPACE
I have also added the following Ajax Wrapper code to my web.config
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
And my javascript looks like this:
function callback_test2(res)
{
if(res != null && res.value != null && res.value.Tables != 0 &&
res.value.Tables.length == 1)
{
var html = [];
for(var i=0; i<res.value.Tables[0].Rows.length; i++)
html[html.length] = "<tr><td>" +
res.value.Tables[0].Rows[i].positions + "</td></tr>";
document.getElementById("display3").innerHTML = "<table>" +
html.join("") + "</table>";
}
}
function test2()
{
document.getElementById("display3").innerHTML = "Please Wait, while
loading Info";
AjaxTable.ReturnTable(document.Form1.DepartureCountry.options[document.Form1.DepartureCountry.selectedIndex].value,
callback_test2);
}
But even then I carry on getting a Javascript error saying that
"AjaxTable is not defined" which is a problem that I had with previous
versions of Ajax when I hadn't added the Ajax Wrapper code to the
web.config file - but now it is there and I am still confused!
Please, please I would really love some help figuring this problem out.
Thanks
GP
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---