我有一个 Telerik 报告项目添加到我的网站,我正在尝试将参数传递给它,但我收到以下错误
错误:
你调用的对象是空的。
ASP.NET 代码
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
MembershipCard rpt = new MembershipCard();
// Error occuring here
rpt.ReportParameters["@MemberID"].Value = "5"; // Request["MemberID"];
ReportViewer1.Report = rpt;
}
}
Telerik 报告类
public MembershipCard()
{
/// <summary>
/// Required for telerik Reporting designer support
/// </summary>
InitializeComponent();
this.DataSource = null;
}
private void MembershipCard_NeedDataSource(object sender, EventArgs e)
{
string proc = "rpt_MembershipCard" + this.ReportParameters["@MemberID"].Value.ToString();
SqlDataAdapter adapter = new SqlDataAdapter(proc, "Data Source=(local); Initial Catalog= northwind; intergrated security = True");
DataSet dataSet = new DataSet();
adapter.Fill(dataSet);
(sender as Telerik.Reporting.Processing.Report).DataSource = dataSet;
}
有人可以指出我正确的方向吗?我无法在互联网上找到任何相关的东西。