header combobox

2 posts, 0 answers
  1. Fabio Cirillo
    Fabio Cirillo avatar
    180 posts
    Member since:
    Jan 2010

    Posted 02 Jul 2013 Link to this post

    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
  2. Hristo Valyavicharski
    Admin
    Hristo Valyavicharski avatar
    975 posts

    Posted 05 Jul 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top