simple function call from web page question

  • Thread starter Thread starter Yankee Imperialist Dog!
  • Start date Start date
Y

Yankee Imperialist Dog!

i have a bound gridview control and i want to use a bound field as an
argument to a function in code behind.
(simplified version below)
<asp:Label ID="lblIsPrimary" runat="server" Visible='<%#
BisPrimary(Eval("BPrimary")) %>' ..... />

function:
public bool BisPrimary(bool b)
{
return !b;
}

why do i need to use Convert.ToBoolean(Eval("BPrimary")) to make it work.
My data type is bool in my data def.

Is all data on the aspx html section of a webform typeless text?

return b;
}
i keep gretting an
 
All data in aspx section is not typeless but here you use Eval("BPrimary") so
Eval() returns an object that have to be typed inthis case.
 
Back
Top