Im在這裏發佈了這個問題,導致這個事情實際上在過去的幾周裏破壞了我的頭腦。我離開了它一段時間,但如果可以的話,我真的會使用這個工具。常量錯誤在AjaxToolkit 4.0中使用500級聯DropDown列表ASP.NET
我在下拉列表中一直得到泛型Error 500。
下面是該服務的代碼:
using System;
using System.Web;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Web.Services;
using System.Web.Services.Protocols;
using AjaxControlToolkit;
using System.Data;
using System.Data.SqlClient;
/// <summary>
/// Summary description for inputHoursWS
/// </summary>
[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 inputHoursWS : System.Web.Services.WebService {
public inputHoursWS() {
//Uncomment the following line if using designed components
//InitializeComponent();
}
[WebMethod]
public CascadingDropDownNameValue[] getGroupCodes(string knownCategoryValues,
string Category)
{
InputHoursDSTableAdapters.TMS_ProjectGroupsTableAdapter projectGroupTA = new InputHoursDSTableAdapters.TMS_ProjectGroupsTableAdapter();
InputHoursDS.TMS_ProjectGroupsDataTable groups = projectGroupTA.GetProjectGroups();
List<CascadingDropDownNameValue> groupValues = new List<CascadingDropDownNameValue>();
foreach (DataRow row in groups)
{
int groupId = (int)row["ProjectGroupID"];
string groupCode = (string)row["ProjectGroup"];
groupValues.Add(new CascadingDropDownNameValue(groupCode, groupId.ToString()));
}
return groupValues.ToArray();
}
}
下面是前端Web表單代碼:
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:DropDownList ID="ddlGroups" runat="server" Width="70px" Height="21px">
</asp:DropDownList>
<asp:CascadingDropDown ID="ddlGroups_CascadingDropDown"
runat="server"
TargetControlID="ddlGroups"
Category="ProjectGroup"
PromptText="Choose a Group"
LoadingText="Please wait ..."
ServicePath="inputHoursWS.asmx"
ServiceMethod="getGroupCodes">
</asp:CascadingDropDown>
在InputHoursDS數據集的方法是否工作正常。我正在遠程訪問正在開發的機器。有一個的Visual Web Developer 2010安裝,也是IIS 6中運行.NET 4.0
而且一個簡單的問題也有關係 - 你把什麼樣的價值,在「類別」屬性在前端?是數據庫標題還是其自己的標題?