simple function call from web page question

  • Thread starter Yankee Imperialist Dog!
  • 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
 
F

Frédéric H

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top