Solved

Filling listview (ASP.net)

Posted on 2010-11-18
2
340 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
Comment Utility
Nested quotes problem:

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

Open in new window

0
 
LVL 13

Expert Comment

by:devlab2012
Comment Utility

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

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

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

ASP.Net to Oracle Connectivity Recently I had to develop an ASP.NET application connecting to an Oracle database.As I am doing it first time ,I had to solve several problems. This article will help to such developers  to develop an ASP.NET client…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

762 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

12 Experts available now in Live!

Get 1:1 Help Now