Hello
I am using a webservice with autocomplete.
it is getting all customer from my database. but the issue is that i need to passt hru a selected value from a radiobutton list to just get the customer form the choosen area
webservice code
Public Function GetCompletionList(ByVal prefixText As String, ByVal count As Integer) As String()
count = 10
Dim sql As String = "SELECT distinct kundnr FROM comp Where kundnr like '" & prefixText & "%'"
Dim MyConnString As String = "server=127.0.0.1;" _
& "uid=root;" _
& "" _
& "database=fambo;"
Dim conn As New MySqlConnection(MyConnString)
conn.Open()
Dim command As MySqlCommand = conn.CreateCommand()
command.Parameters.AddWithValue("prefixText", prefixText)
command.CommandText = sql
Dim da As New MySqlDataAdapter(sql, conn)
Dim dt As New DataTable()
da.Fill(dt)
Dim items As String() = New String(dt.Rows.Count - 1) {}
Dim i As Integer = 0
For Each dr As DataRow In dt.Rows
items.SetValue(dr("kundnr").ToString(), i)
i += 1
Next
Return items
End Function
asp code
<form id="form1" runat="server">
<div>
<asp1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="AutoComplete.asmx" />
</Services>
</asp1:ToolkitScriptManager>
<asp1:TabContainer ID="TabContainer1" runat="server" Height="180px" Width="550px"
ActiveTabIndex="0">
<asp1:TabPanel runat="server" HeaderText="Kund register" ID="TabPanel1">
<ContentTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table class="style1">
<tr>
<td class="style3">
</td>
<td class="style4">
</td>
<td>
<asp:RadioButtonList ID="radio1" runat="server">
<asp:ListItem id="Hkarngen" runat="server" checked="true" Text="Hauptvgen" Value="hauptvagen" />
<asp:ListItem id="Iskarnevalen" runat="server" Value="Iskarnevalen" />
</asp:RadioButtonList>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td class="style4">
<asp:Label ID="Label1" runat="server" Text="Kund"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtkund" runat="server" Width="175px" autocomplete="off"></asp:TextBox>
<asp:Label ID="lblinvalid" runat="server"></asp:Label>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td class="style4">
<asp:Label ID="Label2" runat="server" Text="Anvndare"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtforetag" runat="server" Width="175px" Enabled="False">Ej aktiv</asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td class="style4">
<asp:Label ID="Label3" runat="server" Text="Brick nummer"></asp:Label>
</td>
<td>
<asp:TextBox ID="txtmedia" runat="server" Width="175px"></asp:TextBox>
</td>
</tr>
<tr>
<td class="style3">
</td>
<td class="style4">
</td>
<td>
<asp:Button ID="btnsokkund" runat="server" Text="Sk kund" />
</td>
</tr>
</table>
<asp1:AutoCompleteExtender runat="server" ID="autoComplete1" TargetControlID="txtkund"
ServicePath="AutoComplete.asmx" ServiceMethod="GetCompletionList" MinimumPrefixLength="1"
CompletionInterval="100" EnableCaching="True" CompletionSetCount="12" FirstRowSelected="True" />
</ContentTemplate>
</asp:UpdatePanel>
</ContentTemplate>