Click here to Skip to main content
15,888,320 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
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.NET
<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
JavaScript
<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
Updated 31-Jan-12 3:57am
v3
Comments
[no name] 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    
updated

1 solution

XML
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.
 
Share this answer
 

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900