Reputation: 3945
Trying to do an onClick
a JS function for a <td>
.
<td id="Td10" runat="server" onclick="doPostBack('<%#Eval("ID")%>')"> </td>
is flagging as
Parser Error
Description: An error occurred during the parsing of a resource required to service this request. Please review the following specific parse error details and modify your source file appropriately.
Parser Error Message: The server tag is not well formed.
but I cant see how it is not formatted properly?
any suggestions?
I obtained this example from:
Table row onclick event that runs codebehind
--INCLUDED ON EDIT---
<script type="text/javascript">
function doPostBack(id) {
alert("MAP ID is " + id);
}
</script>
Console is throwing error 'UNEXPECTED TOKEN <' with
<td id="MainContent_lvDataStores_Td10_0" onclick="doPostBack(<%#Eval("ID")%>)">
it removes < and includes <??
Upvotes: 1
Views: 2341
Reputation: 544
Replace this:-
<td id="Td10" runat="server" onclick="doPostBack('<%#Eval("ID")%>')">
with:-
<td id="Td10" runat="server" onclick='<%#"doPostBack("+Eval("ID")+")" %>'></td>
Hope this helps.
Upvotes: 1