Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# ReportTelerik以编程方式设置数据源_C#_Asp.net_Winforms_Telerik_Telerik Reporting - Fatal编程技术网

C# ReportTelerik以编程方式设置数据源

C# ReportTelerik以编程方式设置数据源,c#,asp.net,winforms,telerik,telerik-reporting,C#,Asp.net,Winforms,Telerik,Telerik Reporting,您好,我试图通过编程方式将值设置到我的ReportTelerik,但没有到数据库的链接。我使用所需的数据构建了一个数据集,并将其设置到数据源。但它不起作用。我可以设置构建数据集中的值 这里我构建了我的数据集 static DataSet GetAllData() { DataSet ds = new DataSet(); DataTable dt = new DataTable("Product"); dt.Columns.Add(new DataColumn("Name

您好,我试图通过编程方式将值设置到我的ReportTelerik,但没有到数据库的链接。我使用所需的数据构建了一个数据集,并将其设置到数据源。但它不起作用。我可以设置构建数据集中的值

这里我构建了我的数据集

static DataSet GetAllData()
{
    DataSet ds = new DataSet();
    DataTable dt = new DataTable("Product");
    dt.Columns.Add(new DataColumn("Name", typeof(string)));
    dt.Columns.Add(new DataColumn("ProductNumber", typeof(string)));
    dt.Columns.Add(new DataColumn("Product", typeof(string)));

    DataRow dr = dt.NewRow();
    dr["Name"] = "Vova";
    dr["Name"] = "Dany";
    dr["Name"] = "loopy";
    dr["ProductNumber"] = "1";
    dr["ProductNumber"] = "2";
    dr["ProductNumber"] = "3";
    dr["Product"] = "Car";
    dr["Product"] = "Dor";
    dr["Product"] = "Injector";
    dt.Rows.Add(dr);
    ds.Tables.Add(dt);

    return ds;

}
我在这里设置数据

  var objectDataSource = new Telerik.Reporting.ObjectDataSource();
  objectDataSource.DataSource = GetAllData();
  ReportTelerik report = new ReportTelerik();
  report.DataSource = objectDataSource;
我的ReportTelerik课程未满

partial class ReportTelerik
    {


        #region Component Designer generated code
        /// <summary>
        /// Required method for telerik Reporting designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            Telerik.Reporting.Group group1 = new Telerik.Reporting.Group();
            Telerik.Reporting.Drawing.StyleRule styleRule1 = new Telerik.Reporting.Drawing.StyleRule();
            Telerik.Reporting.Drawing.StyleRule styleRule2 = new Telerik.Reporting.Drawing.StyleRule();
            Telerik.Reporting.Drawing.StyleRule styleRule3 = new Telerik.Reporting.Drawing.StyleRule();
            Telerik.Reporting.Drawing.StyleRule styleRule4 = new Telerik.Reporting.Drawing.StyleRule();
            this.labelsGroupFooterSection = new Telerik.Reporting.GroupFooterSection();
            this.labelsGroupHeaderSection = new Telerik.Reporting.GroupHeaderSection();
            this.textBox1 = new Telerik.Reporting.TextBox();
            this.pageHeader = new Telerik.Reporting.PageHeaderSection();
            this.reportNameTextBox = new Telerik.Reporting.TextBox();
            this.pageFooter = new Telerik.Reporting.PageFooterSection();
            this.currentTimeTextBox = new Telerik.Reporting.TextBox();
            this.pageInfoTextBox = new Telerik.Reporting.TextBox();
            this.reportHeader = new Telerik.Reporting.ReportHeaderSection();
            this.titleTextBox = new Telerik.Reporting.TextBox();
            this.reportFooter = new Telerik.Reporting.ReportFooterSection();
            this.detail = new Telerik.Reporting.DetailSection();
            this.textBox2 = new Telerik.Reporting.TextBox();
            ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
            // 
            // labelsGroupFooterSection
            // 


            this.labelsGroupFooterSection.Height = Telerik.Reporting.Drawing.Unit.Inch(0.28125D);
            this.labelsGroupFooterSection.Name = "labelsGroupFooterSection";
            this.labelsGroupFooterSection.Style.Visible = false;
            // 
            // labelsGroupHeaderSection
            // 
            this.labelsGroupHeaderSection.Height = Telerik.Reporting.Drawing.Unit.Inch(0.40000000596046448D);
            this.labelsGroupHeaderSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.textBox1});
            this.labelsGroupHeaderSection.Name = "labelsGroupHeaderSection";
            this.labelsGroupHeaderSection.PrintOnEveryPage = true;
            // 
            // textBox1
            // 
            this.textBox1.Location = new Telerik.Reporting.Drawing.PointU(Telerik.Reporting.Drawing.Unit.Inch(0.02083333395421505D), Telerik.Reporting.Drawing.Unit.Inch(0D));
            this.textBox1.Name = "textBox1";
            this.textBox1.Size = new Telerik.Reporting.Drawing.SizeU(Telerik.Reporting.Drawing.Unit.Inch(6.4166665077209473D), Telerik.Reporting.Drawing.Unit.Inch(0.40000000596046448D));
            this.textBox1.StyleName = "PageInfo";
            // 
            // pageHeader
            // 
            this.pageHeader.Height = Telerik.Reporting.Drawing.Unit.Inch(0.44166669249534607D);
            this.pageHeader.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
            this.reportNameTextBox});
            this.pageHeader.Name = "pageHeader";
            // 
            // reportNameTextBox
            // 
}

}

这里我缺少的是我需要在ReportTelerik类中声明一些元素吗?我可以从我构建的数据集中设置值。

我发现您需要添加这些元素

this.textBox1.Value="=Name";