Single Calendar control with multiple textboxes
I have a GridView with multiple date columns in it. For dates, I use textboxes. I would like to use ajaxToolkit:CalendarExtender to make inserting dates easier. But if I place a ajaxToolkit:CalendarExtender in each ItemTemplate, it will make my page much slower. Could you please tell me how I can use one ajaxToolkit:Cale开发者_如何学编程ndarExtender for all textboxes? I guess, the calendar should appear when the user clicks a textbox. And of course, the calendar should appear somewhere next to the textbox. Thanks.
I suggest you yo use jQuery plug-in. Visit http://jqueryui.com/demos/datepicker/
this plug-in helps you.
I don't thing there's a way or a easy way to do it. You could think to use another component. Have you known datapicker from jquery ui ? It's nice, free, clean and fast calendar component. Using it, you can apply a css style in your textboxes and filter it by jquery doing a calendar, using datepicker, something like this:
your textboxes inside the gridview:
<asp:TextBox ID="txtDate1" runat="server" CssClass="date" />
<asp:TextBox ID="txtDate2" runat="server" CssClass="date" />
<asp:TextBox ID="txtDate3" runat="server" CssClass="date" />
and in bottom of your webform, you could do a jquery script
<script language='javascript'>
$(function() { // <- page_load in client side with jQuery
// get all inputs that has .date css style and apply datepicker
$("input.date").datepicker();
});
</script>
Read more about jquery ui to know how to setup it on your application (basically, add a javascript file and css file)
Take a look at these links:
http://www.jquery.com http://jqueryui.com/demos/datepicker/
PS: Sorry for my english!
精彩评论