I was able to resolve this using the below jquery function:
<pre><script type="text/javascript">
$(document).ready(function () {
$(".edit[data-target='#modal-Edit']").click(function () {
var columnHeadings = $("thead th").map(function () {
return $(this).text();
}).get();
columnHeadings.pop();
var columnValues = $(this).parent().siblings().map(function () {
return $(this).text();
}).get();
var myModal = $('#modal-Edit');
$('#AppointmentIdEdit', myModal).val(columnValues[0].trim());
$('#patientRegNoEdit', myModal).val(columnValues[1].trim());
$('.appointmentDateEdit', myModal).val(columnValues[4].trim());
$('#reasonsEdit', myModal).val(columnValues[5].trim());
myModal.modal({ show: true });
return false;
});
});
</script>