datagrid - label - method syntax problem

G

Guest

Hi,

I am having trouble with the datagrid.
I have a label in an ItemTemplate.
I have a simple function in the label which I have tested and works
(the function does pass back a system.drawing.colour)

I do not know the syntax to pass "theID" into this function!

I am trying stuff like

<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Container.DataItem) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Container.DataItem.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(DataBinder.Eval(Container, "DataItem.theID")) %>">Some
Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(DataItem.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(DataBinder.Eval(Container.DataItem.theID)) %>">Some
Text</asp:Label>


Help please
Charlie
 
C

Chris Botha

Actually BackColor is misleading in the design view of a label, the
background color in the template should be something like
style="background-color: pink"

Note there is a colon right after "color" in the above.
 

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

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,125
Latest member
VinayKumar Nevatia_
Top