Results 1 to 4 of 4

Thread: Using AutoComplete ASP.net (VB)

  1. #1

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    Using AutoComplete ASP.net (VB)

    hi
    i want to use autocomplete in asp.net using vb

    i have to select budget head
    on selection of budget head the budget code and the budgettypecode should be displayed as per the selected item.
    following is what i have done :
    html code:
    Code:
     <td width="20%" align="left">
                                    <span>
                                        <asp:TextBox ID="txtItemName" runat="server" MaxLength="50" Width="100px"></asp:TextBox>
                                    </span>
                                    <asp:AutoCompleteExtender ID="AutoCompleteExtender1" runat="server" TargetControlID="txtItemName"
                                        MinimumPrefixLength="1" EnableCaching="true" CompletionSetCount="1" CompletionInterval="1000"
                                        ServiceMethod="GetDetails">
                                    </asp:AutoCompleteExtender>
                                </td>
    vb code
    Code:
    <System.Web.Script.Services.ScriptMethod()> _
    <System.Web.Services.WebMethod()> _
        Public Shared Function GetDetails(prefixText As String) As DataSet
            Dim constr As String = ConfigurationManager.ConnectionStrings("SqlConnectionString").ToString()
            Dim con As New SqlConnection(constr)
    
            Dim mC As String = "select ItemName, ItemCode, BudgetTypeCode from ItemMaster where ItemName like @City+'%'"
            Dim da_T As New SqlDataAdapter(mC, con)
            Dim ds_T As New DataSet
            da_T.Fill(ds_T, "ItemMaster")
            
            Return ds_T
        End Function
    if i use a list item instead of dataset then it is working perfect but only for txtitemname.

    but as the txtitemname is selected the txtitemcode and the txtbudgettypecode too should change from the values in the datatable.

    a lot confused as to how to make this work

    pls guide.
    thanks in advance.
    The only time you run out of chances is when you stop taking them.
    The mind is like a parachute.
    It doesn’t work unless it’s open.

  2. #2
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,711

    Re: Using AutoComplete ASP.net (VB)

    Moderator Action: Moved to ASP.Net forum.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  3. #3

    Thread Starter
    Hyperactive Member kuldevbhasin's Avatar
    Join Date
    Mar 2008
    Location
    Mumbai, India
    Posts
    488

    Re: Using AutoComplete ASP.net (VB)

    thanks for moving it to the right forum ...
    The only time you run out of chances is when you stop taking them.
    The mind is like a parachute.
    It doesn’t work unless it’s open.

  4. #4
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    Re: Using AutoComplete ASP.net (VB)

    I don't know a lot about auto extenders but i would think this is your problem

    Code:
    TargetControlID="txtItemName"
    It is targeting a specific textbox, you probably want to look-up if an auto extender can target multiple textboxes

    ....

    I just did a very small amount of reading and the suggested method seems to be to use the - OnClientItemSelected event of the autocompleter to trigger a second call to a method which fills in your second textbox.
    Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width