This is a migrated thread and some comments may be shown as answers.

Custom report, NullReference Exception

3 Answers 171 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
medialog
Top achievements
Rank 2
medialog asked on 11 Oct 2010, 02:32 PM
Hello,

Before to buy Telerik Reporting i try to make a report programmatically with the trial version.

My first problem was in Silverlight you must quote this ligne :
WebRequest.RegisterPrefix("http://", WebRequestCreator.ClientHttp);
Else you have a message like below :
"Report is unavailable or session has expired."

My second problem unsolve is when I build my report programmatically I have got a NullReference Exception in the report Viewver.
I dont understand this Exception, but it throw only when I build the details.

Anyone has got an idea what is wrong in my source code?



My report :

public class MedialogSimpleTableReport : Telerik.Reporting.Report
{
    #region Fields
    Telerik.Reporting.DetailSection _detail;
    ObjectDataSource _objectDataSource;
    Table _table_arrivee;
    PageFooterSection _pageFooterSection;
    TextBox _tb_footer_page;
    PageHeaderSection _pageHeaderSection;
    TextBox _tbTitle_page;
    ReportFooterSection _reportFooterSection;
    Panel _panel_ReportBottom;
    TextBox _tb_end_report2;
    TextBox _tb_Pages;
    TextBox _tb_End_report;
    System.ComponentModel.ComponentResourceManager _resources;
 
    PictureBox _pictureBox_Logo;
    TextBox _tb_Report_header;
 
    TableGroup _tableGroupDetail;
    TableGroup _tableGroupRows;
 
    List<TableGroup> _tableGroupsTitle;
    List<TextBox> _titlesTextBoxes;
    List<TextBox> _datasTextBoxes;
    List<TextBox> _totalTextBoxes;
    #endregion
 
    public double WidthPage
    {
        get { return 27D; }
    }
 
    public MedialogSimpleTableReport()
    {
        Initialize();
    }
 
    public void Initialize()
    {
        this._detail = new Telerik.Reporting.DetailSection();
        this._table_arrivee = new Telerik.Reporting.Table();
        this._objectDataSource = new Telerik.Reporting.ObjectDataSource();
        this._pageFooterSection = new Telerik.Reporting.PageFooterSection();
        this._tb_footer_page = new Telerik.Reporting.TextBox();
        this._pictureBox_Logo = new Telerik.Reporting.PictureBox();
        this._pageHeaderSection = new Telerik.Reporting.PageHeaderSection();
        this._tbTitle_page = new Telerik.Reporting.TextBox();
        this._tb_Pages = new Telerik.Reporting.TextBox();
        this._tb_Report_header = new Telerik.Reporting.TextBox();
        this._reportFooterSection = new Telerik.Reporting.ReportFooterSection();
        this._panel_ReportBottom = new Telerik.Reporting.Panel();
        this._tb_end_report2 = new Telerik.Reporting.TextBox();
        this._tb_End_report = new Telerik.Reporting.TextBox();
        this._resources = new System.ComponentModel.ComponentResourceManager(typeof(MedialogSimpleTableReport));
        BuildPageHeader();
        BuildDataSource();
        BuildReportFooter();
        BuildPageFooter();
        BuildDetail();
        BuildPage();
    }
 
    void BuildDataSource()
    {
        this._objectDataSource.DataSource = typeof(Telerik.Reporting.Examples.CSharp.Test.ArriveesPrevues);
        this._objectDataSource.Name = "_objectDataSource";
    }
 
