How to get value from a textbox in DataList

Discussion in 'ASP .Net Web Controls' started by Peter Afonin, Apr 7, 2004.

  1. Peter Afonin

    Peter Afonin Guest

    Hello:

    I've never used the DataList before, and I have a problem now:

    In the ItemTemplate I put the LinkButton and a TextBox (not databound, I
    want the user to be able to type in it). Then I try to retrieve the value of
    the textbox by pressing the Linkbutton, like this, pretty much like I do it
    in Datagrid:

    Private Sub MyList_ItemCommand(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.DataListCommandEventArgs) Handles
    MyList.ItemCommand
    Try

    Dim txt As TextBox
    txt = CType(e.Item.FindControl("txtDomain"), TextBox)
    Dim sDomain As String = txt.Text
    Catch ex As Exception
    Response.Write(ex.Message)
    Finally
    End Try
    End Sub

    If I type something in this textbox and press the button, the value is
    always an emty string. Perhaps I just don't understand how the Datalist
    works. What am I doing wrong?

    I would appreciate your help.

    Thank you,


    --
    Peter Afonin
    Peter Afonin, Apr 7, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Antonio D'Ottavio
    Replies:
    2
    Views:
    2,117
    =?Utf-8?B?RWx0b24gVw==?=
    Sep 26, 2005
  2. Peter Afonin

    How to get value from a textbox in DataList

    Peter Afonin, Apr 7, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    1,569
    Peter Afonin
    Apr 7, 2004
  3. Nevyn Twyll
    Replies:
    8
    Views:
    1,832
  4. Replies:
    1
    Views:
    1,773
    Grant Merwitz
    Sep 27, 2005
  5. VB Programmer

    How get value textbox in datalist row?

    VB Programmer, Nov 16, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    8,127
    VB Programmer
    Nov 16, 2005
Loading...

Share This Page