我的以下页面运行良好(我已经删除了一些其他字段和样式以使我在此处发布的示例保持较小)。我希望将表中的 Premium 行(第 17 行)格式化为货币 (USD)。这样做的最佳方法是什么?
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<div class="datagrid" >
<table >
<thead>
<tr>
<th>Location Name</th>
<th>Location Total</th>
</tr>
</thead>
<tbody data-bind="foreach: { data: Locations, as: 'location' }">
<tr>
<td><span data-bind="text: location.LocationName" /> </td>
<td><span data-bind="text: location.Premium" /> </td>
</tr>
</tbody>
</table>
</div>
<script>
$(document).ready(function ()
{
var appViewModel
// AppViewModel
function AppViewModel()
{
this.Locations = ko.observable([]);
}
var appViewModel = new AppViewModel();
ko.applyBindings(appViewModel);
$.getJSON("http://waltweb01:85/LTCEPLWS/LTCJSON.svc/getLTCWithIDs/4", function (data)
{
incomingData = data;
appViewModel.Locations(data.getLTCWithIDsResult.Locations);
});
});
</script>
</asp:Content>