473,666 Members | 2,073 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

can't set text for label within datalist

Below is the code - it is finding the control, and there is no error,
just not assigning the text to the label

<asp:DataList id="dlGoals" runat="server"
onEditCommand=" myListEditHandl er"
onUpdateCommand ="myListUpdateH andler"
onCancelCommand ="myListCancelH andler"
onDeleteCommand ="myListDeleteH andler"
DataKeyField="I D">
<ItemTemplate >
<table border="0" cellpadding="0" cellspacing="0" >
<tr valign="top">
<td><asp:ImageB utton runat="server" commandname="ed it"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton 1"></asp:ImageButton ></td>
<td colspan="2"><as p:label id="LabelGoals "
runat="server"> </asp:label>
<asp:label id="Label1" runat="server"> <%# DataBinder.Eval
(Container.Data Item, "description")% ></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
Trace.Write ("Target Label: " + lblLabel.Client ID);
lblLabel.Text = "dude";
Nov 17 '05 #1
3 5342
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.Data Item, "description")% >></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.co m> wrote in message news:1c******** *************** **@posting.goog le.com...
Below is the code - it is finding the control, and there is no error,
just not assigning the text to the label

<asp:DataList id="dlGoals" runat="server"
onEditCommand=" myListEditHandl er"
onUpdateCommand ="myListUpdateH andler"
onCancelCommand ="myListCancelH andler"
onDeleteCommand ="myListDeleteH andler"
DataKeyField="I D">
<ItemTemplate >
<table border="0" cellpadding="0" cellspacing="0" >
<tr valign="top">
<td><asp:ImageB utton runat="server" commandname="ed it"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton 1"></asp:ImageButton ></td>
<td colspan="2"><as p:label id="LabelGoals "
runat="server"> </asp:label>
<asp:label id="Label1" runat="server"> <%# DataBinder.Eval
(Container.Data Item, "description")% ></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
Trace.Write ("Target Label: " + lblLabel.Client ID);
lblLabel.Text = "dude";


Nov 17 '05 #2
Ya Marina thanks for pointing
To the Poster
Where and which event are you writing the code
Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
Trace.Write ("Target Label: " + lblLabel.Client ID);
lblLabel.Text = "dude"; "Marina" <zl*******@nosp am.hotmail.com> wrote in message news:#Q******** ******@TK2MSFTN GP12.phx.gbl...
That's not really necessary - I have done it the other way, and it works just fine.

However, I believe the poster was referring to the LabelGoals label, not Label1.
"Sonali.NET[MVP]" <xb********@hot mail.com> wrote in message news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.Data Item, "description")% >></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.co m> wrote in message news:1c******** *************** **@posting.goog le.com... Below is the code - it is finding the control, and there is no error,
just not assigning the text to the label

<asp:DataList id="dlGoals" runat="server"
onEditCommand=" myListEditHandl er"
onUpdateCommand ="myListUpdateH andler"
onCancelCommand ="myListCancelH andler"
onDeleteCommand ="myListDeleteH andler"
DataKeyField="I D">
<ItemTemplate >
<table border="0" cellpadding="0" cellspacing="0" >
<tr valign="top">
<td><asp:ImageB utton runat="server" commandname="ed it"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton 1"></asp:ImageButton ></td>
<td colspan="2"><as p:label id="LabelGoals "
runat="server"> </asp:label>
<asp:label id="Label1" runat="server"> <%# DataBinder.Eval
(Container.Data Item, "description")% ></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
Trace.Write ("Target Label: " + lblLabel.Client ID);
lblLabel.Text = "dude";


Nov 17 '05 #3
As included in the code, I need to set the text of the "LabelGoals "
label. Should I need to do it from the init section?

"Sonali.NET[MVP]" <xb so*****@hotmail .com> wrote in message news:<#r******* *******@TK2MSFT NGP09.phx.gbl>. ..
Ya Marina thanks for pointing
To the Poster
Where and which event are you writing the code
Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
Trace.Write ("Target Label: " + lblLabel.Client ID);
lblLabel.Text = "dude";

"Marina" <zl*******@nosp am.hotmail.com> wrote in message
news:#Q******** ******@TK2MSFTN GP12.phx.gbl...
That's not really necessary - I have done it the other way, and it
works just fine.

