Link to home
Start Free TrialLog in
Avatar of o3h
o3h

asked on

Filling listview (ASP.net)

Hi inside a <ItemTemplate> of a Listview I try to do this:

<asp:Label ID="RolesLabel" runat="server" Text='<%# GetRoles(Eval('Id')) %>' />

In code-behind I have a function:
   public string GetRoles(string id);

GetRoles looks up a bunch of roles and returns a string with rolenames. Byt I cant get this to work.
The error lies here:
GetRoles(Eval('Id')) , wrong syntax?
ASKER CERTIFIED SOLUTION
Avatar of Carl Tawn
Carl Tawn
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial

Correct the quotes and use Eval("id").ToString()

<asp:Label ID="RolesLabel" runat="server" Text='<%# GetRoles(Eval("Id").ToString()) %>' />