No overload for method 'Eval' takes '4' arguments

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • DaveRook
    New Member
    • Jul 2007
    • 147

    #1

    No overload for method 'Eval' takes '4' arguments

    Any ideas with this?

    HTML page
    Code:
    <%#loc(Eval("B", "U", "M", "S"))%>
    code behind
    Code:
    public String loc(object o1, object o2, object o3, object o4)
    	{
    		string s = Convert.ToString(o1) + Convert.ToString(o2) + Convert.ToString(o3) + Convert.ToString(o4);
    		return s;
    	}
    The B U M and S are objects from a database. At any point, only 3 of the 4 objects will have content. Could this "No overload for method 'Eval' takes '4' arguments" error be casued due to a value returning empty or null from the database?

    Dave
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    No. Its saying that your Eval method doesn't take 4 parameters.

    Please show us the code for your Eval method and we'll see if we can help out.

    Comment

    • DaveRook
      New Member
      • Jul 2007
      • 147

      #3
      This has confused me! All the code is above!

      I often use <%#method(Eval( "columName" ))%> and the method is in the code behind (in the above example a public string function)

      For example, this works:

      html
      <%#loc(Eval("B" ))%>
      codebehind
      public String loc(object o)
      {
      string s = Convert.ToStrin g(o);
      return s;
      }
      I just want to do the above with 4 objects in the parameters

      Sorry if being dense

      Dave

      Comment

      • DaveRook
        New Member
        • Jul 2007
        • 147

        #4
        I solved it by changing to
        <%#loc(Eval("B" ))%><%#loc(Eval ("S"))%><%#loc( Eval("M"))%><%# loc(Eval("U"))% >

        I wanted to do the 4 statements as 1 but doing it like this is fine.

        Thanks

        Comment

        • Frinavale
          Recognized Expert Expert
          • Oct 2006
          • 9749

          #5
          Glad you solved the problem :)
          In the future, please remember that when you're binding, you can only bind to 1 thing at a time.

          -Frinny

          Comment

          • DaveRook
            New Member
            • Jul 2007
            • 147

            #6
            Frinavale - that answered the question!! Thank you

            Comment

            Working...