Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Filling listview (ASP.net)

Posted on 2010-11-18
2
Medium Priority
?
348 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 52

Accepted Solution

by:
Carl Tawn earned 2000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

705 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