locked
Enable text input in dropdownlist VB.net 2012 RRS feed

  • Question

  • Hi,

    I have a dropdownlist that I bind on a table. Is it possible to also add value to this dropdownlist using user input? Basically like a combobox but in asp.net...

    Thanks,


    kztn

    Tuesday, July 16, 2013 9:29 AM

Answers

  • Hi kztn,

    You can input a textbox control and a button control, and implent the function in the event botton_click. For example:(suppose your table is datatable)

            Dim row As DataRow = dt.NewRow
            If TextBox1.Text <> "" Then
                Dim str As String = Me.TextBox1.Text.ToString.Trim()
                row("listname") = str 'suppose the column name is listname
                dt.Rows.Add(row)
            End If

    And then you can refresh your binding code.

    Hope this helps.

    thanks,

    Minna

    • Proposed as answer by Minna Hu Friday, July 19, 2013 8:06 AM
    • Marked as answer by Youen Zen Friday, July 26, 2013 7:48 AM
    Thursday, July 18, 2013 5:57 AM