Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Reporting > Telerik Reporting > 'Input string was not in a correct format.' But where?

Not answered 'Input string was not in a correct format.' But where?

Feed from this thread
  • Lukas avatar

    Posted on Jan 24, 2011 (permalink)

    Hi,

    I'm creating a report based on a stored procedure, expecting 2 datetime paramaters.
    The 2 datetime parameters are filled by ReportParameters of type DateTime an valid value; Testing the statment in the DataSource Wizard shows correct result set; no null values or else.

    While developing, the report worked fine in preview mode, but in the end, something was changed, by me or a co-worker, and now the report only shows 'Input String was not in a correct format'.

    We don't know what exact step caused this error, but we digged through the whole report, trying to find what causes this.
    We removed every expression, every data field, all conditional formating, replaced the ReportParameter by static values and removed every grouping and filtering.

    ... the Report still shows this error.

    Is there a way to get the details of the exception which seems to be thrown? Or is there any other way to get more details why or where this error is thrown exactly?
    There error message doesn't help at all.


    Any help is appreciated, we don't want to start all over again.


    Thanks in advance

    Reply

  • Steve Steve avatar

    Posted on Jan 24, 2011 (permalink)

    Hello Lukas,

    You can use either the report error handling or the processing error handling mechanism to check for errors. For example you need to handle the Report.Error event in order to be notified when and what error occurs and handle it as you find necessary. The ErrorEventArgs contains the info you're looking for. Check the current exception from the ErrorEventArgs.Exception property. Also check the Exception.InnerException property for any related exceptions.

    Greetings,
    Steve
    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.

    Reply

  • Lukas avatar

    Posted on Jan 25, 2011 (permalink)

    Hello Steve,

    thanks fo the answer.
    I implemented handling the error like this

    Private Sub Report_Error(ByVal sender As Object, ByVal eventArgs As Telerik.Reporting.ErrorEventArgs) Handles Me.Error
           MessageBox.Show(eventArgs.Exception.Message)
       End Sub

    Sadly the event is not raised on the 'Input string was not in a correct format' error.
    If I provoke any other error in the report, like a division by zero, the event is raised and I can see the exception in debugging.

    I tested this in designer/preview mode and in a extra WinForms application for testing.

    You pointed out another way of error handling
    You can use either the report error handling or the processing error handling mechanism to check for errors.

    Could explain me the other way?


    thanks

    Lukas

    Reply

  • Steve Steve avatar

    Posted on Jan 28, 2011 (permalink)

    Hi Lukas,

    Both error handling mechanisms are the same that is why I said "either .. or". By the way have you checked the Output window of Visual Studio for exception details? It should contain the error message with stack trace if you run the project. Additionally we recommend enabling the CLR exceptions from Visual Studio's Debug --> Exceptions menu that could provide more details.

    Best wishes,
    Steve
    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.

    Reply

  • Lukas avatar

    Posted on Feb 2, 2011 (permalink)

    Hello Steve,

    finally I was able to catch the exception by handling the AppDomain.FirstChanceException-Event

    Unfortunatly it didn't help much...

    Here is the StackTrace:
    System.FormatException: Input string was not in a correct format.
       at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
       at System.String.Format(IFormatProvider provider, String format, Object[] args)
       at Telerik.Reporting.Processing.TextItemBase.FormatValue(Object value)
       at Telerik.Reporting.Processing.TextBox.get_Text()
       at Telerik.Reporting.Processing.TextBoxUtil.GetNormalizedText(ITextContainer textContainer)
       at Telerik.Reporting.Processing.TextBoxUtil.MeasureTextContainer(ITextContainer textContainer, Graphics graphics)
       at Telerik.Reporting.Processing.TextBox.Measure(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.Table.Measure(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.ProcessingElement.Measure(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.ReportSectionBase.Measure(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.ProcessingElement.MeasureElement(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.Group.MeasureElement(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.Report.MeasureElement(MeasureDirection dir, Graphics graphics)
       at Telerik.Reporting.Processing.Report.MeasureElement(ProcessingElement elementToMeasure)
       at Telerik.Reporting.Processing.Report.OnItemProcessed()
       at Telerik.Reporting.Processing.ReportItemBase.Process(DataMember data)
       at Telerik.Reporting.Processing.Report.Process(DataMember data, DataItemState state, Boolean interactivityEnabled, Boolean documentMapEnabled)
       at Telerik.Reporting.Processing.ReportProcessor.ProcessReport(IReportDocument reportDocument, IDictionary processingContext)
       at Telerik.Reporting.Processing.ReportProcessor.RenderReport(String format, IReportDocument reportDocument, Hashtable deviceInfo, Hashtable renderingContext, CreateStream createStreamCallback)
       at Telerik.ReportViewer.WinForms.RenderingThread.ThreadFunc(Object o)

    The output windows shows  many other entries, but nothing related to this exception.
    I tried to attach it, but no txt-Files are allowed an its too big to post in the thread.

    I do not know how to investigate this any further, so I would be thankfull for any hints or leads.


    thx
    Lukas

    Reply

  • Steve Steve avatar

    Posted on Feb 7, 2011 (permalink)

    Hello Lukas,

    Thank you for the stack trace. This error is generated whenever there is a wrong format applied for a textbox item. Please check the formatting of all textbox items (e.g. you can search for Format in Designer.cs file and reset them if needed in order to make the report run correctly. You can then format the needed values manually by using the Format Builder Dialog.
    If you're having problem pinpointing the culprit, please open a support ticket and attach the problematic report.

    Greetings,
    Steve
    the Telerik team
    Get started with Telerik Reporting with numerous videos and detailed documentation.

    Reply

  • Nav avatar

    Posted on May 3, 2012 (permalink)

    I had a similar problem and I fixed it, I hope it's not too late for sharing the solution:

    Please verify the type of property used in your parameter definition of the receiver control. For example (and in my case):

    <asp:ControlParameter ControlID="RadListBox1" DefaultValue="1" Name="PageID" PropertyName="SelectedItem.DataKey" Type="Int32" /></SelectParameters>

    I was using a wrong property "SelectedValue" which conatined a String value, but the type specified was Int32. Then I remembered that a while ago I changed my code to use "SelectedItem.DataKey" instead, but I forgot to update the client side code (HTML part).

    As soon as I changed it everything was fixed.

    I hope this helps.
    Nav.

    Reply

Back to Top

Skip Navigation LinksHome / Community & Support / Developer Productivity Tools Forums / Reporting > Telerik Reporting > 'Input string was not in a correct format.' But where?
Related resources for "'Input string was not in a correct format.' But where?"

Features  |  Documentation  |  Demos  |  Telerik TV  |  Knowledge Base  |  Code Library  |  Step-by-step Tutorial  |  Blogs  |  Whitepaper  ]