using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using System.Data.SqlClient;
using System.Collections.Specialized;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using AjaxControlToolkit;public class PersonDBservice : System.Web.Services.WebService
{
    DataOperate dot = new DataOperate();//连接数据库
    SqlConn sc = new SqlConn();//sql 语句
   
 public PersonDBservice()
    {
    }    [WebMethod]
    
    public DataTable getSchoolTable()
    {
        SqlConnection conn = dot.ConnDatabase();
        SqlCommand cmd = new SqlCommand(sc.QeryArea(), conn);
        SqlDataAdapter sdr = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        sdr.Fill(ds);
        return ds.Tables[0];
    }[WebMethod]
    public CascadingDropDownNameValue[] GetSchool(string knownCategoryValue, string category)
    {
        List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
        DataTable schools = getSchoolTable();
        foreach (DataRow dr in schools.Rows)
        {
            string school = (string)dr["AreaName"];
            int schoolid = (int)dr["AreaId"];
            values.Add(new CascadingDropDownNameValue(school, schoolid.ToString()));        }
        return values.ToArray();
    }    [WebMethod]
<asp:DropDownList ID="DropDownList1" runat="server"></asp:DropDownList></td>
                <td style="width: 100px; height: 45px;">
                    <cc1:CascadingDropDown ID="CascadingDropDown1" runat="server" Category="AreaName" SelectedValue="ffffffffff"  LoadingText="正在加载学校" PromptText="请选择学校" ServiceMethod="GetSchool" TargetControlID="DropDownList1" ServicePath="../booboor/PersonDBservice.asmx">
                    </cc1:CascadingDropDown>
学习CascadingDropDown 在web服务里绑定值到ropDownList结果没值,只有ffffffffff,哪里的问题?

解决方案 »

  1.   

    <httpHandlers>
          <remove verb="*" path="*.asmx"/>
          <add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
          <add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, 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>web配置里弄了的出现了 method error 500