Another method I used to use was to declare the ID name as a variable in JavaScript, for example:
<script>
var lbltest = '<%= lbltest.ClientId %>';
function setLabel (yourDate)
{
$("#" + lbltest).text(yourDate);
}
$(function () {
$("#datepickerStart").datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
onSelect: setLabel
});
$("#datepickerEnd").datepicker({
showOn: "button",
buttonImage: "images/calendar.gif",
buttonImageOnly: true,
onSelect: setLabel
});
});
</script>
I have presumed you are using the Datepicker Widget from jQueryUI
As you can see, the "onSelect" property defines which function should be called when the user selects a date.
That then triggers the update of the label.