473,795 Members | 2,919 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

datagrid - label - method syntax problem

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(Co ntainer.DataIte m) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Co ntainer.DataIte m.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer, "DataItem.theID ")) %>">Some
Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taItem.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer.DataIt em.theID)) %>">Some
Text</asp:Label>
Help please
Charlie
Nov 19 '05 #1
2 1236
Actually BackColor is misleading in the design view of a label, the
background color in the template should be something like
style="backgrou nd-color: pink"

Note there is a colon right after "color" in the above.
"CharlieOz1 " <Ch********@dis cussions.micros oft.com> wrote in message
news:A4******** *************** ***********@mic rosoft.com...
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(Co ntainer.DataIte m) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Co ntainer.DataIte m.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer, "DataItem.theID ")) %>">Some
Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taItem.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer.DataIt em.theID)) %>">Some
Text</asp:Label>
Help please
Charlie

Nov 19 '05 #2
Charlie,

What id are you trying to pass?

Eliyahu

"CharlieOz1 " <Ch********@dis cussions.micros oft.com> wrote in message
news:A4******** *************** ***********@mic rosoft.com...
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(Co ntainer.DataIte m) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Co ntainer.DataIte m.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer, "DataItem.theID ")) %>">Some
Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taItem.theID) %>">Some Text</asp:Label>
and
<asp:Label id="lblName" runat="server" BackColor="<%#
functionName(Da taBinder.Eval(C ontainer.DataIt em.theID)) %>">Some
Text</asp:Label>
Help please
Charlie

Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
3639
by: Clayton Hamilton | last post by:
I have a DataGrid on a webform bound to a Datasource and can successfully use <ItemTemplate> to create edit/update/cancel functionality for user maintenance of data. I use separate logic to delete a row. Everything works just fine. BUT I would like to add a button to (for example) the DataGrid header, which when pressed will add a new row to the datagrid. This should then allow the user to enter information into text boxes (in some...
2
3903
by: Dave Bailey | last post by:
I am trying to dynamically build a DataGrid dynamically. The code runs OK but the DataGrid is never built and displayed. Can someone look at the following code and see if they can determine what I am missing. Thanks, Dave using System;
1
2526
by: Joe Bloggs | last post by:
I am trying display the contents of a table in a web page, select certain rows from that table and then display the fields that I have selected (now table columns) as text in a Label object. Amazingly I have managed to display the table - no problem, I can select rows - no problem, BUT I can't work out how to display more than one of the fields (now columns in the table in the web page). I can display one field OK, but not more than one...
1
8908
by: Webgour | last post by:
Hi, I'm tring to add a column to a datagrid with a linkbutton as header that can be used to sort the column. The column and the linkbutton are added programmatically (see below). However the problem is that when you click the added column header it doesn't trigger the sort. The code : <%@ Page language="c#" Codebehind="WebForm1.aspx.cs" AutoEventWireup="false"
12
2882
by: James Norton-Jones | last post by:
Hi, Am I trying to hold the data of a DataGrid in a label so that when the form is reposted the DataGrid can be repopulated. The problem I am having is that I don't understand how to get the text into a stream in order to be able to use DataSetOutcomes1.ReadXML(MyStream). Thanks in advance, James
1
1723
by: Mike Speak | last post by:
On my page_load, I am populating a Datagrid through the normal manner (which works) before attempting to pick out the items in one column to use in another part of my page. This is all within page_load. Within my Datagrid I have an <ItemTemplate/> tag with a child <asp:Label/> tag. The ID on the <asp:Label/> tag is set to "lblDescription". I am using the following code to iterate over the DataGrid control and pick out the descriptions...
1
4341
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch the layout, some have child controls):
5
2795
by: tshad | last post by:
Is there a way to carry data that I have already read from the datagrid from page to page? I am looking at my Datagrid that I page through and when the user says get the next page, I have to go to the database to get the next page. Is there a way to use the dataset to allow us to read back and forth in it instead of going back to the database to get it? Thanks,
0
2081
by: | last post by:
I have a question about spawning and displaying subordinate list controls within a list control. I'm also interested in feedback about the design of my search application. Lots of code is at the end of this message, but I will start with an overview of the problem. I've made a content management solution for my work with a decently structured relational database system. The CMS stores articles. The CMS also stores related items --...
0
9673
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9522
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10443
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10165
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6783
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5565
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3728
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2921
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.