Hi,
I am trying to bind a simple RadListView using a WebService (ASMX).
Here is my code:
Here is my TestWS.asmx (Json() simply convert the object to a Json string using the JavascriptSerializer):
When I run the page, I can see in the Chrome debugger that GetData is correctly called and return this:
{"d":"{\"Data\":[{\"Text\":\"Item1\"},{\"Text\":\"Item2\"}],\"Count\":2}"}
But I can't understand why the ListView is still empty and don't show the data.
What did I miss there?
Jocelyn
I am trying to bind a simple RadListView using a WebService (ASMX).
Here is my code:
<
telerik:RadListView
runat
=
"server"
ID
=
"lvTest"
>
<
ClientSettings
>
<
DataBinding
>
<
ItemTemplate
>
<
div
class
=
"item"
>
#= Text#
</
div
>
</
ItemTemplate
>
<
EmptyDataTemplate
>
<
div
>No items</
div
>
</
EmptyDataTemplate
>
<
DataService
Location
=
"~/Code/GenericHandlers/TestWS.asmx"
DataPropertyName
=
"Data"
CountPropertyName
=
"Count"
DataPath
=
"GetData"
SortParameterType
=
"Linq"
FilterParameterType
=
"Linq"
/>
</
DataBinding
>
</
ClientSettings
>
</
telerik:RadListView
>
Here is my TestWS.asmx (Json() simply convert the object to a Json string using the JavascriptSerializer):
<
System.Web.Script.Services.ScriptService
()> _
<
System.Web.Services.WebService
(
Namespace:
=
"http://tempuri.org/"
)> _
<
System.Web.Services.WebServiceBinding
(
ConformsTo:
=
WsiProfiles
.BasicProfile1_1)> _
<
ToolboxItem
(False)> _
Public Class TestWS
Inherits System.Web.Services.WebService
<
WebMethod
()> _
Public Function GetData() As String
Return Json(New With {Key .Data = New Temp() {New Temp("Item1"), New Temp("Item2")}, .Count = 2})
End Function
End Class
Public Class Temp
Private _text As String
Public Property Text() As String
Get
Return _text
End Get
Set(ByVal value As String)
_text = value
End Set
End Property
Public Sub New(ByVal pText As String)
_text = pText
End Sub
End Class
When I run the page, I can see in the Chrome debugger that GetData is correctly called and return this:
{"d":"{\"Data\":[{\"Text\":\"Item1\"},{\"Text\":\"Item2\"}],\"Count\":2}"}
But I can't understand why the ListView is still empty and don't show the data.
What did I miss there?
Jocelyn