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:
this is code webservice:
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