I am new to this or may be i am dumb .Please give me some way to achieve this .I have a table place holder to which output from a service need to bind to XSLT.
The return from a service is as a class of entity. I tried the below but got error and not binding ,is there any other way,please tell me .
Error like
SerializationException: Cannot serialize parameter of type 'System.Data.Entity.DynamicProxies.Share_F1BD0B4DF780181B6811269AA96A4EB29DC8B633D935D3CDB8B066C29CA1A933' (for operation 'GetResult', contract 'Iresult') blah blah blah .... For solving the error i put db.Configuration.ProxyCreationEnabled = false;
Then got this error
SerializationException: Object graph for type ' Business.Objects.childtables' contains cycles and cannot be serialized if reference tracking is disabled.
after that i cannot get the child table in the entity.So i removed db.Configuration.ProxyCreationEnabled = false;
May be i am going in wrong direction for binding the xslt result, that's y those errors are getting.Please advice me how to achieve output.
Following are the codes
client side
// container
<table class="XXXX" width="100%">
<thead>
<tr>
<th width="30px">
</th>
<th>
HEader X
</th>
<th>
HEader y
</th>
</tr>
</thead>
<tbody id="Container">
<tr>
<td colspan="11">
<img src="spinner.gif" alt="Loading Data" />Loading Data....
</td>
</tr>
</tbody>
</table>
<script>
var MappingXslt = null;
$(document).ready(function () {
populateList();
});
function populateList() {
var $Container = $('#Container');
$.ajax({
url: 'Service.svc/xml/GetResult',
dataType: 'xml',
success: function (response) {
try {
if (!window.XSLTProcessor) {
$Container.html(response.transformNode(MappingXslt ));
} else {
var processor = new XSLTProcessor();
processor.importStylesheet(MappingXslt );
$Container.empty();
$Container.append(processor.transformToFragment(response,document));
}
}
catch (ex) {
$Container.html('<tr><td colspan="5"><i>An error occurred retreiving the records.</i> </td></tr>');
}
},
error: function (ex) {
$Container .html('<tr><td colspan="5"><i>An error occurred retreiving the records.</i> </td></tr>');
}
});
}
$.ajax({
type: 'GET',
url: 'files/xslt/user.xslt',
dataType: 'xml',
success: function (response) {
MappingXslt = response;
},
error: function (ex) {
//something
}
});
</script>
Also i cannot able to see the xml in browser by typing the service url 'Service.svc/xml/GetResult'
service.vb - Business.Objects.Share,that share is the entity class
<PrincipalPermission(SecurityAction.Demand, Authenticated:=True)>
Public Function GetResult(ByVal EmailID As String) As Business.Objects.Share Implements Iresult.GetResult
Dim shareObj As New Business.Objects.Share
Dim shareService As New Business.Services.Sharing.ShareServices(Library.DBID)
shareObj = shareService.FetchA("TEST", "ID", "EmailID")
Return shareObj
End Function
services.cs ENTITY FETCH fetch is working correctly
public Share FetchA(string A, string B,string C)
{
return _unitOfWork.ShareRepository.Fetch(x => x.ID== A && x.ShareUsers.FirstOrDefault(y => y.Member.MemberID == B) != null, "childtables,ShareUsers,ShareUsers.Member").FirstOrDefault();
}
user.xslt HOW TO BIND
<xsl:stylesheet version="1.0" xmlns:pg="http://XXXXX.com/object"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" encoding="utf-8" omit-xml-declaration="yes" indent="no" />
<xsl:template match="/pg:PagedResult">
</xsl:choose>
</xsl:template>
<xsl:template match="pg:ID">//not working how to bind from entity id inside the entity class share
<tr>
<xsl:if test="(position() mod 2 = 0)">
<xsl:attribute name="class">alternatingRow</xsl:attribute>
</xsl:if>
<td>
<xsl:value-of select="pg:Name" /> //not working HOW ?
</td>
......
etc some more td's..
.......
</tr>
</xsl:template>
</xsl:stylesheet>