问题描述
我已将AutoCompleteExtender绑定到文本框,以向用户显示建议
。如果我利用网络服务获取
结果,一切正常。但是,我想将Web服务代码放入页面方法中。我运行调试器只是为了发现从未输入[WebMethod]。
以下是我已经尝试过的一些没有成功的事情。看来
这是一个常见的问题。
-将[WebMethod]属性添加到代码隐藏方法的顶部。
-Added / removed" Static"作为公共方法定义的一部分。
- 删除了ServicePath来自AutoCompleteExtender .aspx页面的属性。
我的文本框和扩展程序控件嵌入到用户控件(.ascx)中,
放在ContentPanel中继承来自MasterPage。我不确定这可能是问题的一部分。当我查看浏览器源代码时,
javascript呈现ServicePath。默认情况下我的aspx
页面,但我的[WebMethod]位于pagename.ascx.cs。另外,我试过了
,其中包括ServicePath = pagename.ascx.cs。但仍然没有运气。
此时,我不知道还有什么可以尝试的。我想要移动到页面方法的主要原因是因为我需要访问Web服务可用的控件,而不是
。此外,我不认为我的需求在这里构成
需要网络服务。
任何帮助都将不胜感激!
谢谢,
Trent
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
这篇关于AJAX - AutoCompleteExtender ASP.Net 2.0(页面方法与Web服务的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!