AJAX DataView Template: Bind to li element

Last post 06-01-2009 10:05 AM by dwhite. 1 replies.

Sort Posts:

  • AJAX DataView Template: Bind to li element

    01-27-2009, 11:18 AM
    • Member
      32 point Member
    • Emanon
    • Member since 07-13-2005, 2:38 PM
    • Posts 8
    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:msdata ="urn:schemas-microsoft-com:xml-msdata"><xs:element name="NewDataSet" msdata:IsDataSet="true" msdata :UseCurrentLocale="true"><xs:complexType><xs:choice minOccurs="0" maxOccurs="unbounded"><xs:element name="PrefsMyWidgets"><xs:complexType><xs:sequence><xs:element name="PrefValue" minOccurs="0" ><xs:simpleType><xs:restriction base="xs:string"><xs:maxLength value="2048"/></xs:restriction> </xs:simpleType></xs:element></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType ></xs:element></xs:schema><diffgr:diffgram xmlns:diffgr="urn:schemas-microsoft-com:xml-diffgram-v1 " xmlns:msdata="urn:schemas-microsoft-com:xml-msdata"><NewDataSet><PrefsMyWidgets diffgr:id="PrefsMyWidgets1 " msdata:rowOrder="0"><PrefValue>#FFFFFF</PrefValue></PrefsMyWidgets></NewDataSet></diffgr:diffgram ></DataSet>"}
    Filed under:
  • Re: AJAX DataView Template: Bind to li element

    06-01-2009, 10:05 AM
    • Star
      8,978 point Star
    • dwhite
    • Member since 02-08-2007, 2:25 PM
    • Bristol, CT
    • Posts 1,422

    Emanon -

    I know this is a bit late, but I have written quite a few ASP.NET AJAX 4.0 (DataView, Sys.Observer, and Binding) posts on my blog:

    The Client Templates post (DataView) contains code of the DataView and a WCF service while the Data Binding post contains code that uses the DataView and ADO.NET Data Services.

    -Damien

    Visoft, Inc - Home | Blogs

    Latest Blog Post: Art of Unit Testing
Page 1 of 1 (2 items)