By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,998 Members | 2,825 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,998 IT Pros & Developers. It's quick & easy.

Passing 2 values to a function

P: 147

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 <%#(ParallelMating(Eval("Gender"))%>

My CS page has

Expand|Select|Wrap|Line Numbers
  1. protected void Page_Load(object sender, EventArgs e)
  2. {
  3.    if (Request.QueryString["a"]=="123")
  4. {
  5.    string s = "True";
  6.    ParallelMating(s);
  7. }
  9. public string ParallelMating(object o, string s)
  10. {
  11.    string o = Convert.ToString(o);
  12.    if (o == s)
  13.   {
  14.     // do something
  15.   }
  16. }
When I do this, I get the message CS1501: No overload for method 'ParallelMating' takes '1' arguments

Line 170:<%#ParallelMating(Eval("Gender"))%>

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

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


Mar 3 '09 #1
Share this Question
Share on Google+
1 Reply

Expert 5K+
P: 7,872
Your ParallelMating function takes two arguments, neither of your usages provide two arguments.
Mar 3 '09 #2

Post your reply

Sign in to post your reply or Sign up for a free account.