I create my own Html Helper extension as follows:
public static string DatePicker(this HtmlHelper helper, string name, string value)
{
return string.Format(@"<script type='text/javascript'>
$(document).ready(function(){{
$('#{0}').datepicker({{
changeMonth: true,
changeYear:true,
dateFormat: 'd-M-yy',
firstDay: 1, showButtonPanel:
true,
showWeek: true
}});
}});
</script>
<input type='text' name='{0}' id='{0}' value='{1}'>", name, value);
}
The problem is that this now requires the page to "include" the following:
<script src="/Scripts/jquery-1.4.2.min.js" type="text/javascript"></script>
<script src="/Scripts/jquery.ui.datepicker.min.js" type="text/javascript"></script>
And a few more items. The questions are:
Is there any serious processing overhead if I had to include these elements on an EACH page (for example, in Site.Master for example), thus denying the need for the HtmlHelper to organize “includes” - given that in the end about 20 includes everything various types of jQuery user interfaces are used throughout the site.
HtmlHelper "", DatePicker ( ) - , , , jquery, DatePicker ( )?