How do I render a partial form element using AJAX

For an ajax call you have to build the model: $.ajax({ type: “POST”, url: ‘@Url.Action(“AddPreference”, “Main”)’, data: { Field1: ‘field1’, Field2: ‘field2’ }, success: function (html) { $(html).appendTo(‘#additionalPreference’); console.log(html); }, error: function (xhr, ajaxOptions, thrownError) { alert(“Error”); }, complete: function () { console.log(“End”); }); Make sure that the names in the data section of the … Read more

RazorEngine issues with @Html

Check https://github.com/Antaris/RazorEngine/wiki/6.-Encoding-Values page. I copy / past it here: By default, RazorEngine is configured to encode as HTML. This sometimes presents problems where certain characters are encoded as HTML when you wanted the output to be as-is. To output something in raw format, use the @Raw() built-in method as shown in the following example: string … Read more