Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. AutoComplete

AutoComplete

Scheduled Pinned Locked Moved ASP.NET
databasesysadmintoolshelpquestion
8 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    kirthikirthi
    wrote on last edited by
    #1

    Hi all Iam working on autocomplete textbox. in my code only 1 tetbox is working fine. but i want use 2 textbox as autocomplete (from DB) when i write code for 2 textboxs only 1 textbox is working other is not displaying the data values can any 1 tell me what is error on my code iam using 1.1 ver. MYCODE -------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) End Sub - AjaxPro.AjaxMethod() _ Public Function GetSearchData(ByVal s As String) As DataTable Dim conn As New SqlConnection("server=;uid=;pwd=;database=") Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE @Name + '%'", conn) cmd.Parameters.Add("@Name", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "IDs") Return ds.Tables("IDs") End Function - AjaxPro.AjaxMethod() _ Public Function GetSearchData1(ByVal s As String) As DataTable Dim conn1 As New SqlConnection("server=;uid=;pwd=;database=") Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE @NameID + '%'", conn1) cmd1.Parameters.Add("@NameID", s) Dim da1 As New SqlDataAdapter Dim ds1 As New DataSet da1.SelectCommand = cmd1 da1.Fill(ds1, "IDs") Return ds1.Tables("IDs") End Function --------------------- THX Keerthi

    M 1 Reply Last reply
    0
    • K kirthikirthi

      Hi all Iam working on autocomplete textbox. in my code only 1 tetbox is working fine. but i want use 2 textbox as autocomplete (from DB) when i write code for 2 textboxs only 1 textbox is working other is not displaying the data values can any 1 tell me what is error on my code iam using 1.1 ver. MYCODE -------------------- Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) End Sub - AjaxPro.AjaxMethod() _ Public Function GetSearchData(ByVal s As String) As DataTable Dim conn As New SqlConnection("server=;uid=;pwd=;database=") Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE @Name + '%'", conn) cmd.Parameters.Add("@Name", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "IDs") Return ds.Tables("IDs") End Function - AjaxPro.AjaxMethod() _ Public Function GetSearchData1(ByVal s As String) As DataTable Dim conn1 As New SqlConnection("server=;uid=;pwd=;database=") Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE @NameID + '%'", conn1) cmd1.Parameters.Add("@NameID", s) Dim da1 As New SqlDataAdapter Dim ds1 As New DataSet da1.SelectCommand = cmd1 da1.Fill(ds1, "IDs") Return ds1.Tables("IDs") End Function --------------------- THX Keerthi

      M Offline
      M Offline
      Michael Sync
      wrote on last edited by
      #2

      I think I've seen this thread earlier. Are you sure the function works fine?? Because i think that the SQL statement looks strange to me..

      kirthikirthi wrote:

      Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE @Name + '%'", conn)

      Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE '@Name%'", conn)

      kirthikirthi wrote:

      Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE @NameID + '%'", conn1)

      Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE '@NameID%'", conn1)

      Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

      K 1 Reply Last reply
      0
      • M Michael Sync

        I think I've seen this thread earlier. Are you sure the function works fine?? Because i think that the SQL statement looks strange to me..

        kirthikirthi wrote:

        Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE @Name + '%'", conn)

        Dim cmd As New SqlCommand("SELECT Name FROM IDs WHERE Name LIKE '@Name%'", conn)

        kirthikirthi wrote:

        Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE @NameID + '%'", conn1)

        Dim cmd1 As New SqlCommand("SELECT NameID FROM IDs WHERE NameID LIKE '@NameID%'", conn1)

        Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

        K Offline
        K Offline
        kirthikirthi
        wrote on last edited by
        #3

        THX for reply Yes (which i paste)it is working fine but only for 1 Textbox I want it for 2 textboxes. i used this code from http://mind.com.my/forums/thread/970.aspx[^] THX Keerthi

        I M 2 Replies Last reply
        0
        • K kirthikirthi

          THX for reply Yes (which i paste)it is working fine but only for 1 Textbox I want it for 2 textboxes. i used this code from http://mind.com.my/forums/thread/970.aspx[^] THX Keerthi

          I Offline
          I Offline
          Imran Khan Pathan
          wrote on last edited by
          #4

          can you tell me what is the the error ?

          please don't forget to vote on the post that helped you.

          1 Reply Last reply
          0
          • K kirthikirthi

            THX for reply Yes (which i paste)it is working fine but only for 1 Textbox I want it for 2 textboxes. i used this code from http://mind.com.my/forums/thread/970.aspx[^] THX Keerthi

            M Offline
            M Offline
            Michael Sync
            wrote on last edited by
            #5

            kirthikirthi wrote:

            acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData)

            This code is working fine?? I don't have VS 2003 in front of me.. I will tell you some possibilities.. Try with only one textbox 1. You said that the textbox "acSearch" and "GetSearchData" work fine. Why don't you try with "acSearch" and "GetSearchData1" acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) Is it working? 2. What about "Autocomplete1" and "GetSearchData"? Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) Is it working? 3. What about "Autocomplete1" and "GetSearchData1"? Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) Is it also working?? If those three possibilities are working fine then try with two textboxes.. 1. acSearch + GetSearchData Autocomplete1 + GetSearchData 2. acSearch + GetSearchData1 Autocomplete1 + GetSearchData1 3. (finally) acSearch + GetSearchData Autocomplete1 + GetSearchData1 And let us know the steps the code is not working. One more suggestion. If you are testing those steps, I suggest you to use Firefox with Firebug. And check whether you got any error in Firebug console or not..

            Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

            K 1 Reply Last reply
            0
            • M Michael Sync

              kirthikirthi wrote:

              acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData)

              This code is working fine?? I don't have VS 2003 in front of me.. I will tell you some possibilities.. Try with only one textbox 1. You said that the textbox "acSearch" and "GetSearchData" work fine. Why don't you try with "acSearch" and "GetSearchData1" acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) Is it working? 2. What about "Autocomplete1" and "GetSearchData"? Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) Is it working? 3. What about "Autocomplete1" and "GetSearchData1"? Autocomplete1.PageType = Me.[GetType]().BaseType Autocomplete1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData1) Is it also working?? If those three possibilities are working fine then try with two textboxes.. 1. acSearch + GetSearchData Autocomplete1 + GetSearchData 2. acSearch + GetSearchData1 Autocomplete1 + GetSearchData1 3. (finally) acSearch + GetSearchData Autocomplete1 + GetSearchData1 And let us know the steps the code is not working. One more suggestion. If you are testing those steps, I suggest you to use Firefox with Firebug. And check whether you got any error in Firebug console or not..

              Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net) "Please vote to let me (and others) know if this answer helped you or not. A 5 vote tells people that your question has been answered successfully and that I've pitched it at just the right level. Thanks."

              K Offline
              K Offline
              kirthikirthi
              wrote on last edited by
              #6

              Hi I tried your code The code working only for 1 textbox I mean On Page Load 2 Textboxs calling not woring only 1 textbox calling is working can u plz tell me a solution for my error Or Can u plz tell me is there any other way to do this in (2 or more DB autocomplete textboxes) 1.1 ver or VS 2005 ver Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) AUTOCOMPLETE1.PageType = Me.[GetType]().BaseType AUTOCOMPLETE1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf GetSearchData00) 'Ca() End Sub _ Function GetSearchData(ByVal s As String) As DataTable Try Dim conn As New SqlConnection(Global.constrSQ) Dim cmd As New SqlCommand("SELECT MusicDirector FROM MusicDirector WHERE MusicDirector LIKE @MusicDirector + '%' ", conn) cmd.Parameters.Add("@MusicDirector", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "MusicDirector") Return ds.Tables("MusicDirector") Catch ex As Exception End Try End Function _ Function GetSearchData00(ByVal s0 As String) As DataTable Dim conn As New SqlConnection(Global.constrSQ) Dim cmd As New SqlCommand("SELECT SingerName FROM Singer WHERE SingerName LIKE @SingerName + '%'", conn) cmd.Parameters.Add("@SingerName", s0) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd '============ erragaddalopala da.Fill(ds, "Singer") Return ds.Tables("Singer") End Function Keethi

              M 1 Reply Last reply
              0
              • K kirthikirthi

                Hi I tried your code The code working only for 1 textbox I mean On Page Load 2 Textboxs calling not woring only 1 textbox calling is working can u plz tell me a solution for my error Or Can u plz tell me is there any other way to do this in (2 or more DB autocomplete textboxes) 1.1 ver or VS 2005 ver Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load AjaxPro.Utility.RegisterTypeForAjax(GetType(WebForm1)) AUTOCOMPLETE1.PageType = Me.[GetType]().BaseType AUTOCOMPLETE1.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf Me.GetSearchData) acSearch.PageType = Me.[GetType]().BaseType acSearch.OnAutoComplete = New Autocomplete.AutoCompleteHandler(AddressOf GetSearchData00) 'Ca() End Sub _ Function GetSearchData(ByVal s As String) As DataTable Try Dim conn As New SqlConnection(Global.constrSQ) Dim cmd As New SqlCommand("SELECT MusicDirector FROM MusicDirector WHERE MusicDirector LIKE @MusicDirector + '%' ", conn) cmd.Parameters.Add("@MusicDirector", s) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd da.Fill(ds, "MusicDirector") Return ds.Tables("MusicDirector") Catch ex As Exception End Try End Function _ Function GetSearchData00(ByVal s0 As String) As DataTable Dim conn As New SqlConnection(Global.constrSQ) Dim cmd As New SqlCommand("SELECT SingerName FROM Singer WHERE SingerName LIKE @SingerName + '%'", conn) cmd.Parameters.Add("@SingerName", s0) Dim da As New SqlDataAdapter Dim ds As New DataSet da.SelectCommand = cmd '============ erragaddalopala da.Fill(ds, "Singer") Return ds.Tables("Singer") End Function Keethi

                M Offline
                M Offline
                Michael Sync
                wrote on last edited by
                #7

                Have you tried my 6 steps that I mentioned in previous post? Which steps do you get the error?? If you are using VS2005, you can check this sample "ASP.NET Ajax Toolkit - Autocomplete" http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

                Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

                K 1 Reply Last reply
                0
                • M Michael Sync

                  Have you tried my 6 steps that I mentioned in previous post? Which steps do you get the error?? If you are using VS2005, you can check this sample "ASP.NET Ajax Toolkit - Autocomplete" http://www.asp.net/AJAX/AjaxControlToolkit/Samples/AutoComplete/AutoComplete.aspx

                  Thanks and Regards, Michael Sync ( Blog: http://michaelsync.net)

                  K Offline
                  K Offline
                  kirthikirthi
                  wrote on last edited by
                  #8

                  Hi yes i tried with your 6 steps :( still it is not running and not giving error also is it not posible with ver 1.1 Than Q Keerthi

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups