I have the following input inside an asp.net repeater
<div class="detailsItem">
<input type="button" class="saveCommand" value="Save"/>
</div>
then within my document.ready I bind a click function
<script type="text/javascript">
$(document).ready(function () {
$('.saveCommand').live('click', function () {
var cur = $(this);
saveItem(cur.closest('div.detailsItem'));
});
});
When I’m binding my repeater, i want to be able to include an ID in call to the click function. something similar to:
<input type="button" onclikc="save(this,<%#((CustomViewItem)Container.DataItem).Id%>" value="Save"/>
Any idea on how to combine the two styles of binding?
I would suggest you to use a
dataattribute.More information on the
data()method in jQuery: http://docs.jquery.com/Data .