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

header combobox

1 Answer 55 Views
ComboBox
This is a migrated thread and some comments may be shown as answers.
Fabio Cirillo
Top achievements
Rank 1
Fabio Cirillo asked on 02 Jul 2013, 07:44 AM
you can create a combobox columns with header but load the data with a webservice?

I load the record in combobox with this code:


<WebMethod()> _
Public Function GetLuogoNome(ByVal context As RadComboBoxContext) As RadComboBoxData
    Dim data As DataTable = GetCittadinanza(context.Text)
 
    Dim comboData As New RadComboBoxData()
    Dim itemOffset As Integer = context.NumberOfItems
    Dim endOffset As Integer = Math.Min(itemOffset + ItemsTipoGruppoPerRequest, data.Rows.Count)
    comboData.EndOfItems = endOffset = data.Rows.Count
 
    Dim result As New List(Of RadComboBoxItemData)(endOffset - itemOffset)
 
    For i As Integer = itemOffset To endOffset - 1
        Dim itemData As New RadComboBoxItemData()
        itemData.Text = data.Rows(i)("descrizione").ToString()
        itemData.Value = data.Rows(i)("idrecord").ToString()
        result.Add(itemData)
    Next
    REM ottengo il messaggio dei record selezionati
    comboData.Message = GetStatusMessage(endOffset, data.Rows.Count)
    comboData.Items = result.ToArray()
    Return comboData
End Function
Private Function GetLuogo(ByVal text As String) As DataTable
    REM SELECT * FROM Tab_categorie WHERE CONTAINS(descrizione, @text)
    REM per indici full text
    Dim conString = ConfigurationManager.ConnectionStrings("Receptionstring")
    Dim strConnString As String = conString.ConnectionString
    Using scope As New Transactions.TransactionScope
        Using db As New SqlConnection(strConnString)
            db.Open()
            Using sqlcmd As New SqlCommand("get_cittadinanza", db)
                sqlcmd.CommandType = CommandType.StoredProcedure
                sqlcmd.Parameters.AddWithValue("@textsearch", SqlDbType.VarChar).Value = text
                Dim adapter As New SqlDataAdapter(sqlcmd)
                Dim data As New DataTable()
                adapter.Fill(data)
                Return data
            End Using
        End Using
        scope.Complete()
    End Using

1 Answer, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 05 Jul 2013, 08:38 AM
Hi Fabio,

What exactly is the issue that you have experienced? Header Templates can be added from the markup or from the code-behind, like demonstrated in this documentation article. Note that  Item Server Templates are not supported when data is populating from web service. For this scenario you will have to use Client Templates. This online demo shows how to use them.

Regards,
Hristo Valyavicharski
Telerik
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 the blog feed now.
Tags
ComboBox
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Share this question
or