ItemTemplate and code behind data passing

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • redeye
    New Member
    • Oct 2007
    • 5

    ItemTemplate and code behind data passing

    I am trying to do a simple calculation and then databind it in my repeater. The ItemTemplate code sends two integers to a code behind function as follows

    <td style="width: 75px">
    <asp:Label Text='<%# Get_Percent(Eva l("Total"), Eval("itemCount ")) %>' Runat="Server" />
    </td>


    The C# function is as follows:

    protected int Get_Percent(int baseline, int available, out int percent)
    {
    if (available > 0)
    {
    percent = available / baseline * 100;
    }
    else percent = 0;
    return percent;

    }

    My build error is: No overload for method ‘Get_Percent’ takes ‘2’ arguments.
    I know this should be simple, but I’m not sure where my mistake is. Any help would be greatly appreciated.
  • Shashi Sadasivan
    Recognized Expert Top Contributor
    • Aug 2007
    • 1435

    #2
    Get_Percent takes 3 arguments, and you are passing only 2 !!! (ding ding)

    Comment

    • redeye
      New Member
      • Oct 2007
      • 5

      #3
      OK, after some other twikes like convert and using getting ride of the ints it worked.
      Thanks

      Comment

      Working...