我引用了公共类的一个方法 如下!可 是提示 当前上下文中不存在名称“getContentLsit”
这是什么原因啊?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;public partial class UserControl_News_List : System.Web.UI.UserControl
{
ActionDesign Ad = new ActionDesign();
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Databind()
{
DataTable dt = getContentLsit(CID);
//或者
DataTable dt = getContentLsit(CID, strKey);
Repeater1.DataSource = ds.DefaultView;
Repeater1.DataBind();
}
}
这是什么原因啊?
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;public partial class UserControl_News_List : System.Web.UI.UserControl
{
ActionDesign Ad = new ActionDesign();
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Databind()
{
DataTable dt = getContentLsit(CID);
//或者
DataTable dt = getContentLsit(CID, strKey);
Repeater1.DataSource = ds.DefaultView;
Repeater1.DataBind();
}
}
这个方法是 ActionDesign这里面的一个方法!
未找到 getContentLsit方法
是不是缺少了引用集?在getContentLsit(CID)处按f12,看有什么提示
DataTable dt = Ad.getContentLsit(CID);
ActionDesign里面的方法, 用 ad.getContentLsit
那么在使用时需要先实例ActionDesign 如你的代码:ActionDesign Ad = new ActionDesign();
在调用 getContentLsit 方法时应该是这样:DataTable dt = Ad.getContentLsit(CID);呵呵
getContentLisit(CID,strKey)这是两个方法 通过传参数CID,strKey得到一个datatable数据集 这个方法有可能是自己定义的或系统自带的 如果有此方法 传参调用 就可得到数据
DLL是否引用
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data;public partial class UserControl_News_List : System.Web.UI.UserControl
{
ActionDesign Ad = new ActionDesign();
protected void Page_Load(object sender, EventArgs e)
{ }
protected void Databind()
{
String CID;
String strKey;
//或者
DataTable dt = Ad.getContentLsit(CID,strKey);
Repeater1.DataSource = ds.DefaultView;
Repeater1.DataBind();
}
}已经解决了 谢谢 了