473,382 Members | 1,445 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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="myListEditHandler"
onUpdateCommand="myListUpdateHandler"
onCancelCommand="myListCancelHandler"
onDeleteCommand="myListDeleteHandler"
DataKeyField="ID">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><asp:ImageButton runat="server" commandname="edit"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton1"></asp:ImageButton></td>
<td colspan="2"><asp:label id="LabelGoals"
runat="server"></asp:label>
<asp:label id="Label1" runat="server"><%# DataBinder.Eval
(Container.DataItem, "description")%></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindControl("LabelGoals"));
Trace.Write ("Target Label: " + lblLabel.ClientID);
lblLabel.Text = "dude";
Nov 17 '05 #1
3 5329
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.DataItem, "description")%>></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.com> wrote in message news:1c*************************@posting.google.co m...
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="myListEditHandler"
onUpdateCommand="myListUpdateHandler"
onCancelCommand="myListCancelHandler"
onDeleteCommand="myListDeleteHandler"
DataKeyField="ID">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><asp:ImageButton runat="server" commandname="edit"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton1"></asp:ImageButton></td>
<td colspan="2"><asp:label id="LabelGoals"
runat="server"></asp:label>
<asp:label id="Label1" runat="server"><%# DataBinder.Eval
(Container.DataItem, "description")%></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindControl("LabelGoals"));
Trace.Write ("Target Label: " + lblLabel.ClientID);
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.FindControl("LabelGoals"));
Trace.Write ("Target Label: " + lblLabel.ClientID);
lblLabel.Text = "dude"; "Marina" <zl*******@nospam.hotmail.com> wrote in message news:#Q**************@TK2MSFTNGP12.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********@hotmail.com> wrote in message news:%2****************@TK2MSFTNGP09.phx.gbl...
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.DataItem, "description")%>></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.com> wrote in message news:1c*************************@posting.google.co m... 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="myListEditHandler"
onUpdateCommand="myListUpdateHandler"
onCancelCommand="myListCancelHandler"
onDeleteCommand="myListDeleteHandler"
DataKeyField="ID">
<ItemTemplate>
<table border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td><asp:ImageButton runat="server" commandname="edit"
ImageUrl="/stap/images/arrow.jpg"
ID="Imagebutton1"></asp:ImageButton></td>
<td colspan="2"><asp:label id="LabelGoals"
runat="server"></asp:label>
<asp:label id="Label1" runat="server"><%# DataBinder.Eval
(Container.DataItem, "description")%></asp:label></td></tr></table>
</ItemTemplate>
</asp:DataList>

Label lblLabel = ((Label) e.Item.FindControl("LabelGoals"));
Trace.Write ("Target Label: " + lblLabel.ClientID);
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**************@TK2MSFTNGP09.phx.gbl>...
Ya Marina thanks for pointing
To the Poster
Where and which event are you writing the code
Label lblLabel = ((Label) e.Item.FindControl("LabelGoals"));
Trace.Write ("Target Label: " + lblLabel.ClientID);
lblLabel.Text = "dude";

"Marina" <zl*******@nospam.hotmail.com> wrote in message
news:#Q**************@TK2MSFTNGP12.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****************@TK2MSFTNGP09.phx.gbl...
Write
<asp:label id="Label1" runat="server" text=<%# DataBinder.Eval
(Container.DataItem, "description")%>></asp:label>
Assign value to the Text Property of the Label
"Dude" <ho****@post.com> wrote in message
news:1c*************************@posting.google.co m...
> 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="myListEditHandler"
> onUpdateCommand="myListUpdateHandler"
> onCancelCommand="myListCancelHandler"
> onDeleteCommand="myListDeleteHandler"
> DataKeyField="ID">
> <ItemTemplate>
> <table border="0" cellpadding="0" cellspacing="0">
> <tr valign="top">
> <td><asp:ImageButton runat="server" commandname="edit"
> ImageUrl="/stap/images/arrow.jpg"
> ID="Imagebutton1"></asp:ImageButton></td>
> <td colspan="2"><asp:label id="LabelGoals"
> runat="server"></asp:label>
> <asp:label id="Label1" runat="server"><%# DataBinder.Eval
> (Container.DataItem,

"description")%></asp:label></td></tr></table>
> </ItemTemplate>
> </asp:DataList>
>
> Label lblLabel = ((Label) e.Item.FindControl("LabelGoals"));
> Trace.Write ("Target Label: " + lblLabel.ClientID);
> 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
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/...
1
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...
1
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...
1
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...
3
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
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>...
2
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...
1
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...
1
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.