Wrox Programmer Forums
BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6
This is the forum to discuss the Wrox book ASP.NET 2.0 Instant Results by Imar Spaanjaars, Paul Wilton, Shawn Livermore; ISBN: 9780471749516
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old September 25th, 2008, 11:49 AM
Registered User
Join Date: Sep 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataList issue

On the WebShop checkout page, I'm trying to get textbox values from a datalist to the code behind page. I can get evry other value except those from the datalist.

From checkout.aspx.vb, in the Sub btnFinalize_Click section:

Dim theNotes As notes = New notes(notes.Text, DropDownList1.Text, lblPoNum.Text, TextBox3.Text)

notes.Text, DropDownList1.Text, lblPoNum.Text pull right from checkout.aspx.
TextBox3.text, however, does not and the only difference I can see is that it's in a datalist.

Any suggestions?
Old September 25th, 2008, 03:49 PM
Imar's Avatar
Wrox Author
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts

Hi there,

Controls contained in repeating controls like the DataList are not directly accessible. You need to use FindControl to find the relevant control, like this:

Dim myTextBox As TextBox = CType(DataList1.FindControl("SomeTextBox", TextBox)

You cannot always call this, as the TextBox needs to be in scope. You typically call this from one of the events that the DataList raises.

Hope this helps,


Imar Spaanjaars
Everyone is unique, except for me.
Author of Beginning ASP.NET 3.5 : in C# and VB, ASP.NET 2.0 Instant Results and Dreamweaver MX 2004
Want to be my colleague? Then check out this post.

Similar Threads
Thread Thread Starter Forum Replies Last Post
DataList pbyrum ASP.NET 2.0 Basics 2 December 3rd, 2009 04:01 PM
Datalist webnathan Oracle 1 October 20th, 2008 03:46 AM
Datalist inside datalist amit.jagtap ASP.NET 2.0 Professional 1 September 4th, 2007 05:03 AM
Datalist cp75 ASP.NET 1.0 and 1.1 Professional 10 September 8th, 2006 11:38 AM
about datalist bvrao VS.NET 2002/2003 0 December 24th, 2003 06:15 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.