However, I believe the poster was referring to the LabelGoals label,
not Label1.
"Sonali.NET[MVP]" <xb so*****@hotmail .com> wrote in message
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.Data Item, "description")% >></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.co m> wrote in message
news:1c******** *************** **@posting.goog le.com...
> Below is the code - it is finding the control, and there is no

error,
> just not assigning the text to the label
>
> <asp:DataList id="dlGoals" runat="server"
> onEditCommand=" myListEditHandl er"
> onUpdateCommand ="myListUpdateH andler"
> onCancelCommand ="myListCancelH andler"
> onDeleteCommand ="myListDeleteH andler"
> DataKeyField="I D">
> <ItemTemplate >
> <table border="0" cellpadding="0" cellspacing="0" >
> <tr valign="top">
> <td><asp:ImageB utton runat="server" commandname="ed it"
> ImageUrl="/stap/images/arrow.jpg"
> ID="Imagebutton 1"></asp:ImageButton ></td>
> <td colspan="2"><as p:label id="LabelGoals "
> runat="server"> </asp:label>
> <asp:label id="Label1" runat="server"> <%# DataBinder.Eval
> (Container.Data Item,

"description")% ></asp:label></td></tr></table>
> </ItemTemplate>
> </asp:DataList>
>
> Label lblLabel = ((Label) e.Item.FindCont rol("LabelGoals "));
> Trace.Write ("Target Label: " + lblLabel.Client ID);
> lblLabel.Text = "dude";


--

Nov 17 '05 #4

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

Similar topics

0
1558
by: Bob Rosen | last post by:
The description given in "Customizing Items Dynamically in the DataList or DataGrid Web Server Control" (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vbCode/ html/vbtskCodeCustomizingItemsDynamicallyInDataListWebControlVisualBasic.asp ) says "The examples use the DataList control, but apply to the DataGrid control as well". From what I've experienced, however, that claim isn't quite valid, at least in the case (the...
1
10927
by: bill yeager | last post by:
I have a datagrid control within a datalist control. When I try and do a "Find" on the control, the object comes back with nothing and then my pgm crashes. I am 100% sure that my datagird inside my datalist has an id of "Datagrid3". dgChild comes back with "Nothing" while debugging. Here is my code in the itemdatabound event for the datalist: <code>
1
3620
by: bill yeager | last post by:
I have a radiobuttonlist inside a datalist. I also have a datagrid inside the datalist. The data and the controls are rendering just fine. However, I need to find these controls inside the datalist in order to programatically perform some logic. I have the following in my HTML which is inside the ItemTemplate of the datalist:
1
1753
by: bill yeager | last post by:
I did some more debugging and found the following: 1) I placed the following code in the button event just to see if I could cycle thru the datagrid control collection: <code> Dim strhello As String Dim myDataListItem As DataListItem Dim myDatagridItem As DataGridItem Dim myCheckBox As CheckBox
3
2629
by: Harry | last post by:
Hi, Can anyone tell me why the below code does not work. I dont get any errors, but nor does the Text for the asp:label get set. Thanks in advance as always H
1
2091
by: Mike | last post by:
I've been banging my head on this for days and can't get it working. If i can't get it by today then i'm done with it. I have a datalist that has a table in it <asp:datalist id=dl1> <itemtemplate><table id=vechicle> <tr> <td>dataitem</td> </tr> </table>
2
1232
by: Andy Sutorius | last post by:
Hi, Are datalists able to have labels inside of the ItemTemplate? Every time I try to place a label in the Item Template it does not show up in the code behind/intellisense. FYI the datalist contains items that can be placed in shopping cart. I want the label to notify the user that the placement of the item into the shopping was successful. Thanks,
1
3876
by: | last post by:
I have a label control that I've embedded in a datalist template. I will be binding data to that label. I want to run a string formatting function on the database text before it is injected into the datalist. When I try to do this, I get a "... does not exist in the current context. I need to know how to target the control. If I were writing Flash actionscript, it would be something like
1
2773
by: Steve Hershoff | last post by:
I'm using VS 2003, and need to extract the text from an asp label in my code-behind file. The label is part of a DataList's ItemTemplate. I've noticed that in my ascx file (we're using User Controls here) I can't set the Text property in the opening tag when writing out the <asp:Label....</asp:Labeltags. I have to put my text between the opening and closing tags, like you would with a regular HTML tag. So this might be the cause of...
0
8448
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
8871
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...
0
8783
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8552
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
8640
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5666
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
4369
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2773
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

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.