Help with using a Text input control as a datasource


I need to use a control that I can enter data in multiple lines and at the same time can connect to a datasource, a regular textbox is perfect for entering data but it doesn't have a datsource property, Do you have an alternate solution?

I looked at the DropdownList but I am unable to enter text, can't seem to find any other controls in my toolbox.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

1)textbox can be connected to a data source..use smart tag in design mode
2) you can user web user controls or a web part
3) see atcched this will get you going
public sub button1_onclick(sender as s, eventargs as e) handles
' ------------------
' ----------------


Dim SQLConn1 As SqlConnection = New SqlConnection()
        Dim cmd1 As SqlCommand
        Dim SQLStr1 As String
        Dim Err1 As String

        Dim session_id As String
        Dim rep_name As String
        Dim client_status As String
        Dim Rep_Response As String
        Dim client_response As String
        Dim CLIENT_FDBK_GD_JB As String
        Dim CLIENT_FDBK_IMPROVE As String

session_id = textbox1.text

        session_id = Session("Session_ID")
        rep_name = Session("Call_Center_Rep")
        client_status = ""
        Rep_Response = Session("Rep_Response")
        client_response = Session("client_Response")
        CLIENT_FDBK_GD_JB = TextBox2.Text
        CLIENT_FDBK_IMPROVE = TextBox3.Text

        SQLConn1.ConnectionString = "Network Library=DBMSSOCN; Data Source=xx.xx.xx.xx; Initial Catalog=dasdsf; Trusted_Connection=true;User ID=; Password="

        SQLStr1 = ("INSERT INTO Live_Chat_Client_Feedback (SESSION_ID, REP_NAME, CLIENT_STATUS," & _

        cmd1 = New SqlCommand(SQLStr1, SQLConn1)
        cmd1.Parameters.AddWithValue("@SESSION_ID", session_id)
        cmd1.Parameters.AddWithValue("@REP_NAME", rep_name)
        cmd1.Parameters.AddWithValue("@CLIENT_STATUS", client_status)
        cmd1.Parameters.AddWithValue("@REP_RESPONSE", Rep_Response)
        cmd1.Parameters.AddWithValue("@CLIENT_RESPONSE", client_response)
        cmd1.Parameters.AddWithValue("@CLIENT_FDBK_GD_JB", CLIENT_FDBK_GD_JB)
        cmd1.Parameters.AddWithValue("@CLIENT_FDBK_IMPROVE", CLIENT_FDBK_IMPROVE)

            Err1 = cmd1.ExecuteNonQuery()
        End Try

end sub


<asp:button id="button1" onclick="button1_onlick" runat=server" />

Open in new window

vcharlesAuthor Commented:

I am using xml, below is an example of my code below, i would like C1countryUser/Origin to be textboxes
to allow users to enter data and save changes.

' create a new XML Document object for each XML file
        Dim xdDonor As New Xml.XmlDocument
        Dim xdLink As New Xml.XmlDocument
        Dim xdReceiver As New Xml.XmlDocument

        ' load all of the XML documents

        ' Extract the ReceiverID and DonorID values from the current node
        Dim ReceiverID As String
        Dim DonorID As String
        Dim Link_ID As String
        '   Dim LinkID2 As String
        Dim DonorID2 As String
        Dim Name As String
        Dim ReceiverID2 As String

        dtReceiver = New DataTable
        dtReceiver.Columns.Add("ReceiverID", GetType(String))
        dtReceiver.Columns.Add("Name", GetType(String))
        dtDonor = New DataTable
        dtDonor.Columns.Add("DonorID", GetType(String))
        dtDonor.Columns.Add("Name", GetType(String))

        Session("CurrentIndex") = 0
        Session("dtDonor") = dtDonor
        Session("dtReceiver") = dtReceiver

        ' This outer loop will iterate over the Link file where the ReceiverID node is equal to our search criteria
        For Each xnLink As Xml.XmlNode In xdLink.SelectNodes("/Root/LinkA[manufacturer_ID='" & C1Manufacturer.SelectedItem.Value & "']")
            Link_ID = xnLink.SelectSingleNode("LinkAID").InnerText
            ReceiverID = xnLink.SelectSingleNode("CountryUser_ID").InnerText
            DonorID = xnLink.SelectSingleNode("CountryOrigin_ID").InnerText

            ' Perform another similar search based upon the Donor XML file
            For Each xnDonor As Xml.XmlNode In xdDonor.SelectNodes("/Root/CountryOriginTable[CountryOrigin_ID='" & DonorID & "']")
                DonorID2 = xnDonor.SelectSingleNode("CountryOrigin_ID").InnerText
                Name = xnDonor.SelectSingleNode("CountryOrigin").InnerText
                dtDonor.Rows.Add({DonorID2, Name})

            ' Perform yet another practically identical search on the Receiver XML file
            For Each xnReceiver As Xml.XmlNode In xdReceiver.SelectNodes("/Root/CountryUserTable[CountryUser_ID='" & ReceiverID & "']")
                '' Extract the ReceiverID and Name values from the current node
                ReceiverID2 = xnReceiver.SelectSingleNode("CountryUser_ID").InnerText
                Name = xnReceiver.SelectSingleNode("CountryUser").InnerText
                dtReceiver.Rows.Add({ReceiverID2, Name})
            ' Extract the Link_ID avalues from the current node
            '  dtLinkID = New DataTable
            ' dtLinkID.Columns.Add("Link_ID", GetType(String))
            'LinkID2 = xnLink.SelectSingleNode("LinkAID").InnerText

        C1CountryOrigin.DataSource = dtDonor
        C1CountryOrigin.DataTextField = "Name"
        C1CountryOrigin.DataValueField = "DonorID"

        C1CountryUser.DataSource = dtReceiver
        C1CountryUser.DataTextField = "Name"
        C1CountryUser.DataValueField = "ReceiverID"
As suggested in below question, you can do the reverse. Let the user type a value in a textbox and then

dtDonor.Rows(rowindex).Item("columname") = textbox1.text

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
vcharlesAuthor Commented:
Thank You.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.