<< back to your results
AJAX DataView Template: Bind to li element
From: ASP.NET Futures - 1/27/2009
I'm working with the ASP.Net 4.0 Preview 3 build. I've been unsuccessful in my attempts to bind the value of 'PrefValue' (returned by the HTTP response) to the 'li' element. I'm not getting any errors and the data that I'm looking for is getting returned, but I can't get it to bind to the 'li' element. I'm hoping that someone can review my code and see what I need to change.
HTML
<body xmlns:sys="javascript:Sys"
xmlns:dataview="javascript:Sys.UI.DataView"
sys:activate="*">
<h1>Title</h1>
<div id="">
<ul id="" class="sys-template" sys:attach="dataview"
dataview:datasource="{{ new Sys.Data.AdoNetDataSource() }}"
dataview:serviceuri="Service.svc"
dataview:query="GetWidgetPrefValue">
<li>{{ PrefValue }}</li>
</ul>
</div>
</body>
Service.svc
<WebGet()> <OperationContract()> _
Public Function GetWidgetPrefValue() As DataSet
Dim WidgetID As Int16 = 9
Dim CorpID As String = "emanon"
Dim PrefID As Int16 = 2
Dim ds As New DataSet
Dim dt As New DataTable
Dim da As New DSTableAdapters.PrefsMyWidgetsTableAdapter
dt = da.GetWidgetPrefValue(WidgetID, CorpID, PrefID)
ds.Tables.Add(dt)
If Not ds.Tables(0).Rows.Count = 0 Then
Return ds
End If
Return Nothing
End Function
HTTP Response
{"d":"<DataSet><xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msd
Featured Listings
View more: AJAX DataView Template: Bind to li element