Solved

Filling listview (ASP.net)

Posted on 2010-11-18
2
341 Views
Last Modified: 2012-05-10
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?
0
Comment
Question by:o3h
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 500 total points
ID: 34163250
Nested quotes problem:

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

Open in new window

0
 
LVL 13

Expert Comment

by:devlab2012
ID: 34163960

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

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

895 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now