I pretty much duplicated the web service and example from the telerik example site but my web serive always returns the following error and I am wondering If I am missing some code somewhere.
Error
Object reference not set to an instance of an object.
The other question I have is once it returns correctly how do I get at the value.
Error
Object reference not set to an instance of an object.
The other question I have is once it returns correctly how do I get at the value.
<tr> <td>Personnel Name: </td> <td><telerik:RadSearchBox ID="rdSearch" runat="server" EmptyMessage="Type Last Name First Name" WebServiceSettings-Path="~/AutoComplete.asmx" WebServiceSettings-Method="GetNames" EnableAutoComplete="true" MinFilterLength="2" MaxResultCount="20" ShowSearchButton="false" OnSearch="RadSearchBox3_Search"></telerik:RadSearchBox></td> </tr>public SearchBoxItemData[] GetNames(SearchBoxContext context) { DataTable data = GetData(context.Text); List<SearchBoxItemData> result = new List<SearchBoxItemData>(); for (int i = 0; i < data.Rows.Count; i++) { SearchBoxItemData itemData = new SearchBoxItemData(); itemData.Text = data.Rows[i]["strFullname"].ToString(); itemData.Value = data.Rows[i]["intPersonnelId"].ToString(); result.Add(itemData); } return result.ToArray(); } private static DataTable GetData(string filterString) { SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["ProdConnection"].ConnectionString); SqlCommand command = new SqlCommand("SELECT intPersonnelId, strFullname FROM MnNgPersonnel.dbo.tblMNNatPersonnel WHERE strFullname LIKE ' + @filterString + '%' ORDER BY strFullname"); command.Parameters.AddWithValue("@filterString", filterString); command.Connection = connection; SqlDataAdapter adapter = new SqlDataAdapter(command); DataTable data = new DataTable(); adapter.Fill(data); return data; }