    void BuildPageHeader()
    {
        // _pageHeaderSection
        //
        this._pageHeaderSection.Height = new Telerik.Reporting.Drawing.Unit(1.6998001337051392D, Telerik.Reporting.Drawing.UnitType.Cm);
        this._pageHeaderSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        this._tbTitle_page,
        this._tb_Pages,
        this._tb_Report_header});
        this._pageHeaderSection.Name = "_pageHeaderSection";
        //
        // _tbTitle_page
        //
        this._tbTitle_page.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0037841796875D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(0.00377655029296875D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tbTitle_page.Name = "_tbTitle_page";
        this._tbTitle_page.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(897.55096435546875D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(22.677162170410156D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tbTitle_page.Style.Font.Bold = true;
        this._tbTitle_page.Value = "BLABLABLABLABLABLABLABLABLABLABLABLABLABLABLABLABLABLABLABLA";
 
        //
        // _tb_Pages
        //
        this._tb_Pages.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(897.56231689453125D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(0.003780364990234375D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tb_Pages.Name = "_tb_Pages";
        this._tb_Pages.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(122.9063720703125D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(22.677162170410156D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tb_Pages.Style.Font.Bold = true;
        this._tb_Pages.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Right;
        this._tb_Pages.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
        this._tb_Pages.Value = "=\'Page \' + PageNumber + \' / \' + PageCount";
 
    }
 
    void ReportHeader()
    {
        this._tb_Report_header.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(22.688491821289062D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tb_Report_header.Name = "_tb_Report_header";
        this._tb_Report_header.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1020.4647827148438D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(22.665840148925781D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tb_Report_header.Style.Font.Bold = true;
        this._tb_Report_header.Value = "=\'.......................................... \' + NOW()";
    }
 
    void BuildDetail()
    {
        _tableGroupDetail = new Telerik.Reporting.TableGroup();
        _tableGroupRows = new Telerik.Reporting.TableGroup();
 
        var headerDatas = new ArriveeDatas();
        _tableGroupsTitle = new List<TableGroup>();
        _titlesTextBoxes = new List<TextBox>();
        _datasTextBoxes = new List<TextBox>();
        _totalTextBoxes = new List<TextBox>();
 
        this._detail.Height = new Telerik.Reporting.Drawing.Unit(1.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm);
        this._detail.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        this._table_arrivee});
        this._detail.Name = "_detail";
        this._detail.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
 
 
        for (int i = 0; i < headerDatas.Headers.Count; i++)
            _tableGroupsTitle.Add(new TableGroup());
 
        for (int i = 0; i < headerDatas.Headers.Count; i++)
            _titlesTextBoxes.Add(new TextBox());
        for (int i = 0; i < headerDatas.Headers.Count; i++)
            _datasTextBoxes.Add(new TextBox());
        for (int i = 0; i < headerDatas.Headers.Count; i++)
            _totalTextBoxes.Add(new TextBox());
 
 
        for (int i = 0; i < _titlesTextBoxes.Count; i++)
        {
            _titlesTextBoxes[i].Dock = System.Windows.Forms.DockStyle.Fill;
            _titlesTextBoxes[i].CanShrink = true;
            //_titlesTextBoxes[i].Name = headerDatas.Headers[i].TitleValue;
            _titlesTextBoxes[i].Style.TextAlign = headerDatas.Headers[i].HorizontalAlignTitle;
            _titlesTextBoxes[i].Style.VerticalAlign = headerDatas.Headers[i].VerticalAlignTitle;
            _titlesTextBoxes[i].Value = headerDatas.Headers[i].TitleValue;
            _titlesTextBoxes[i].Style.BackgroundColor = headerDatas.Headers[i].BackgroundTitleColor;
        }
        for (int i = 0; i < _datasTextBoxes.Count; i++)
        {
            _datasTextBoxes[i].Dock = System.Windows.Forms.DockStyle.Fill;
            _datasTextBoxes[i].CanShrink = true;
            _datasTextBoxes[i].Name = "_tb_" + headerDatas.Headers[i].TitleValue + "_data";
            _datasTextBoxes[i].Style.TextAlign = headerDatas.Headers[i].HorizontalAlignData;
            _datasTextBoxes[i].Style.VerticalAlign = headerDatas.Headers[i].VerticalAlignData;
            //_datasTextBoxes[i].Value = headerDatas.Headers[i].DataValue;
        }
 
        for (int i = 0; i < _totalTextBoxes.Count; i++)
        {
            _totalTextBoxes[i].Dock = System.Windows.Forms.DockStyle.Fill;
            _totalTextBoxes[i].CanShrink = true;
            _totalTextBoxes[i].Name = "_tb_" + headerDatas.Headers[i].TitleValue + "_total";
            _totalTextBoxes[i].Style.TextAlign = headerDatas.Headers[i].HorizontalAlignTotal;
            _totalTextBoxes[i].Style.VerticalAlign = headerDatas.Headers[i].VerticalAlignTotal;
            //_totalTextBoxes[i].Value = headerDatas.Headers[i].TotalValue;
        }
 
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(1.8500000238418579D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(4.7000007629394531D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(3.7999999523162842D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Columns.Add(new Telerik.Reporting.TableBodyColumn(new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(new Telerik.Reporting.Drawing.Unit(0.699999988079071D, Telerik.Reporting.Drawing.UnitType.Cm)));
        this._table_arrivee.Body.Rows.Add(new Telerik.Reporting.TableBodyRow(new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm)));
 
 
        for (int i = 0; i < _titlesTextBoxes.Count; i++)
            this._table_arrivee.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { _titlesTextBoxes[i] });
        for (int i = 0; i < _datasTextBoxes.Count; i++)
            this._table_arrivee.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { _datasTextBoxes[i] });
        for (int i = 0; i < _totalTextBoxes.Count; i++)
            this._table_arrivee.Items.AddRange(new Telerik.Reporting.ReportItemBase[] { _totalTextBoxes[i] });
        for (int i = 0; i < _titlesTextBoxes.Count; i++)
        {
            this._table_arrivee.Body.SetCellContent(0, i, _titlesTextBoxes[i]);
            _tableGroupsTitle[i].ReportItem = _titlesTextBoxes[i];
        }
 
        for (int i = 0; i < _datasTextBoxes.Count; i++)
        {
            this._table_arrivee.Body.SetCellContent(1, i, _datasTextBoxes[i]);
        }
        for (int i = 0; i < _tableGroupsTitle.Count; i++)
            this._table_arrivee.ColumnGroups.Add(_tableGroupsTitle[i]);
 
 
 
        this._table_arrivee.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._table_arrivee.Name = "_table_arrivee";
        _tableGroupDetail.Grouping.AddRange(new Telerik.Reporting.Data.Grouping[] { new Telerik.Reporting.Data.Grouping("") });
        _tableGroupDetail.Name = "_tableGroupDetail";
        _tableGroupRows.Name = "_tableGroupRows";
 
        this._table_arrivee.RowGroups.Add(_tableGroupDetail);
        this._table_arrivee.RowGroups.Add(_tableGroupRows);
        this._table_arrivee.RowHeadersPrintOnEveryPage = true;
        this._table_arrivee.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(26.55000114440918D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(2.4000000953674316D, Telerik.Reporting.Drawing.UnitType.Cm));
        this._table_arrivee.Style.Font.Size = new Telerik.Reporting.Drawing.Unit(8D, Telerik.Reporting.Drawing.UnitType.Point);
        this._table_arrivee.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
        this._table_arrivee.Style.VerticalAlign = Telerik.Reporting.Drawing.VerticalAlign.Middle;
    }
 
    void BuildReportFooter()
    {
        _reportFooterSection.Height = new Telerik.Reporting.Drawing.Unit(2.2000000476837158D, Telerik.Reporting.Drawing.UnitType.Cm);
        _reportFooterSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        _panel_ReportBottom});
        _reportFooterSection.Name = "_reportFooterSection";
        _reportFooterSection.PageBreak = Telerik.Reporting.PageBreak.None;
        //
        // _panel_ReportBottom
        //
        _panel_ReportBottom.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        _tb_end_report2,
        _tb_End_report});
        _panel_ReportBottom.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.89999997615814209D, Telerik.Reporting.Drawing.UnitType.Cm));
        _panel_ReportBottom.Name = "_panel_ReportBottom";
        _panel_ReportBottom.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(WidthPage, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(1.3000001907348633D, Telerik.Reporting.Drawing.UnitType.Cm));
        //
        // _tb_end_report2
        //
        _tb_end_report2.Dock = System.Windows.Forms.DockStyle.Bottom;
        _tb_end_report2.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0.70000046491622925D, Telerik.Reporting.Drawing.UnitType.Cm));
        _tb_end_report2.Name = "_tb_end_report2";
        _tb_end_report2.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(WidthPage, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(22.677154541015625D, Telerik.Reporting.Drawing.UnitType.Pixel));
        _tb_end_report2.Style.Color = System.Drawing.SystemColors.GrayText;
        _tb_end_report2.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
        _tb_end_report2.Value = "...................................";
        //
        // _tb_End_report
        //
        _tb_End_report.Dock = System.Windows.Forms.DockStyle.Top;
        _tb_End_report.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(0D, Telerik.Reporting.Drawing.UnitType.Cm));
        _tb_End_report.Name = "_tb_End_report";
        _tb_End_report.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(WidthPage, Telerik.Reporting.Drawing.UnitType.Cm), new Telerik.Reporting.Drawing.Unit(26.456680297851562D, Telerik.Reporting.Drawing.UnitType.Pixel));
        _tb_End_report.Style.Color = System.Drawing.SystemColors.GrayText;
        _tb_End_report.Style.Padding.Top = new Telerik.Reporting.Drawing.Unit(0.20000000298023224D, Telerik.Reporting.Drawing.UnitType.Cm);
        _tb_End_report.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Left;
        _tb_End_report.Value = "BLABLABLA..................";
    }
 
    void BuildPageFooter()
    {
        this._pageFooterSection.Height = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm);
        this._pageFooterSection.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        this._tb_footer_page,
        this._pictureBox_Logo});
        this._pageFooterSection.Name = "_pageFooterSection";
 
        this._tb_footer_page.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
        this._tb_footer_page.CanShrink = false;
        this._tb_footer_page.Location = new Telerik.Reporting.Drawing.PointU(new Telerik.Reporting.Drawing.Unit(0.0037841796875D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(0.39999988675117493D, Telerik.Reporting.Drawing.UnitType.Cm));
        this._tb_footer_page.Name = "_tb_footer_page";
        this._tb_footer_page.Size = new Telerik.Reporting.Drawing.SizeU(new Telerik.Reporting.Drawing.Unit(1020.4647216796875D, Telerik.Reporting.Drawing.UnitType.Pixel), new Telerik.Reporting.Drawing.Unit(22.677154541015625D, Telerik.Reporting.Drawing.UnitType.Pixel));
        this._tb_footer_page.Style.TextAlign = Telerik.Reporting.Drawing.HorizontalAlign.Center;
        this._tb_footer_page.Value = "Medialog - Informatique  Hôtelière";
    }
 
    void BuildPage()
    {
        this.Culture = new System.Globalization.CultureInfo("");
        this.Items.AddRange(new Telerik.Reporting.ReportItemBase[] {
        this._pageHeaderSection,
        this._detail,
        this._pageFooterSection,
        this._reportFooterSection});
        this.PageNumberingStyle = Telerik.Reporting.PageNumberingStyle.Continue;
        this.PageSettings.Landscape = true;
        this.PageSettings.Margins.Bottom = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm);
        this.PageSettings.Margins.Left = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm);
        this.PageSettings.Margins.Right = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm);
        this.PageSettings.Margins.Top = new Telerik.Reporting.Drawing.Unit(1D, Telerik.Reporting.Drawing.UnitType.Cm);
        this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
        this.Style.BackgroundColor = System.Drawing.Color.White;
        this.UnitOfMeasure = Telerik.Reporting.Drawing.UnitType.Cm;
        this.Width = new Telerik.Reporting.Drawing.Unit(WidthPage, Telerik.Reporting.Drawing.UnitType.Cm);
    }
 
}


