Note that there are some explanatory texts on larger screens.

plurals
  1. POreturn html from wcf service
    primarykey
    data
    text
    <p>I have a web service from which I need to return a string containing html. This html is the markup for a Select control (for use in jqGrid search filters), e.g. </p> <pre><code>&lt;select&gt;&lt;option id='1'&gt; value 1 &lt;/option&gt;&lt;/select&gt; </code></pre> <p>My WCF web service contains a method that returns this value as a string... </p> <pre><code>public string GetLeadTypeSelect() { return "&lt;select&gt;&lt;option id='1'&gt; value 1 &lt;/option&gt;&lt;/select&gt;"; } </code></pre> <p>and the contract for this method is : </p> <pre><code>[OperationContract] [WebInvoke(Method = "GET", BodyStyle = WebMessageBodyStyle.Bare, ResponseFormat = WebMessageFormat.Json)] string GetLeadTypeSelect(); </code></pre> <p>My problem is that escape characters are inserted into the string so rendering the returned HTML useless - the service returns this :</p> <pre><code>"&lt;select&gt;&lt;option id='1'&gt; value 1 &lt;\/option&gt;&lt;\/select&gt;" </code></pre> <p>The quotation marks and the escaped <code>'/'</code> in the closing <code>&lt;option&gt;</code> and <code>&lt;select&gt;</code> tags both cause problems.</p> <p>jqGrid uses the returned HTML to display the dropdown...</p> <pre><code>filterModel: [ { label: 'Type', name: 'type', stype: 'select', surl: '../../../Services/Leads/GetLeads.svc/GetLeadTypeSelect' }, </code></pre> <p>So, my question is, how to I return pure HTML back to the client from this web service so that it can be inserted into my HTML page?</p> <p>Thanks in advance for any help, Colin.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload