Put Data in DropDown

Discussion in 'ASP .Net Web Controls' started by ruca, Feb 6, 2004.

  1. ruca

    ruca Guest

    I have this in code:
    I'm reading data from a .TXT file
    Sub ProcessUser(txtLine)
    On Error Resume Next

    Dim p1, pos as Integer
    Dim Cd, LineAux, NomeFunc, Pass, strLabel as String
    Dim row as DataRow

    p1 = instr(txtLine,",")
    if p1>0 then
    LineAux = mid(txtLine,p1+1)
    pos = instr(LineAux,",")
    NomeFunc = left(LineAux,pos-1)
    Pass = mid(LineAux, pos+1)
    'Response.Write CdFunc & "-" & NomeFunc & "-" & Pass
    strLabel="CdRcs = "& "'" & Cd & "'"

    row = table.NewRow()
    row("CdRcs") = Cd
    row("NmAbreviado") = NomeFunc
    row("Key") = Pass


    end if
    End Sub

    Function ler_users() As DataTable
    On Error Resume Next
    Dim objFicheiro, LerUser as Object

    objFicheiro = CreateObject("Scripting.fileSystemObject")
    LerUser = objFicheiro_OpenTextFile(Server.MapPath("func.txt"))

    While not LerUser.AtEndOfStream
    ProcessUser (LerUser.ReadLine)
    End While

    LerUser = nothing

    return table
    End Function

    I want to put in a dropdownlist the name of people but I can't. For that I
    have this:

    asp:DropDownList id="cxFunc" runat="server" DataSource="<% # ler_users() %>"
    DataTextField="NmAbreviado" DataMember="CdRcs" DataValueField="CdRcs"

    Can you help me??? How can I put data in the dropdownlist????????????????

    Thanks (if you help me)
    Hope this helps (if I help you)

    ruca, Feb 6, 2004
    1. Advertisements

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.

Share This Page