My DataSource :

public class ArriveesPrevues : System.Collections.Generic.List<ArriveePrevu>
{
    public ArriveesPrevues()
    {
        for (int i = 0; i < 50; i++)
        {
            Add(new ArriveePrevu()
            {
                Date = new StayDateRange
                {
                    DateEnd = DateTime.Now.AddDays(2),
                    DateStart = DateTime.Now
                },
                Nbr = 1,
                Noms = "Coucou",
                Pays = "France",
                Produit = "None",
                Memo = "Un loooooooooooooooog mémo",
                RoomNumber = "105",
                Type = "DOUBLE",
                Prix = 10,
                Solde = 10,
                Arrhes = 0
            });
             
        }
         
    }
}
 
 
public class ArriveePrevu
{
    public string RoomNumber { get; set; }
    public string Type { get; set; }
    public string Noms { get; set; }
    public StayDateRange Date { get; set; }
    public int Nbr { get; set; }
    public string Produit { get; set; }
    public string Memo { get; set; }
    public int Prix { get; set; }
    public int Arrhes { get; set; }
    public int Solde { get; set; }
    public string Pays { get; set; }
}
 
public class StayDateRange : INotifyPropertyChanged
{
    private DateTime _dateStart;
    private DateTime _dateEnd;
 
    public event PropertyChangedEventHandler PropertyChanged;
 
