我使用对象数据源绑定下拉列表。我收到了这样的错误
“ObjectDataSource'objDSStatus'找不到具有参数的非泛型方法'GetIssueAllowedStatusByCategoryIDStatusIDandUserType':IssueCategoryID。”
我的代码如下
< asp:DropDownList ID="ddlStatus" runat="server" DataSourceID="objDSStatus"
DataTextField="IssueStatusName" DataValueField="IssueStatusID">
< /asp:DropDownList>
< asp:ObjectDataSource ID="objDSStatus" runat="server" TypeName="DA"></asp:ObjectDataSource>
private void Bind(int IssueCategoryID, int IssueStatusID, int UserType)
{
ddlStatus.Items.Clear();
objDSStatus.SelectMethod = "GetIssueAllowedStatusByCategoryIDStatusIDandUserType";
objDSStatus.SelectParameters.Clear();
objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString());
objDSStatus.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString());
objDSStatus.SelectParameters.Add("UserType", UserType.ToString());
objDSStatus.DataBind();
ddlStatus.DataBind();
}
public List<IssueStatus> GetIssueAllowedStatusByCategoryIDStatusIDandUserType(int IssueeCategoryID, int IssueStatusID, int UserType)
{
List<IssueStatus> issueStatusList = new List<IssueStatus>();
}
任何人都可以帮我这个。
谢谢, 马赫什
答案 0 :(得分:2)
这对我来说不合适:
objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString());
objDSFeedback.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString());
objDSFeedback.SelectParameters.Add("UserType", UserType.ToString());
您是否将第二个和第三个参数添加到objDSFeedback
而不是objDSStatus
?毕竟你的方法有三个参数......
也许你的意思是:
objDSStatus.SelectParameters.Add("IssueCategoryID", IssueCategoryID.ToString());
objDSStatus.SelectParameters.Add("IssueStatusID", IssueStatusID.ToString());
objDSStatus.SelectParameters.Add("UserType", UserType.ToString());
答案 1 :(得分:1)
您的DA.cs
参数之一是int IssueeCategoryID
。它应该是int IssueCategoryID