what part do you need help with? as using C# would require a form post or Ajax, I'd just do it in javascript:
date:<input id="text1" onchange="calcDates()"><br>
first:<input id="text2"><br>
last:<input id="text3"><br>
<script>
function formatDate(d) {
return (d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getFullYear();
}
function calcDates(){
var d = new Date(document.getElementById('text1').value);
if (!isNaN(d)) {
var firstDay = new Date(d.getFullYear(), d.getMonth(), 1);
var lastDay = new Date(d.getFullYear(), d.getMonth() + 1, 0);
document.getElementById('text2').value = formatDate(firstDay);
document.getElementById('text3').value = formatDate(lastDay);
}
}
</script>