Visual Basic .NET » Database Programming
Autosuggest Text box code gives "Object Expected" -- bubberz --


Hello!

I know I have a previous post about this, but wanted to keep the topics separate since I have now found your .dll supports this.

I'm trying to use the Autocomplete for the AjaxPro.dll from:
http://munich.schwarz-interactive.de/autocomplete.aspx 


I keep getting "Object Expected" in my javascript on my .js include file along with that in the HTML body when my page first loads.

I've added this to my web.config file:
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
</system.web>

**********
**********
My code behind is trying to return names from my table (for starters)
so I can see the names with the autosuggest:

<AjaxPro.AjaxMethod()> _
Public Function SearchAdvanced(ByVal orderNumber As String, ByVal customerID As Integer, ByVal count As Integer) As DataTable
Dim ds As DataSet = New DataSet
Dim sCon1 As New SqlConnection
sCon1.ConnectionString = Session("DBDDL")

Dim cmd As New SqlCommand("SELECT Authority FROM Signature_Authority_Names WHERE Authority like @CustomerID")

cmd.Parameters.Add("@CustomerID", customerID)

Try
sCon1.Open()

Try
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
da.Fill(ds)
Finally
sCon1.Close()
End Try
Catch
Return Nothing
End Try
'Return ds.Tables
Return ds.Tables(0)

End Function

**********
**********
My HTML is:
<body>
<script type="text/javascript" src="scripts/autocomplete.js"></script>
<script type="text/javascript">

//Code for Autocomplete function init() {
var x = new MS.Web.AutoCompleteDataTable("searchCustomerID", 10);

x.getDisplay = function(item) {
return (item != null ? item.Authority : "");
}
x.getValue = function(item) {
return (item != null ? item.Authority.toString().trimRight() : "");
}
x.getData = function() {
Namespace.ClassName.AjaxMethod(this.ele.value, this.count,
this.callback.bind(this));
}
}
addEvent(window, "load", init); //error received on this line
//End Code for Autocomplete

</script>

<form id="Form1" method="post" runat="server">
<TABLE id="Table1">
<TR>
<TD><INPUT id="searchCustomerID" type="text" size="62">
</TD>
</TR>
</TABLE>
</form>

....I get an error on the line for addEvent(window, "load", init);
saying "Object Expected"

**********
**********
My first error, "object expected" is received in this .js file on line one below:

addNamespace("MS.Web.AutoComplete");

MS.Web.AutoComplete = Class.create();

