I need help with sending a Dictionary key (which is a string) to a JavaScript function.
<%
foreach (var field in Model.Fields)
{ %>
<tr><td>
<a href="#" onclick="javascript:EditField(<%= field.Key %>)">
<%= Html.Encode(field.Value.Name) %></a>
</td><tr>
<% } %>
However, the JavaScript function receives it as an object that contains the entire 'FIELD' object instead of just a string.
This is how my JS function looks -
function EditField(field) {
// additional code here
}
Are there any potential issues when passing Dictionary keys to a JS function?