473,386 Members | 1,720 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,386 software developers and data experts.

stuck on this one

I'm trying to find a label and the value within a datalist, i've done this in
the passed in the datalist_itemdatbound routine and worked likes a charm. Now
I"m trying to do the samething in a seperate routine and I can't find the
value.
in the routine i'm getting the value of the checkbox, checked or not and
passing that correctly, I also want to the get a the value of the associated
label with the checkbox and i can't get that working.

I have this:
for I = o to datalist.items.count - 1
checked = datalist.items(I).findcontrol("checkbox")
text = datatlist.items(I).findcontrol("labelname")
value = value & checked.checked.tostring() & text.text.tostring()
next

i'm getting the checkbox value but not the text value.

any ideas why this is happening?

Nov 18 '05 #1
2 1850
I writing this in the C#. You will be able to convert it to the VB

CheckBox cb = (CheckBox)datalist.items[i].Controls.FindControl("checkbox");
bool cval = cb.Checked;
Label lbl = (Label)datalist.items[i].Controls.FindControl("label");

also you can use code like this:

CheckBox cb = (CheckBox)datalist.items[i].Controls[0];
bool cval = cb.Checked;
Label lbl = (Label)datalist.items[i].Controls[1];

in the C# the first control is 0 and in the VB the first control is 1
if your listItem has two controls you have to try to find control 1 and 2

bye

"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
I'm trying to find a label and the value within a datalist, i've done this in the passed in the datalist_itemdatbound routine and worked likes a charm. Now I"m trying to do the samething in a seperate routine and I can't find the
value.
in the routine i'm getting the value of the checkbox, checked or not and
passing that correctly, I also want to the get a the value of the associated label with the checkbox and i can't get that working.

I have this:
for I = o to datalist.items.count - 1
checked = datalist.items(I).findcontrol("checkbox")
text = datatlist.items(I).findcontrol("labelname")
value = value & checked.checked.tostring() & text.text.tostring()
next

i'm getting the checkbox value but not the text value.

any ideas why this is happening?

Nov 18 '05 #2
thats simialar to what i have and i can't get the label to be recognized:

For I = 0 To datalist.Items.Count - 1
checkbox= dlScores.Items(I).FindControl("chkStuff")
CarInformation= dlScores.Items(G).FindControl("CarStuff")
value = value & checkbox.Checked.ToString() & "|" &
CarInformation.text & "|"
Next I
"Michael Tkachev" wrote:
I writing this in the C#. You will be able to convert it to the VB

CheckBox cb = (CheckBox)datalist.items[i].Controls.FindControl("checkbox");
bool cval = cb.Checked;
Label lbl = (Label)datalist.items[i].Controls.FindControl("label");

also you can use code like this:

CheckBox cb = (CheckBox)datalist.items[i].Controls[0];
bool cval = cb.Checked;
Label lbl = (Label)datalist.items[i].Controls[1];

in the C# the first control is 0 and in the VB the first control is 1
if your listItem has two controls you have to try to find control 1 and 2

bye

"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:F6**********************************@microsof t.com...
I'm trying to find a label and the value within a datalist, i've done this

in
the passed in the datalist_itemdatbound routine and worked likes a charm.

Now
I"m trying to do the samething in a seperate routine and I can't find the
value.
in the routine i'm getting the value of the checkbox, checked or not and
passing that correctly, I also want to the get a the value of the

associated
label with the checkbox and i can't get that working.

I have this:
for I = o to datalist.items.count - 1
checked = datalist.items(I).findcontrol("checkbox")
text = datatlist.items(I).findcontrol("labelname")
value = value & checked.checked.tostring() & text.text.tostring()
next

i'm getting the checkbox value but not the text value.

any ideas why this is happening?


Nov 18 '05 #3

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

Similar topics

1
by: No | last post by:
I purchased a program ( So I thought) that turned out to be just a bunch of php scripts put together. I am getting terrible support from the author but I am biting my tongue because I don't want...
2
by: Vladimir | last post by:
I'm running ASP on IIS 5.1 on Windows XP, the same thing works on Windows 98 with PWS. The function below stuck the IIS - draws only frame with nothing inside and wait for infinite. All other...
3
by: Yeren | last post by:
We run a website with pages that are created using ASP. The website is used by different people from different networks. For some people, the pages are stuck. It looks like the were able to open...
8
by: MLH | last post by:
I use a mouse-down procedure to trap right mouse clicks and CTRL-Right mouse clicks. Running the procedure must put honey or some other sticky substance into my keyboard because subsequent...
0
by: Mark Phillips | last post by:
Hello, I am having a problem in which a file can get stuck open when a thread that is attempting to write to it gets aborted (ThreadAbortedException occurs). The log file gets stuck open until...
4
by: Astronomically Confused | last post by:
using System; using System.Collections; using System.IO; using System.Net; using System.Net.Sockets; using System.Threading; class HttpProcessor { private Socket s;
4
by: =?Utf-8?B?TWF1cg==?= | last post by:
My cd is stuck in the drive. I can open the drawer O K but the c d will not come out Help me please -- Maur
0
by: =?Utf-8?B?QmlsbEI=?= | last post by:
This is a tough one... My Windows Service app periodically performs some processing on new entries to a SQL Server database table. It uses a simple System.Timer to call the Elapsed event...
7
by: alphasahoo | last post by:
Hi I am working on a program which writes the output a SQL select statements from number of source tables first to a load matrix and then writes to a load.dat file. But while writing to the...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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,...
0
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,...

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.