Click here to Skip to main content
13,044,705 members (51,018 online)
Rate this:
Please Sign up or sign in to vote.
See more: , +
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" />

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))
Posted 31-Jan-12 3:51am
Updated 31-Jan-12 3:57am
Mark Nischalke 31-Jan-12 9:55am
It isn't clear what you are asking. Please update you question to clarify.
cutexxbaby 31-Jan-12 9:58am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

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.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 12 Nov 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100