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

accessing datalist child controls

I think I'm close to making this work, but so far it does not.

I have a datalist (id = "dlVFields") on a web form that has an item template
with a textbox in it. The textbox id = "txtVerify". When the form is
submitted via a button click (button is outside datalist) I loop through the
datalist's DataListItem collection to retrieve any values entered into the
textboxes. My problem is that I'm not getting anything back from the
textboxes when they have had text entered into them. I'm sure it's the way
I'm referencing them.
All the examples I've found are driven by events within the datalist, and
mine is not.
Here's what I'm currently trying:

For Each dlitem In dlVerify.Items

Dim strField As String = dtVFields.Rows.Item(i).Item("Field")

Dim tb As TextBox = CType(dlitem.FindControl("txtVerify"), TextBox)

txtInput = tb.txt

i = i + 1

Next

------------------------

It seems that tb.text is always = "". Can anyone tell me how to correctly
reference that control in this context? Thanks!

Matt
Nov 18 '05 #1
2 1986
Hmm, not sure. Does the last TextBox in the DataList have any text? If not,
then maybe the txtInput string is being overwritten. Try this...

txtInput = txtInput & tb.txt

....and see if that works.

"MattB" <so********@yahoo.com> wrote in message
news:c6************@ID-86156.news.uni-berlin.de...
I think I'm close to making this work, but so far it does not.

I have a datalist (id = "dlVFields") on a web form that has an item template with a textbox in it. The textbox id = "txtVerify". When the form is
submitted via a button click (button is outside datalist) I loop through the datalist's DataListItem collection to retrieve any values entered into the
textboxes. My problem is that I'm not getting anything back from the
textboxes when they have had text entered into them. I'm sure it's the way
I'm referencing them.
All the examples I've found are driven by events within the datalist, and
mine is not.
Here's what I'm currently trying:

For Each dlitem In dlVerify.Items

Dim strField As String = dtVFields.Rows.Item(i).Item("Field")

Dim tb As TextBox = CType(dlitem.FindControl("txtVerify"), TextBox)

txtInput = tb.txt

i = i + 1

Next

------------------------

It seems that tb.text is always = "". Can anyone tell me how to correctly
reference that control in this context? Thanks!

Matt

Nov 18 '05 #2
I think that you are missing something...

Try this

Dim tb As TextBox = CType(dlitem.SelectedItem.FindControl("txtVerify") , TextBox

You need to do the FindControl within the selected item on the list and not the List itself
----- MattB wrote: ----

I think I'm close to making this work, but so far it does not

I have a datalist (id = "dlVFields") on a web form that has an item templat
with a textbox in it. The textbox id = "txtVerify". When the form i
submitted via a button click (button is outside datalist) I loop through th
datalist's DataListItem collection to retrieve any values entered into th
textboxes. My problem is that I'm not getting anything back from th
textboxes when they have had text entered into them. I'm sure it's the wa
I'm referencing them
All the examples I've found are driven by events within the datalist, an
mine is not
Here's what I'm currently trying

For Each dlitem In dlVerify.Item

Dim strField As String = dtVFields.Rows.Item(i).Item("Field"

Dim tb As TextBox = CType(dlitem.FindControl("txtVerify"), TextBox

txtInput = tb.tx

i = i +

Nex

-----------------------

It seems that tb.text is always = "". Can anyone tell me how to correctl
reference that control in this context? Thanks

Mat

Nov 18 '05 #3

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

Similar topics

4
by: Moojjoo | last post by:
Ok fellow C# developers: How do creat an instance of an object inside a dataset or datagrid. Example I need to have a placeholder inside a dataset. Any help would be great.
1
by: wsyeager36 | last post by:
I have a datagrid inside a datalist. The datalist shows parent info and the datagrid shows the child info for that parent. There is a checkbox on each row of the child datagrid. Also inside the...
8
by: MattB | last post by:
I think I'm close to making this work, but so far it does not. I have a datalist (id = "dlVFields") on a web form that has an item template with a textbox in it. The textbox id = "txtVerify"....
8
by: Nevyn Twyll | last post by:
I have a multi-level datalist setup: DataList1 DataList2 MyGrid I have columns explicitly defined for the grid in the html. Sometimes, On the initial Load() of the Page, I want to add extra...
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:
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
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
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...
0
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...
0
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...

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.