请教高手AJAX 问题:没有EnablePageMethods属性,如何调用Web Service方法? 请教高手:系统使用的是ajax beta版的, ScriptManager 竟然没有EnablePageMethods方法,现在需要调用Web Service的方法,请问如何实现? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Ajax五大核心组件(个人总结)在调用之前需要指定WebService的(路径) Scriptmanager的path属性可以通过 Scriptmanager调用js脚本和WebService======调用js======<!--设置js路径--><asp:ScriptManager ID="ScriptManager1" runat="server"> <Scripts> <asp:ScriptReference Path="js/hello.js" /> </Scripts> </asp:ScriptManager> <!--放置的HTML控件调用外部js --> <input id="Button1" type="button" value="调用js" onclick=" Hello()" />======调用WebService====== <!--设置WebServices路径--> <asp:ScriptManager ID="ScriptManager1" runat="server"> <Services> <asp:ServiceReference Path="WebService.asmx" /> </Services> </asp:ScriptManager><!--调用WebService的js-->// <script type="text/javascript"> function CallBack() { WebService.HelloWorld(GetValue); } function GetValue(val) { document.write(val); } </script> 在WebService里面写上这个: [System.Web.Script.Services.ScriptService] 谢谢!我现在是想使用AutoComplete控件,请问如何实现?代码如下:<asp:ScriptManager ID="scriptmanager1" runat="server" EnablePageMethods="true"> </asp:ScriptManager><asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox> <cc1:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="TextBox1" ServiceMethod="GetCompletionList" ServicePath="ToolkitTestService.asmx" MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="5" CompletionInterval="100" /> 应为没有beta版的ajax没有EnablePageMethods属性,所以该怎么实现呢? WebServiceusing System;using System.Web;using System.Collections;using System.Web.Services;using System.Web.Services.Protocols;using System.Data;using System.Data.SqlClient;/// <summary>/// WebService 的摘要说明/// </summary>[WebService(Namespace = "http://tempuri.org/")][WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.Web.Script.Services.ScriptService]public class WebService : System.Web.Services.WebService { public WebService () { //如果使用设计的组件,请取消注释以下行 //InitializeComponent(); } [WebMethod] public string[] GetData(string prefixText,int count)//这里的参数必须固定 { SqlConnection conn = new SqlConnection("server=.;database=Northwind;uid=sa;pwd=;"); string Str = "select CompanyName from Customers where CompanyName like '" + prefixText + "%' order by CompanyName "; SqlDataAdapter sda = new SqlDataAdapter(Str,conn); DataSet ds=new DataSet(); sda.Fill(ds,"com"); string[] temp=new string[ds.Tables["com"].Rows.Count]; for(int i=0;i<ds.Tables["com"].Rows.Count;i++) { temp[i] = ds.Tables["com"].Rows[i]["CompanyName"].ToString(); } return temp; }}在页面设置AutoComplete控件的Tag....ID属性然后TextBox就多了个属性 谢谢,我的只能看到TextBox多了一个 属性AutoCompleteType,不知道如何设置,有可选值“BusinessCity、BusinessCountryRegion、Search……” 而且,asp:ScriptManager 没有 EnablePageMethods 属性可以设置 AjaxControlToolkit版本错误 收集酷站 我在一个页面里定义了近80个服务器控件,影响性能吗? 如何实现向WEB service 提交中文现在可以实现提交英文和数字,提交中无法传入。{高手指点} 请问 aps.net gridview aspx页面调用一个常量值.这个常量是存在一个可以修改的类似配置文件上 再问个问题:比较长,到里面说吧 哪位高手有在IE6中真正屏蔽 Alt+F4 键的方法,请详细告知 IIS以下问题,请教专家们! 请问微软企业库安装后怎么操作,哪里有微软企业库学习资料 下载文件名问题?
在调用之前需要指定WebService的(路径) Scriptmanager的path属性可以通过 Scriptmanager调用js脚本和WebService======调用js======<!--设置js路径--><asp:ScriptManager ID="ScriptManager1" runat="server">
<Scripts>
<asp:ScriptReference Path="js/hello.js" />
</Scripts>
</asp:ScriptManager>
<!--放置的HTML控件调用外部js -->
<input id="Button1" type="button" value="调用js" onclick=" Hello()" />======调用WebService====== <!--设置WebServices路径-->
<asp:ScriptManager ID="ScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="WebService.asmx" />
</Services>
</asp:ScriptManager><!--调用WebService的js-->//
<script type="text/javascript">
function CallBack()
{
WebService.HelloWorld(GetValue);
}
function GetValue(val)
{
document.write(val);
}
</script>
我现在是想使用AutoComplete控件,请问如何实现?
代码如下:<asp:ScriptManager ID="scriptmanager1" runat="server" EnablePageMethods="true">
</asp:ScriptManager>
<asp:TextBox ID="TextBox1" runat="server" ></asp:TextBox>
<cc1:AutoCompleteExtender
ID="AutoCompleteExtender1"
runat="server"
TargetControlID="TextBox1"
ServiceMethod="GetCompletionList"
ServicePath="ToolkitTestService.asmx"
MinimumPrefixLength="1"
EnableCaching="true"
CompletionSetCount="5"
CompletionInterval="100"
/>
WebServiceusing System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;using System.Data;
using System.Data.SqlClient;
/// <summary>
/// WebService 的摘要说明
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)][System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService { public WebService () { //如果使用设计的组件,请取消注释以下行
//InitializeComponent();
} [WebMethod]
public string[] GetData(string prefixText,int count)//这里的参数必须固定
{
SqlConnection conn = new SqlConnection("server=.;database=Northwind;uid=sa;pwd=;");
string Str = "select CompanyName from Customers where CompanyName like '" + prefixText + "%' order by CompanyName ";
SqlDataAdapter sda = new SqlDataAdapter(Str,conn);
DataSet ds=new DataSet();
sda.Fill(ds,"com"); string[] temp=new string[ds.Tables["com"].Rows.Count];
for(int i=0;i<ds.Tables["com"].Rows.Count;i++)
{
temp[i] = ds.Tables["com"].Rows[i]["CompanyName"].ToString();
} return temp;
}}
在页面设置AutoComplete控件的Tag....ID属性
然后TextBox就多了个属性