I'm honestly kind of ignorant on .Net aspects
In the sample code that you linked, there's this block of script:
Code:
<script type="text/javascript">
$(function () {
$("#sortable1, #sortable2").sortable({
connectWith: ".connectedSortable"
}).disableSelection();
});
$(document).ready(function () {
$("li").dblclick(function () {
$(this).closest('li').remove();
});
});
</script>
It's a little redundant in that both of these constructs do the same thing:
Code:
$(document).ready(function () {
//script that you put in here will be executed when the page loads
}
$(function () {
//script that you put here will also be executed when the page loads;
//this is a shorthand version of the above
}
So, you could condense this into one block, and it's the same place where you'll want to add anything else that runs on page load (such as assigning callbacks for events like submit and click):
Code:
<script type="text/javascript">
$(function () {
$("#sortable1, #sortable2").sortable({
connectWith: ".connectedSortable"
}).disableSelection();
$("li").dblclick(function () {
$(this).closest('li').remove();
});
//additional code goes here:
$("#cmdRecipientOK").live('click', function () {
alert('I am clicked');
return false;
});
});
</script>
From there, you could put the innards of my submit function into the click function, and then use one of jQuery's AJAX methods to submit. It may or may not be necessary, but I added "return false" in your click handler as this is often appropriate when you want the click to execute AJAX: it prevents the default action of the click, such as navigating away from the page (via link, form submission, etc.).