Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: Javascript Ajax buttons , +
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))
             sender._textbox.set_Value(null)
         }
     }
</script>
Posted 31-Jan-12 4:51am
Edited 31-Jan-12 4:57am
v3
Comments
Mark Nischalke at 31-Jan-12 9:55am
   
It isn't clear what you are asking. Please update you question to clarify.
cutexxbaby at 31-Jan-12 9:58am
   
updated

1 solution

Rate this: bad
good
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.
  Permalink  

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

  Print Answers RSS
0 Afzaal Ahmad Zeeshan 256
1 OriginalGriff 251
2 BillWoodruff 240
3 Maciej Los 230
4 Sergey Alexandrovich Kryukov 195
0 OriginalGriff 6,419
1 Sergey Alexandrovich Kryukov 6,008
2 DamithSL 5,183
3 Manas Bhardwaj 4,673
4 Maciej Los 4,070


Advertise | Privacy | Mobile
Web03 | 2.8.1411019.1 | Last Updated 12 Nov 2012
Copyright © CodeProject, 1999-2014
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