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.
<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.
Comment