Object.extend(MS.Web.AutoComplete.prototype, {
timer: null,
count: 10,
pos: -1,
waitAfterInput: 230,
minChars: 0,
children: null,

I'm using IE6 Sp2

If I can get this, it will be a huge help to our application.

Thanks!

-- JosHenriqueKracikSilva --

Men, i'm at home now, and i don't remember the exactly name/syntax, but you have to register your type as an ajax type.

On 7/21/06, bubberz <chip> wrote:


Hello!

I know I have a previous post about this, but wanted to keep the topics
separate since I have now found your .dll supports this.

I'm trying to use the Autocomplete for the AjaxPro.dll from:
http://munich.schwarz-interactive.de/autocomplete.aspx 


I keep getting "Object Expected" in my javascript on my .js include
file along with that in the HTML body when my page first loads.

I've added this to my web.config file:
<httpHandlers>
<add verb="POST,GET" path="ajaxpro/*.ashx"
type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
</httpHandlers>
</system.web>

**********
**********
My code behind is trying to return names from my table (for starters)
so I can see the names with the autosuggest:

<AjaxPro.AjaxMethod()> _
Public Function SearchAdvanced(ByVal orderNumber As String, ByVal
customerID As Integer, ByVal count As Integer) As DataTable
Dim ds As DataSet = New DataSet
Dim sCon1 As New SqlConnection
sCon1.ConnectionString = Session("DBDDL")

Dim cmd As New SqlCommand("SELECT Authority FROM
Signature_Authority_Names WHERE Authority like @CustomerID")

cmd.Parameters.Add("@CustomerID", customerID)

Try
sCon1.Open()

Try
Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
da.Fill(ds)
Finally
sCon1.Close()
End Try
Catch
Return Nothing
End Try
'Return ds.Tables
Return ds.Tables(0)

End Function

**********
**********
My HTML is:
<body>
<script type="text/javascript" src="scripts/autocomplete.js"></script>
<script type="text/javascript">

//Code for Autocomplete
function init() {
var x = new MS.Web.AutoCompleteDataTable("searchCustomerID", 10);

x.getDisplay = function(item) {
return (item != null ? item.Authority : "");
}
x.getValue = function(item) {
return (item != null ? item.Authority.toString().trimRight() : "");
}
x.getData = function() {
Namespace.ClassName.AjaxMethod(this.ele.value, this.count,
this.callback.bind(this));
}
}
addEvent(window, "load", init); //error received on this line
//End Code for Autocomplete

</script>

<form id="Form1" method="post" runat="server">
<TABLE id="Table1">
<TR>
<TD><INPUT id="searchCustomerID" type="text" size="62">
</TD>
</TR>
</TABLE>
</form>

....I get an error on the line for addEvent(window, "load", init);
saying "Object Expected"

**********
**********
My first error, "object expected" is received in this .js file on line
one below:

addNamespace("MS.Web.AutoComplete");

MS.Web.AutoComplete = Class.create();

Object.extend(MS.Web.AutoComplete.prototype, {
timer: null,
count: 10,
pos: -1,
waitAfterInput: 230,
minChars: 0,
children: null,

I'm using IE6 Sp2

If I can get this, it will be a huge help to our application.

Thanks!
>


 

-- JosHenriqueKracikSilva --

Look this link,
http://groups.google.com/group/ajaxpro/browse_thread/thread/9bc9fe74c17705e7/ffafb95db965803e#ffafb95db965803e 


and search locate.

On 7/21/06, José Henrique Kracik Silva <zotekracik> wrote:

Men, i'm at home now, and i don't remember the exactly name/syntax, but
you have to register your type as an ajax type.
On 7/21/06, bubberz < chip> wrote:
>
>
> Hello!
>
> I know I have a previous post about this, but wanted to keep the topics
> separate since I have now found your .dll supports this.
>
> I'm trying to use the Autocomplete for the AjaxPro.dll from:
>
http://munich.schwarz-interactive.de/autocomplete.aspx 

>
> I keep getting "Object Expected" in my javascript on my .js include
> file along with that in the HTML body when my page first loads.
>
> I've added this to my web.config file:
> <httpHandlers>
> <add verb="POST,GET" path="ajaxpro/*.ashx"
> type="AjaxPro.AjaxHandlerFactory, AjaxPro"/>
> </httpHandlers>
> </system.web>
>
> **********
> **********
> My code behind is trying to return names from my table (for starters)
> so I can see the names with the autosuggest:
>
> <AjaxPro.AjaxMethod()> _
> Public Function SearchAdvanced(ByVal orderNumber As String, ByVal
> customerID As Integer, ByVal count As Integer) As DataTable
> Dim ds As DataSet = New DataSet
> Dim sCon1 As New SqlConnection
> sCon1.ConnectionString = Session("DBDDL")
>
> Dim cmd As New SqlCommand("SELECT Authority FROM
> Signature_Authority_Names WHERE Authority like @CustomerID")
>
> cmd.Parameters.Add("@CustomerID", customerID)
>
> Try
> sCon1.Open()
>
> Try
> Dim da As SqlDataAdapter = New SqlDataAdapter(cmd)
> da.Fill(ds)
> Finally
> sCon1.Close()
> End Try
> Catch
> Return Nothing
> End Try
> 'Return ds.Tables
> Return ds.Tables(0)
>
> End Function
>
> **********
> **********
> My HTML is:
> <body>
> <script type="text/javascript" src="scripts/autocomplete.js"></script>
> <script type="text/javascript">
>
> //Code for Autocomplete
> function init() {
> var x = new MS.Web.AutoCompleteDataTable("searchCustomerID", 10);
>
> x.getDisplay = function(item) {
> return (item != null ? item.Authority : "");
> }
> x.getValue = function(item) {
> return (item != null ? item.Authority.toString().trimRight() : "");
> }
> x.getData = function() {
> Namespace.ClassName.AjaxMethod(this.ele.value, this.count ,
> this.callback.bind(this));
> }
> }
> addEvent(window, "load", init); //error received on this line
> //End Code for Autocomplete
>
> </script>
>
> <form id="Form1" method="post" runat="server">
> <TABLE id="Table1">
> <TR>
> <TD><INPUT id="searchCustomerID" type="text" size="62">
> </TD>
> </TR>
> </TABLE>
> </form>
>
> ....I get an error on the line for addEvent(window, "load", init);
> saying "Object Expected"
>
> **********
> **********
> My first error, "object expected" is received in this .js file on line
> one below:
>
> addNamespace("MS.Web.AutoComplete");
>
> MS.Web.AutoComplete = Class.create();
>
> Object.extend(MS.Web.AutoComplete.prototype, {
> timer: null,
> count: 10,
> pos: -1,
> waitAfterInput: 230,
> minChars: 0,
> children: null,
>
> I'm using IE6 Sp2
>
> If I can get this, it will be a huge help to our application.
>
> Thanks!
>
>
> > >
>


 

-- bubberz --


Thanks Jose!

In the page load I've got:

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
AjaxPro.Utility.RegisterTypeForAjax(GetType(CreateNewResource))

[Submit Comment]Home