locked
best overloaded method match RRS feed

  • Question

  • User1519602350 posted

    Could you please help me with the beow issue.

    The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

    Source Error:

    Line 49: 
    Line 50: <div class="blog-meta">
    Line 51: <span class="date" style="padding:0">@verticaltab.datenews.ToString("dd")</span>
    Line 52: 

    The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: The best overloaded method match for 'string.ToString(System.IFormatProvider)' has some invalid arguments

    Source Error:

    Line 49: 
    Line 50: <div class="blog-meta">
    Line 51: <span class="date" style="padding:0">@verticaltab.datenews.ToString("dd")</span>
    Line 52: 
    Thursday, September 4, 2014 5:52 AM

Answers

  • User-760709272 posted

    "datenews" will be a string, so there isn't a ToString on the string class that accepts something like "dd".  For your code to work "datenews" will have to be of type DateTime.  Either change the type, or get whatever populates datenews from a DateTime to do the ToString("dd") when it sets the model's value.  You're probably better changing the type though.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Thursday, September 4, 2014 6:08 AM