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

Extracting TextBox.Text from within a Datalist


I have a datalist called datalist2
I want to get the text from a textbox called textbox1 which is in the
ItemTemplate of the datalist.

In the past I have gotten information out of the create user control in
the following way:
((TextBox)CreateUserWizard1.CreateUserStep.Content TemplateContainer.FindControl("StudentID")).Text;
But the same approach doesn't work with the datalist...
Please help!?

--
BisMan
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jan 19 '08 #1
1 1798
If you are doing it from withing one of the DataList events (such as
ItemCommand) you can do the following:

((TextBox)e.Item.FindControl("StudentID")).Text

Just like you were before, only you are accessing the current item using one
of the event arguments

If you are not working in one of the DataList events, use the following:

((TextBox)DataList.Items(item_index).FindControl(" StudentID")).Text
--
Nathan Sokalski
nj********@hotmail.com
http://www.nathansokalski.com/

"BisMan" <Bi***********@mail.codecomments.comwrote in message
news:Bi***********@mail.codecomments.com...
>
I have a datalist called datalist2
I want to get the text from a textbox called textbox1 which is in the
ItemTemplate of the datalist.

In the past I have gotten information out of the create user control in
the following way:
((TextBox)CreateUserWizard1.CreateUserStep.Content TemplateContainer.FindControl("StudentID")).Text;
But the same approach doesn't work with the datalist...
Please help!?

--
BisMan
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

Jan 19 '08 #2

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

Similar topics

1
by: Rimu Atkinson | last post by:
hi all i use FindControl to get a textbox, and i get a textbox object, but it's ..Text property is empty. some background info: i have a DataList, which has a template column in it, and in...
1
by: etantonio | last post by:
Good Morning, I still havent solved my problem with a textbox inside an editItemTemplate of a datalist, in fact now it is filled with the word "CIAOOOOOO" , if a runtime in the form I put a...
2
by: donnet | last post by:
Inside my .aspx file, I have a textbox populated with data from a dataset like this: <asp:TextBox text='<%# DataBinder.Eval(Container.DataItem, "Comment")%>' id="CommentText" runat="server"...
2
by: Antonio D'Ottavio | last post by:
Good Morning, I've a problem with a textfiled inside a datalist, in particular it's value it is not updated with the changes, I mean sNomeCampo has still the value coming from the dB and not that...
2
by: VB Programmer | last post by:
I have a datalist for a shopping cart summary. Each data "row" has a text box where they can enter a quantity. How do I loop thru the entire datalist to figure out the total shopping cart price?
6
by: etam | last post by:
Hi, i have a DataList with a TextBox added by me: <asp:DataList ID="GradeDataList" runat="server" DataKeyField="id" DataSourceID="ProjectsObjectDataSource"> <ItemTemplate> topic: <asp:Label...
0
by: BisMan | last post by:
Thanks Nathan, Nathan Sokalski wrote: -- BisMan
6
by: john | last post by:
I have the following textbox setup with Text & ToolTip Bindings as follows; I'm using Visual Studio 2008 VB: <asp:TextBox ID="txtDay1" runat="server" Text='<%# Eval("Day1") %>'...
1
by: Jim in Arizona | last post by:
On one page I have a datalist where a message is bound to a label. On another page I have the datalist which allows for the insert of new message as well as being able to edit those messages. The...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...
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...

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.