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

Problem with click on item record of a combobox

3 Answers 27 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 06 Feb 2013, 02:49 PM
guys,

when i start the page web and click on combobox after the load the record into combo, if i click on item record i've this error:

"Unable to get the value of the 'get_Count' null object or undefined"

but the same procedure on another combobox does not generate this error.

the combobox that this error is this:
<telerik:RadComboBox ID="Categoria" Runat="server" DropDownWidth="350px" Height="175px"
EmptyMessage="Seleziona la tua categoria" EnableLoadOnDemand="True"
EnableVirtualScrolling="True" LoadingMessage="Caricamento..."
ShowMoreResultsBox="True" Filter="StartsWith"
MaxHeight="175px" Skin="Sunset" Width="350px" EnableItemCaching="True"
Font-Italic="True" Font-Names="Verdana" AutoPostBack="True" >
<WebServiceSettings Path="WebService.asmx" Method="GetCategoryNames" />
</telerik:RadComboBox>

this is code webservice:

Imports System.Web.Services
Imports System.Collections
Imports System.Collections.Generic
Imports System.Web.Script.Services
Imports System
Imports System.Data
Imports System.Web
Imports System.Data.SqlClient
Imports Telerik.Web.UI
<WebService([Namespace]:="http://tempuri.org/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<ScriptService()> _
Public Class TryWebService
    Private Const ItemsCategoryPerRequest As Integer = 10
    Private Const ItemsCityPerRequest As Integer = 10
    <WebMethod()> _
    Public Function GetCategoryNames(ByVal context As RadComboBoxContext) As RadComboBoxData
        Dim data As DataTable = Getcategoria(context.Text)
 
        Dim comboData As New RadComboBoxData()
        Dim itemOffset As Integer = context.NumberOfItems
        Dim endOffset As Integer = Math.Min(itemOffset + ItemsCategoryPerRequest, 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)("id").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 GetStatusMessage(ByVal offset As Integer, ByVal total As Integer) As String
        If total <= 0 Then
            Return "Nessun dato"
        End If
 
        Return [String].Format("Record <b>1</b>-<b>{0}</b> di <b>{1}</b>", offset, total)
    End Function
    Private Function Getcategoria(ByVal text As String) As DataTable
        REM SELECT * FROM Tab_categorie WHERE CONTAINS(descrizione, @text)
        REM per indici full text
        Dim conString = ConfigurationManager.ConnectionStrings("TrycontactString")
        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("select_category", db)
                    sqlcmd.CommandType = CommandType.StoredProcedure
                    sqlcmd.Parameters.AddWithValue("@desc", 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
    End Function


3 Answers, 1 is accepted

Sort by
0
Hristo Valyavicharski
Telerik team
answered on 11 Feb 2013, 12:45 PM
Hi Fabio,

Could you specify what is the version of your browser and the version of Telerik assemblies that you are using? Is the RadComboBox placed inside RadGrid or other control? I have tested your code under IE9 and it seems that the issue doesn't exists.

All the best,
Hristo Valyavicharski
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 11 Feb 2013, 03:43 PM
the assembly versione is 201.3.1205.40 and the version browser is IE9 and google chrome last version
0
Hristo Valyavicharski
Telerik team
answered on 12 Feb 2013, 11:32 AM
Hi Fabio,

Your code seems to work correctly on those two browsers, please see the video. For your reference here is the code of the stored procedure:
/****** Object:  StoredProcedure [dbo].[select_category]    Script Date: 2/12/2013 9:49:52 AM ******/
SET ANSI_NULLS ON
GO
 
SET QUOTED_IDENTIFIER ON
GO
 
CREATE PROCEDURE [dbo].[select_category]
@desc nvarchar(50)
 
AS
 
SELECT top 100 Id, Descrizione
FROM Tab_comuni
WHERE Descrizione LIKE @desc + '%'
It would be very helpful if you can open new support ticket and attach sample project demonstrating the faced issue.

Greetings,
Hristo Valyavicharski
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
ComboBox
Asked by
Fabio Cirillo
Top achievements
Rank 1
Answers by
Hristo Valyavicharski
Telerik team
Fabio Cirillo
Top achievements
Rank 1
Share this question
or