473,326 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

AJAX - AutoCompleteExtender ASP.Net 2.0 (Page Method vs. Web Servi

I have tied an AutoCompleteExtender to a textbox to indicate suggestions to
the user. Everything works fine if I utilize a webservice to fetch the
results. However, I want to put the web service code into a page method. I
have run the debugger only to find that the [WebMethod] is never entered.
Here are some of the things I have already tried with no success. It appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender .aspx page.

My textbox and extender control are embedded into a user control(.ascx) that
is placed within a ContentPanel inherited from a MasterPage. I'm not sure if
this could be part of the problem. As I view the browser source code, the
javascript renders the "ServicePath" to be looking by default at my aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm wanting
to move to a page method is because I need access to controls which aren't
available to the web service. Also, I don't think my needs here constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent
Feb 9 '07 #1
11 16098
Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
>I have tied an AutoCompleteExtender to a textbox to indicate suggestions to
the user. Everything works fine if I utilize a webservice to fetch the
results. However, I want to put the web service code into a page method.
I
have run the debugger only to find that the [WebMethod] is never entered.
Here are some of the things I have already tried with no success. It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender .aspx
page.

My textbox and extender control are embedded into a user control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm not sure
if
this could be part of the problem. As I view the browser source code, the
javascript renders the "ServicePath" to be looking by default at my aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm wanting
to move to a page method is because I need access to controls which aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent
Feb 9 '07 #2
I applied [ScriptMethod] immediately after [WebService] and that didn't fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate suggestions to
the user. Everything works fine if I utilize a webservice to fetch the
results. However, I want to put the web service code into a page method.
I
have run the debugger only to find that the [WebMethod] is never entered.
Here are some of the things I have already tried with no success. It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender .aspx
page.

My textbox and extender control are embedded into a user control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm not sure
if
this could be part of the problem. As I view the browser source code, the
javascript renders the "ServicePath" to be looking by default at my aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm wanting
to move to a page method is because I need access to controls which aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent

Feb 9 '07 #3
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"
ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
>I applied [ScriptMethod] immediately after [WebService] and that didn't fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:
>Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microso ft.com...
>I have tied an AutoCompleteExtender to a textbox to indicate suggestions
to
the user. Everything works fine if I utilize a webservice to fetch the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success. It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm not
sure
if
this could be part of the problem. As I view the browser source code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent

Feb 9 '07 #4
Of course, the method signature in the code-behind file must be:

[WebMethod]
[ScriptMethod]
public static string[] MyMethod(string prefixText, int count)

Best regards,
Henning Krause
"Henning Krause [MVP - Exchange]" <ne***************@this.infinitec.de>
wrote in message news:e1**************@TK2MSFTNGP02.phx.gbl...
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod" MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
>>I applied [ScriptMethod] immediately after [WebService] and that didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:
>>Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@micros oft.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions to
the user. Everything works fine if I utilize a webservice to fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success. It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm not
sure
if
this could be part of the problem. As I view the browser source code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent

Feb 9 '07 #5
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than being
in pagename.ascx.cs. When I type into my textbox, a popup does appear and it
contains "undefined", "undefined", "undefined", "undefined", "undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"
ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
I applied [ScriptMethod] immediately after [WebService] and that didn't fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate suggestions
to
the user. Everything works fine if I utilize a webservice to fetch the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success. It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm not
sure
if
this could be part of the problem. As I view the browser source code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 9 '07 #6
Hello,

do you have enabled the property EnablePageMethods on the ScriptManager in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear and
it
contains "undefined", "undefined", "undefined", "undefined", "undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:
>Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microso ft.com...
>I applied [ScriptMethod] immediately after [WebService] and that didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microso ft.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 9 '07 #7
Yessir, I do!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

do you have enabled the property EnablePageMethods on the ScriptManager in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear and
it
contains "undefined", "undefined", "undefined", "undefined", "undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
I applied [ScriptMethod] immediately after [WebService] and that didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 9 '07 #8
Here is my code.

**********pagename.ascx
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">

</asp:ScriptManager>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtDestination"
CompletionSetCount="10"
MinimumPrefixLength="1"
EnableCaching="true"
ServiceMethod="GetDest"/>

**********pagename.aspx.cs
[WebMethod]
[ScriptMethod]
public static string[] GetDest(string prefixText, int count)
{

string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

"Henning Krause [MVP - Exchange]" wrote:
Hello,

do you have enabled the property EnablePageMethods on the ScriptManager in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear and
it
contains "undefined", "undefined", "undefined", "undefined", "undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:
Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"
EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
I applied [ScriptMethod] immediately after [WebService] and that didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason I'm
wanting
to move to a page method is because I need access to controls which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 9 '07 #9
Hello,

works like charm here.

Here is the complete source:

Default.aspx.cs:

[WebMethod]
[ScriptMethod]
public static string[] GetTextBoxEntries(string prefixText, int
count)
{
string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

======================

UserControl.ascx:

<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePartialRendering="true" EnablePageMethods="true" />
<asp:TextBox runat="server" ID="tbTextBox" />
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
ServiceMethod="GetTextBoxEntries" TargetControlID="tbTextBox"
CompletionSetCount="10" MinimumPrefixLength="1" EnableCaching="true" />
Changes in the web.config:

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" />
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
</httpHandlers>

<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Here is my code.

**********pagename.ascx
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">

</asp:ScriptManager>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtDestination"
CompletionSetCount="10"
MinimumPrefixLength="1"
EnableCaching="true"
ServiceMethod="GetDest"/>

**********pagename.aspx.cs
[WebMethod]
[ScriptMethod]
public static string[] GetDest(string prefixText, int count)
{

string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

"Henning Krause [MVP - Exchange]" wrote:
>Hello,

do you have enabled the property EnablePageMethods on the ScriptManager
in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microso ft.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the
toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear
and
it
contains "undefined", "undefined", "undefined", "undefined",
"undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"

EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's
from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microso ft.com...
I applied [ScriptMethod] immediately after [WebService] and that
didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to
the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microso ft.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to
fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the
AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at
my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason
I'm
wanting
to move to a page method is because I need access to controls
which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 11 '07 #10
Hello Henning,

Thank you so much for your dedicated help on this issue. I had added the
new web.config segment of <httpHandlersbut hadn't added <httpModules>.
Once I added that, it started working like a champ for me as well :)

Thanks again,

Trent

"Henning Krause [MVP - Exchange]" wrote:
Hello,

works like charm here.

Here is the complete source:

Default.aspx.cs:

[WebMethod]
[ScriptMethod]
public static string[] GetTextBoxEntries(string prefixText, int
count)
{
string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

======================

UserControl.ascx:

<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePartialRendering="true" EnablePageMethods="true" />
<asp:TextBox runat="server" ID="tbTextBox" />
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
ServiceMethod="GetTextBoxEntries" TargetControlID="tbTextBox"
CompletionSetCount="10" MinimumPrefixLength="1" EnableCaching="true" />
Changes in the web.config:

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" />
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
</httpHandlers>

<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Here is my code.

**********pagename.ascx
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">

</asp:ScriptManager>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtDestination"
CompletionSetCount="10"
MinimumPrefixLength="1"
EnableCaching="true"
ServiceMethod="GetDest"/>

**********pagename.aspx.cs
[WebMethod]
[ScriptMethod]
public static string[] GetDest(string prefixText, int count)
{

string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

"Henning Krause [MVP - Exchange]" wrote:
Hello,

do you have enabled the property EnablePageMethods on the ScriptManager
in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the
toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear
and
it
contains "undefined", "undefined", "undefined", "undefined",
"undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"

EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's
from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
I applied [ScriptMethod] immediately after [WebService] and that
didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to
the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to
fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the
AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at
my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason
I'm
wanting
to move to a page method is because I need access to controls
which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 12 '07 #11
Hello Henning,

I have one more issue. To the best of my knowledge, there isn't a way to
pass additional parameters to the method/web service for the
autocompleteextender...do you think that is correct? I now need to access a
value from one of the textboxes on "pagename.ascx". Since the page method is
on the aspx side, I'm not sure how to access this value. I don't want to use
Session state. Any thoughts?

Trent

"Henning Krause [MVP - Exchange]" wrote:
Hello,

works like charm here.

Here is the complete source:

Default.aspx.cs:

[WebMethod]
[ScriptMethod]
public static string[] GetTextBoxEntries(string prefixText, int
count)
{
string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

======================

UserControl.ascx:

<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePartialRendering="true" EnablePageMethods="true" />
<asp:TextBox runat="server" ID="tbTextBox" />
<ajaxToolkit:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
ServiceMethod="GetTextBoxEntries" TargetControlID="tbTextBox"
CompletionSetCount="10" MinimumPrefixLength="1" EnableCaching="true" />
Changes in the web.config:

<system.web>
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI"
assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit"
namespace="AjaxControlToolkit" />
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="*" path="*_AppService.axd" validate="false"
type="System.Web.Script.Services.ScriptHandlerFact ory,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
<add verb="GET,HEAD" path="ScriptResource.axd"
type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions,
Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"
validate="false"/>
</httpHandlers>

<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule,
System.Web.Extensions, Version=1.0.61025.0, Culture=neutral,
PublicKeyToken=31bf3856ad364e35"/>
</httpModules>
</system.web>

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:7A**********************************@microsof t.com...
Here is my code.

**********pagename.ascx
<asp:ScriptManager ID="ScriptManager1" runat="server"
EnablePageMethods="true">

</asp:ScriptManager>
<cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server"
TargetControlID="txtDestination"
CompletionSetCount="10"
MinimumPrefixLength="1"
EnableCaching="true"
ServiceMethod="GetDest"/>

**********pagename.aspx.cs
[WebMethod]
[ScriptMethod]
public static string[] GetDest(string prefixText, int count)
{

string[] result;
result = new string[4];
result[0] = prefixText + "AAAAAAAA";
result[1] = prefixText + "DDDDDDDD";
result[2] = prefixText + "MMMMMMMM";
result[3] = prefixText + "VVVVVVVV";
return result;
}

"Henning Krause [MVP - Exchange]" wrote:
Hello,

do you have enabled the property EnablePageMethods on the ScriptManager
in
your aspx file?

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:58**********************************@microsof t.com...
Hi Henning,

I have downloaded the February 6 version of toolkit, removed the
toolkit
from the toolbox, re-added it, and removed the dll/pdb and readded the
reference as well. My codebehind is in pagename.aspx.cs, rather than
being
in pagename.ascx.cs. When I type into my textbox, a popup does appear
and
it
contains "undefined", "undefined", "undefined", "undefined",
"undefined"
which goes on and on seems like forever. If I set a breakpoint in the
"suggestion" codebehind method, it never breaks.

Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

I've a working autocomplete extender using this schema:

In Codebehind:

[WebMethod]
[ScriptMethod]
public static string MyMethod(string contextKey)
{}

In aspx site:

<ajaxToolkit:AutoCompleteExtender runat="server"
ID="tbAutoCompleteExtender" TargetControlID="tbTextBox"

ServiceMethod="MyMethod"
MinimumPrefixLength="2" CompletionInterval="1000"

EnableCaching="true"
CompletionSetCount="12" />

Note that code-behind method must be in the .aspx file, even if the
autocomplete extender is in a usercontrol.

Do you have the latest version of the Ajax toolkit installed? It's
from
february... so only a few days old.

Best regards,
Henning Krause
"Trent" <Tr***@discussions.microsoft.comwrote in message
news:F2**********************************@microsof t.com...
I applied [ScriptMethod] immediately after [WebService] and that
didn't
fix
it. Any other thoughts? Thanks!

"Henning Krause [MVP - Exchange]" wrote:

Hello,

you'll have to specify the [ScriptMethod] attribute in addition to
the
[WebService] attribute.

Best regards,
Henning Krause

"Trent" <Tr***@discussions.microsoft.comwrote in message
news:70**********************************@microsof t.com...
I have tied an AutoCompleteExtender to a textbox to indicate
suggestions
to
the user. Everything works fine if I utilize a webservice to
fetch
the
results. However, I want to put the web service code into a page
method.
I
have run the debugger only to find that the [WebMethod] is never
entered.
Here are some of the things I have already tried with no success.
It
appears
that this is a common problem.

-Added the [WebMethod] attribute to the top of the code-behind
method.
-Added/removed "Static" as part of the public method definition.
-Removed the "ServicePath" attribute from the
AutoCompleteExtender
.aspx
page.

My textbox and extender control are embedded into a user
control(.ascx)
that
is placed within a ContentPanel inherited from a MasterPage. I'm
not
sure
if
this could be part of the problem. As I view the browser source
code,
the
javascript renders the "ServicePath" to be looking by default at
my
aspx
page, but my [WebMethod] lives in pagename.ascx.cs. Also, I have
tried
including "ServicePath=pagename.ascx.cs" and still no luck.

At this point, I don't know what else to try. The main reason
I'm
wanting
to move to a page method is because I need access to controls
which
aren't
available to the web service. Also, I don't think my needs here
constitute
the need for a web service.

Any help would be greatly appreciated!

Thanks,

Trent


Feb 12 '07 #12

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: ack95 | last post by:
i am at a loss. i have been using the AutoCompleteExtender up until RC1. Now it is completely unresponsive and doesn't even throw a javascript error. I have added these sections to the config...
4
by: Grant Merwitz | last post by:
Hi I am trying to implement the Microsoft Ajax.NET extensions to perform a lookup on a key press of a text box. What this will do is once a user enters a letter into the textbox, this will...
0
by: =?Utf-8?B?UmFjaGVs?= | last post by:
I have the AJAX toolkit version 1.0.10301.0. I have downloaded and recompiled with the changeset 20574 from...
4
by: MarkusJ_NZ | last post by:
Hi, I have a text box which I have associated with an AutoCompleteExtender. e.g. <cc1:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="TextBox1"...
1
by: maz00 | last post by:
Hi guys, I'm running into an issue where my AutoCompleteExtender stops working as soon as I make changes to my global.asax file for URL rewriting. I just want to take a URL...
7
by: SV | last post by:
I am using ASP.Net / VB.Net v 2005. I want to add text recognition to one of the text box of suburb in my form. What I want to do is when user type any character in that text box, one dynamic list...
4
by: Peter | last post by:
ASP.NET I have an application which use ASP.NET Autocomplete extender which works great. But I have a question how to update all the fields on the screen using Ajax. Users starts typing in a...
1
by: Tomas | last post by:
Hi, I am trying to implement AutoCompleteExtender feature in my web project. One think which I do not understand, how to access local variables from GetAutoCompleteList method? Now I get error....
4
by: Peter | last post by:
ASP.NET 2.0 I have an AutoCompleteExtender which works fine- I am using name, id pair in the WebService , but what I am trying to do is: once the user selects an item from the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.