我有一个网络服务,我需要从中返回一个包含 html 的字符串。此 html 是 Select 控件的标记(用于 jqGrid 搜索过滤器),例如
<select><option id='1'> value 1 </option></select>
我的 WCF Web 服务包含一个以字符串形式返回该值的方法...
public string GetLeadTypeSelect()
{
return "<select><option id='1'> value 1 </option></select>";
}
这种方法的合同是:
[OperationContract]
[WebInvoke(Method = "GET",
BodyStyle = WebMessageBodyStyle.Bare,
ResponseFormat = WebMessageFormat.Json)]
string GetLeadTypeSelect();
我的问题是转义字符被插入到字符串中,因此返回的 HTML 无用 - 服务返回以下内容:
"<select><option id='1'> value 1 <\/option><\/select>"
引号和转义符'/'
在结束时<option>
and <select>
标签都会引起问题。
jqGrid 使用返回的 HTML 来显示下拉列表...
filterModel: [
{ label: 'Type', name: 'type', stype: 'select', surl: '../../../Services/Leads/GetLeads.svc/GetLeadTypeSelect' },
所以,我的问题是,如何从该 Web 服务将纯 HTML 返回给客户端,以便将其插入到我的 HTML 页面中?
预先感谢您的任何帮助,
科林.