This is a migrated thread and some comments may be shown as answers.

Autocomplete with webmethods

3 Answers 106 Views
AutoCompleteBox
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 16 Jan 2013, 10:00 AM

hi
i've this object:

<telerik:RadAutoCompleteBox ID="RadAutoCompleteBox1" Runat="server"
Delimiter="" DropDownHeight="150px" DropDownWidth="270px" Filter="StartsWith"
InputType="Text" Width="270px" EmptyMessage="Inserisci la tua città"
Skin="Sunset">
<WebServiceSettings Method="Getcity" Path="index.aspx" />
</telerik:RadAutoCompleteBox>

I have three questions to ask:

1)

i've this code into vbnet:

<WebMethod()>
Public Shared Function Getcity(context As Object) As AutoCompleteBoxData
Dim searchString As String = DirectCast(context, Dictionary(Of String, Object))("Text").ToString()
Dim data As DataTable = Getcomuni(searchString)
Dim result As New List(Of AutoCompleteBoxItemData)()
For Each row As DataRow In data.Rows
Dim childNode As New AutoCompleteBoxItemData()
childNode.Text = row("descrizione").ToString()
childNode.Value = row("id").ToString()
result.Add(childNode)
Next
Dim res As New AutoCompleteBoxData()
res.Items = result.ToArray()
Return res
End Function
Private Shared Function Getcomuni(ByVal text As String) As DataTable
Dim adapter As New SqlDataAdapter("SELECT * from Tab_comuni WHERE descrizione LIKE @text + '%'", ConfigurationManager.ConnectionStrings("TrycontactString").ConnectionString)
adapter.SelectCommand.Parameters.AddWithValue("@text", text)
Dim data As New DataTable()
adapter.Fill(data)
Return data
End Function

but when I try to search for a city, nothing shows the dropdown does not appear.

2)
Why having the object raddecoration and thus eliminating any entry in AutoCompleteBox propriotà skin object, you can not see the edges of the round?

3)
How come when the focus is on the AutoCompleteBox, the edges of the object are not shown

Thanks you



3 Answers, 1 is accepted

Sort by
0
Nencho
Telerik team
answered on 21 Jan 2013, 09:59 AM
Hello Fabio,

I can see that you are correctly implementing the population of the RadAutoCompleteBox control via Page Method. I have prepared a sample project for you, base on the provided snippet of code, demonstrating the behavior at my end. Please make sure that the data returned from your database is correct. 

As for your second question, the styles in the  RadFormDecorator would apply on a native input element, which is not the case with RadAutoCompleteBox.

In RadAutoCompleteBox, the container is made to look like an input, but it's not. Therefore, the styles defined with the decorator, are not correctly applied on the RadAutoCompleteBox. I can suggest that you use custom css style, which would make the corners of the control rounded. I have implemented the above suggestions in the provided sample.

Please give it a try and let us know if it works properly at your end.

Regards,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Fabio Cirillo
Top achievements
Rank 1
answered on 21 Jan 2013, 02:54 PM
Hello Nencho,

i used your example code for the test. But the autocompletebox dont function.
this is code behind that i use to load the record into radcombo

Dim adapter As New SqlDataAdapter("SELECT * from Tab_categorie WHERE descrizione LIKE @text + '%'", ConfigurationManager.ConnectionStrings("TrycontactString").ConnectionString)
adapter.SelectCommand.Parameters.AddWithValue("@text", text)
 
Dim data As New DataTable()
adapter.Fill(data)

how can to use this code in your axample? 

dont see the corners rounded.
i seen that he has written into code aspx a style:
.RadAutoCompleteBox .racTokenList {
    border-radius: 5px;
}

this is the css code for to get the corners rounded?
0
Nencho
Telerik team
answered on 24 Jan 2013, 11:11 AM
Hello Fabio,

With the usage of the provided css style, the corners of the RadAutoCompleteBox control should get rounded. I have recorded a video, demonstrating the behavior at my end. Could you specify which browser you use?

In addition, I noticed that you mentioned that you use the provided snippet if code to populate the combobox. Could you specify which control you use? Lastly, regardless the approach you use to populate the control, the style should apply and make the corners rounded.

Greetings,
Nencho
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
AutoCompleteBox
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Nencho
Telerik team
Fabio Cirillo
Top achievements
Rank 1
Share this question
or