I want to apply some custom render client (csr) to site column in XsltListViewWebPart with c# this is the code :
using (SPSite site = new SPSite("http://sharepoint"))
{
site.AllowUnsafeUpdates = true;
SPField Status = web.Fields["Status"];
Status.JSLink = "~site/_catalogs/masterpage/CustomField.js";
Status.Update(true);
}
I get this error Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.
Updates are currently disallowed on GET requests. To allow updates on a GET, set the 'AllowUnsafeUpdates' property on SPWeb.
SPSecurity.RunWithElevatedPrivileges
doesn't work either.
When I just add list view through the browser the CSR work perfectly but when I try to add list view through c#, the CSR doesn't work.
Thank in advance for your help.
I find this link which explain a similar problem, AllowUnsafeUpdates
Anyway, I have done that trough visual studio when I define the site column, I have add a csr file in layouts folder and apply through myview.jslink ="/_Layouts/15/csr/custom_field.js";
I think also this tutorial can help to use csr to custumize site column csr tutorial
I hope this is can help.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.