    /// <summary>
    /// Obtient ou définit la date de début de la période
    /// </summary>
    public DateTime DateStart
    {
        get
        {
            return _dateStart;
        }
        set
        {
            _dateStart = value;
            NotifyPropertyChanged("DateStart");
            NotifyPropertyChanged("Duration");
        }
    }
    /// <summary>
    /// Obtient ou définit la date de fin de la période
    /// </summary>
    public DateTime DateEnd
    {
        get
        {
            return _dateEnd;
        }
        set
        {
            _dateEnd = value;
            NotifyPropertyChanged("DateEnd");
            NotifyPropertyChanged("Duration");
        }
    }
    /// <summary>
    /// Renvoit la duré de la période en nb de jours
    /// </summary>
    public int Duration
    {
        get
        {
            return DateEnd.Subtract(DateStart).Days;
        }
    }
 
    /// <summary>
    /// Renvoit la durée de la période en terme hôtelier
    /// CaD : du 24 au 24, renvoit 1
    /// </summary>
    public int DurationForHotelStay
    {
        get
        {
            return DateEnd.AddDays(1).Subtract(DateStart).Days;
        }
    }
 
    protected void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
 
}


Thanks by Advance.

Jérôme Giacomini.

P.S : Excuse me for my bad english.

3 Answers, 1 is accepted

