Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Extracting TextBox.Text from within a Datalist

Reply
Thread Tools

Extracting TextBox.Text from within a Datalist

 
 
BisMan
Guest
Posts: n/a
 
      01-18-2008

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
------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
Nathan Sokalski
Guest
Posts: n/a
 
      01-19-2008
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
http://www.velocityreviews.com/forums/(E-Mail Removed)
http://www.nathansokalski.com/

"BisMan" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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
> ------------------------------------------------------------------------
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting TextBox.Text from within a Datalist BisMan ASP .Net 0 01-19-2008 06:07 PM
Problem with DataList within DataList Will ASP .Net Web Controls 4 10-18-2007 03:19 AM
Extracting and replacing url within href tag Adnan Siddiqi Javascript 14 05-29-2006 02:18 PM
Setting up a datalist control - Item_DataBound for a datalist in a datalist Nevyn Twyll ASP .Net 8 09-09-2004 10:13 PM
Datalist in Datalist How? Gönen EREN ASP .Net 0 08-22-2003 02:41 PM



Advertisments