I get a "ReferenceError: punt is not defined" - everything seems to be right and I can't identify the mistake.
Here is the related code:
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript">
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
and inside the ItemTemplate in the Repeater I have:
<input type="image" style="border-width:0" src='<%=ResolveUrl("~/css/images/icon_update.png") %>'
alt="Update Reviewer List" tabindex="0" title="Update Reviewer List"
onclick="punt(<%#Container.ItemIndex%>,
'<%#HttpUtility.HtmlEncode((string)DataBinder.Eval(Container.DataItem, "Name"))%>',
'Update');
return false;" />
I get a "ReferenceError: punt is not defined" - everything seems to be right and I can't identify the mistake.
Here is the related code:
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript">
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
and inside the ItemTemplate in the Repeater I have:
<input type="image" style="border-width:0" src='<%=ResolveUrl("~/css/images/icon_update.png") %>'
alt="Update Reviewer List" tabindex="0" title="Update Reviewer List"
onclick="punt(<%#Container.ItemIndex%>,
'<%#HttpUtility.HtmlEncode((string)DataBinder.Eval(Container.DataItem, "Name"))%>',
'Update');
return false;" />
Share
edited Mar 27, 2013 at 19:34
Aleksandr M
24.4k13 gold badges74 silver badges146 bronze badges
asked Mar 27, 2013 at 19:33
user1216456user1216456
0
2 Answers
Reset to default 7You can't bine a script include and inline javascript.
<script src="../Scripts/jquery-1.9.1.min.js" type="text/javascript"></script>
<script>
function punt(rowIndex, Name, actionType) {
alert("hello");
}
</script>
Your script tag which includes the external script should be separate from your script tag where you define your new function, i.e.:
<!-- first script tag -->
<script src="jquery"></script>
<!-- second script tag -->
<script>
// punt function
</script>