Sort by
0
medialog
Top achievements
Rank 2
answered on 11 Oct 2010, 03:46 PM
I have found a person who has the same error like me, but i don't understand how he fix it.


http://www.telerik.com/community/forums/reporting/telerik-reporting/nullreferenceexception-from-my-code-in-the-detailsection-itemdaabound-event.aspx
0
Steve
Telerik team
answered on 14 Oct 2010, 02:08 PM
Hello Jérôme,

We do not believe the thread you have found is relevant to your case and as far as we can see from the code you've posted, you're basically reusing code created by the Report Designer. In this line of thoughts, can you explain what is the purpose of creating the report through code? Information on your setup and needs would help us advise you accordingly.

Greetings,
Steve
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
medialog
Top achievements
Rank 2
answered on 19 Oct 2010, 04:51 PM
In this line of thoughts, can you explain what is the purpose of creating the report through code?
For activate and desactivate columns, and build on  the fly  columns in function of reports parameters.

I have found why the is an NullReference Exception for information.
When I put a textbox in the table with property Dock at "System.Windows.Forms.DockStyle.Fill;" and the size is not defined.
I have a the NullReference Exception.

For fix this, you must fix the size of each cell, and dont use DockStyle.Fill.
Tags
General Discussions
Asked by
medialog
Top achievements
Rank 2
Answers by
medialog
Top achievements
Rank 2
Steve
Telerik team
Share this question
or