我需要有关 ajax 级联下拉列表的帮助,这些下拉列表在我的本地计算机上运行良好,但是当我将它部署到服务器上时,所有下拉列表都是空的,没有任何错误消息!谁能帮帮我吗?我的代码是:`
<ajaxToolkit:CascadingDropDown ID="code_CascadingDropDown"
runat="server" TargetControlID="code" LoadingText="Loding ..."
PromptText="Select Code" ServiceMethod="GetCodes" ServicePath="~/WebService.asmx"
Category="Code" UseContextKey="True" Enabled="true">
</ajaxToolkit:CascadingDropDown>
<asp:DropDownList ID="type" runat="server" BackColor="White" Height="22px"
TabIndex="5" Width="170px" >
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="type_CascadingDropDown"
runat="server" TargetControlID="type" Enabled="True"
ParentControlID="code" LoadingText="Loding ..." PromptText="Select Type"
ServiceMethod="GetType" ServicePath="~/WebService.asmx"
Category="type" UseContextKey="True">
</ajaxToolkit:CascadingDropDown>
<asp:DropDownList ID="dem" runat="server" BackColor="White" Height="22px"
TabIndex="6" Width="170px">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="dem_CascadingDropDown"
runat="server" TargetControlID="dem" Enabled="True"
ParentControlID="type" LoadingText="Loding ..." PromptText="Select Dimension"
ServiceMethod="GetDimension" ServicePath="~/WebService.asmx"
Category="dimension" UseContextKey="True">
</ajaxToolkit:CascadingDropDown>
<asp:DropDownList ID="p" runat="server" BackColor="White" Height="22px"
TabIndex="7" Width="130px" style="margin-top: 0px">
<asp:ListItem></asp:ListItem>
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="p_CascadingDropDown"
runat="server" TargetControlID="p" Enabled="True"
ParentControlID="dem" LoadingText="Loding ..." PromptText="Select P"
ServiceMethod="GetP" ServicePath="~/WebService.asmx"
Category="p" UseContextKey="True">
</ajaxToolkit:CascadingDropDown>
<asp:DropDownList ID="minquant" runat="server" BackColor="White" Height="22px"
TabIndex="7" Width="100px" style="margin-top: 0px"><asp:ListItem></asp:ListItem>
</asp:DropDownList> <ajaxToolkit:CascadingDropDown ID="minquant_CascadingDropDown" runat="server"
TargetControlID="minquant" Enabled="True"
ParentControlID="p" LoadingText="Loding ..." PromptText="Pcs/Carton"
ServiceMethod="GetQuantity" ServicePath="~/WebService.asmx"
Category="quantity" UseContextKey="True">
</ajaxToolkit:CascadingDropDown>`
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
[System.Web.Script.Services.ScriptService]
public class WebService : System.Web.Services.WebService
{
public WebService()
{
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue[] GetCodes(string knownCategoryValues, string category)
{
OrdersDataContext db = new OrdersDataContext();
IEnumerable<CascadingDropDownNameValue> vals = null;
short targetID = 0;
vals = (from c in db.codeTs
select new CascadingDropDownNameValue
{
name = c.code,
value = c.id.ToString(),
}).OrderBy(t => t.name);
return vals.ToArray<CascadingDropDownNameValue>();
}
[WebMethod]
public CascadingDropDownNameValue[] GetType(string knownCategoryValues, string category)
{
OrdersDataContext db = new OrdersDataContext();
IEnumerable<CascadingDropDownNameValue> vals = null;
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
short code_Id;
if (!kv.ContainsKey("code") || !short.TryParse(kv["code"], out code_Id))
{
return null;
}
vals = (from tp in db.typeTs
where tp.codeId == code_Id
select new CascadingDropDownNameValue
{
name = tp.type,
value = tp.id.ToString(),
}).OrderBy(t => t.name);
return vals.ToArray<CascadingDropDownNameValue>();
}
[WebMethod]
public CascadingDropDownNameValue[] GetDimension(string knownCategoryValues, string category)
{
OrdersDataContext db = new OrdersDataContext();
IEnumerable<CascadingDropDownNameValue> vals = null;
StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);
short type_Id;
if (!kv.ContainsKey("type") || !short.TryParse(kv["type"], out type_Id))
{
return null;
}
vals = (from tp in db.dimTs
where tp.typeId == type_Id
select new CascadingDropDownNameValue
{
name = tp.dimension,
value = tp.id.ToString(),
}).OrderBy(t => t.name);
return vals.ToArray<CascadingDropDownNameValue>();
}`