Featured post
ASP.NET AJAX 4.0 Live binding - Issue with Sys.registerComponent -
i trying design client template using ajax 4.0 framework live binding.
i have wcf service defined called vesseldata (will provide code if needed) returns datatable class called vesselcollection. also, referencing following scripts in master file: microsoftajax.debug.js, microsoftajaxdatacontext.debug.js, microsoftajaxtemplates.debug.js.
the problem templates donot fill data, , fetchdata method on datacontext goes failcallback method without way know went wrong. moreover, several javascript errors "object doesnt support property or method" on "sys.registercomponent" inside 1 of .js files.
please, need here..
code:
< %@ page title="" language="c#" masterpagefile="~/site.master" autoeventwireup="true" codebehind="vessels.aspx.cs" codefile="~/vessels.aspx.cs" inherits="sampleajaxdatabinding.vessels" %> < %@ register assembly="ajaxcontroltoolkit" namespace="ajaxcontroltoolkit" tagprefix="cc1" %> < asp:content id="content1" contentplaceholderid="headcontent" runat="server"> < script type="text/javascript"> var datacontext = new sys.data.datacontext(); datacontext.set_serviceuri("../services/vesseldata.svc"); datacontext.initialize(); function bind() { datacontext.fetchdata("getvesseldata", { $top: 1 }, sys.data.mergeoption.overwritechanges, "get", function () { document.getelementbyid("template").style.display = "block"; alert('fetch succeeded.'); }, function (error) { alert('fetch failed \n' + error.valueof().tostring()); }, 2000); } < /script> <style type="text/css"> .sys-template { display:block; visibility:visible; } </style> </asp:content> <asp:content id="content2" contentplaceholderid="maincontent" runat="server"> <cc1:toolkitscriptmanager id="toolkitscriptmanager1" scriptmode = "release" runat="server"> <services> <asp:servicereference path="~/services/vesseldata.svc" /> </services> </cc1:toolkitscriptmanager> < div id = "view"> < ul id="template" class="sys-template" sys:attach="dataview" dataview:autofetch="true" dataview:dataprovider="datacontext" dataview:fetchoperation="getvesseldata"> < li> < h3>{{ vesselname }}</h3> < div> {{ vesselid }} <br /> {{ companyid }} <br /> {{ publishquestionnaire88 }} <br /> < /div> </li> </ul> </div > <input type="button" value="perform binding" onclick="bind()" />
i had same problem using ajax script files cdn until realize sys.registercomponent defined on microsoftajax.debug.js comes on sdk on odata.org here. not weird enough if use minified version microsoftajax.js breaks on if (serviceuri) { this.set_path(serviceuri); }
saying set_path not defined.
in end had use debug version of microsoftajax, microsoftajaxdatacontext, microsoftajaxopendata , microsoftajaxtemplates , manualy compress files release.
i hope find out of mistake , fix respective files , upload new version cdn.
- Get link
- X
- Other Apps
Comments
Post a Comment