Passing 2 values to a function

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

    Passing 2 values to a function

    Hello

    Is it possilble to pass an object and a string to a function?
    The object lives on the aspx page and the string live in a seperate function in the .cs page.

    My ASPX page has an <%#(ParallelMat ing(Eval("Gende r"))%>

    My CS page has

    Code:
    protected void Page_Load(object sender, EventArgs e)
    {
       if (Request.QueryString["a"]=="123")
    {
       string s = "True";
       ParallelMating(s);
    }
    
    public string ParallelMating(object o, string s)
    {
       string o = Convert.ToString(o);
       if (o == s)
      {
        // do something
      }
    } 
    }
    When I do this, I get the message CS1501: No overload for method 'ParallelMating ' takes '1' arguments

    Line 170:<%#Parallel Mating(Eval("Ge nder"))%>

    (pleae note, the Line170 is from the aspx page)

    I can only assume the <%#ParallelMati ng(Eval)("Gende r"))%> needs to also pass a string to the code behind, but again, I have no idea how?

    Thanks

    Dave
  • Plater
    Recognized Expert Expert
    • Apr 2007
    • 7872

    #2
    Your ParallelMating function takes two arguments, neither of your usages provide two arguments.

    Comment

    Working...