一个ajax日历控件如何具有多个文本框? [英] how to have multiple textbox for a ajax calendar control?
本文介绍了一个ajax日历控件如何具有多个文本框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个ajax日历控件,但是我单击btnDate3,它将添加文本框的另一行,这使我可以再次从日历控件中选择日期,因此,如果我单击提交",它将从每个文本框中检索每个文本框日期添加后排
因此基本上用户可以单击添加"按钮,它将添加另一行具有相同功能的文本框
i have this ajax calendar control, but i click on the btnDate3 it will add another row of the textbox which allow me to select date from the calendar control again, so if i click submit, it will retrieve each textbox date from each row after you Add
so basically a user can click on the Add button then , it will add another row of textbox which have the same function
<asp:TextBox runat="server" ID="txtDate1" />
<ajaxtoolkit:calendarextender runat="server" ID="calExtender1"
TargetControlID="txtDate1" OnClientDateSelectionChanged="CheckDateEalier" Format="dd/MM/yyyy"/>
<asp:Button ID="btnDate3" Text="Add" Width="20px" runat="server" />
<asp:Button ID="submit" Text="Submit" Width="20px" runat="server" />
这是我用来检查日期的JavaScript
this is the javascript i use to check the date
<script type="text/javascript">
function CheckDateEalier(sender,args) {
if (sender._selectedDate < new Date()) {
alert("You cannot select a day before today or today!");
sender._selectedDate = new Date();
// set the date back to the today
// sender._textbox.set_Value(sender._selectedDate.format(sender._format))
sender._textbox.set_Value(null)
}
}
</script>
推荐答案
store previous date values in to a string using a <b>separator "&" and append</b> all new string values to the old string.
<b>split</b> the string with the character "&" and store it into an array of string.
<b>Get the count</b> of array and <b>create dynamic textbox controls</b> with respect to the count of the contents of the array.
include the above logic into your onclick code.
这篇关于一个ajax日历控件如何具有多个文本框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文