首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >错误500 - CascadingDropDown AJAX扩展工具包控件

错误500 - CascadingDropDown AJAX扩展工具包控件
EN

Stack Overflow用户
提问于 2010-08-19 16:15:16
回答 1查看 1K关注 0票数 0

我试图使用CascadingDropDown填充3个下拉列表。DDLs分别显示汽车的制造、型号和颜色。数据驻留在.xml文件中。

最后一个DDL有AutoPostBack = true,我试图在一个label控件中显示下拉列表中的值。

我从webservice中提取数据来填充DDL。编译时没有收到任何错误,但是当我运行代码时,它会显示错误500。我不知道我哪里出了问题。我正在听“我该怎么做”的教程视频-

http://www.asp.net/ajax/videos/how-do-i-use-the-aspnet-ajax-cascadingdropdown-control-extender

我正在使用C#和.Net框架2.0。

我的网络服务看起来是这样的-

Http://tempuri.org/](http://tempuri.org/)“)WebService(命名空间=”][ System.Web.Script.Services.ScriptService()公共类CarsService : System.Web.Services.WebService {

代码语言:javascript
复制
public XmlDataDocument _document;
//public object _lock = new Object();
public CarsService () {

    //Uncomment the following line if using designed components 
    //InitializeComponent(); 
}

public XmlDocument Document
 {
     get
     {
         if (_document==null)
         {
             _document = new XmlDataDocument();
             _document.Load(HttpContext.Current.Server.MapPath("~/App_Data/CarsService.xml"));
         }
         //Document = _document;
         return _document;
     }
 }

public string[] Hierarchy
{
    get
    {
        string[] hierarchy = {"make","model"};
        return hierarchy;
    }

}

[WebMethod]
public AjaxControlToolkit.CascadingDropDownNameValue[] GetDropDownContents(string knowncategoryvalues, string category)
{
    StringDictionary knownCategoryValuesDictionary = new StringDictionary();
    knownCategoryValuesDictionary = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knowncategoryvalues);

    return  AjaxControlToolkit.CascadingDropDown.QuerySimpleCascadingDropDownDocument(Document, Hierarchy, knownCategoryValuesDictionary, category);

}

}

网页看起来是这样的-

代码语言:javascript
复制
   Untitled Page                
代码语言:javascript
复制
    <br />
    <br />

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <asp:DropDownList ID="DropDownList1" runat="server" Width="147px">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="DropDownList2" runat="server" Width="147px">
            </asp:DropDownList>
            <br />
            <asp:DropDownList ID="DropDownList3" runat="server" Width="147px" 
                AutoPostBack="True">
            </asp:DropDownList>
            <br />
            <br />
            <br />
            <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label>
            <br />
            <br />
            <asp:TextBox ID="TextBox1" runat="server" Height="64px" Width="191px"></asp:TextBox>
            <br />
            <br />
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown1" runat="server" 
                Category="make" PromptText="Please enter dish name" 
                ServiceMethod="GetDropDownContents" TargetControlID="DropDownList1" 
                ServicePath="CarsService.asmx">
            </ajaxToolkit:CascadingDropDown>
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown2" runat="server" 
                Category="model" LoadingText="[Loading price...]" 
                ParentControlID="DropDownList1" PromptText="Please select price" 
                ServiceMethod="GetDropDownContents" TargetControlID="DropDownList2">
            </ajaxToolkit:CascadingDropDown>
            <ajaxToolkit:CascadingDropDown ID="CascadingDropDown3" runat="server" 
                Category="color" LoadingText="[Loading Description...]" 
                ParentControlID="DropDownList2" PromptText="Select Description" 
                ServiceMethod="GetDropDownContents" TargetControlID="DropDownList3">
            </ajaxToolkit:CascadingDropDown>
            <br />
            <br />
            <br />
            <br />
        </ContentTemplate>
    </asp:UpdatePanel>
</form>

还在这里附加xml文件-

我不知道我哪里出了问题。你能帮帮我吗?

EN

回答 1

Stack Overflow用户

发布于 2010-08-19 16:57:54

火虫对于调试web服务调用是非常宝贵的。

  1. 安装Firefox的Firebug插件
  2. 在Firefox中打开您的测试网页
  3. 打开Firebug,然后打开Net选项卡,然后单击XHR
  4. 再试一次,查找XHR响应中的错误。
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/3523817

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档