Click here to Skip to main content
15,917,328 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hello...
i have one textbox for calender..
when i select month from calender, automatically select date from 25th of previous month to 24th of present month...
for example..when i select month february,then textbox value becomes "25janto24feb"....
Does anyone know how to do this?

What I have tried:

<asp:TextBox ID="txtdate1" runat="server" autocomplete="off">
                        </asp:TextBox>
                        <asp:CalendarExtender ID="CalendarExtender1" Format="dd-MMM-yyyy" TargetControlID="txtdate1"
                            runat="server">
                        </asp:CalendarExtender>
Posted
Updated 15-Feb-17 1:50am
v3
Comments
Karthik_Mahalingam 15-Feb-17 0:45am    
"25-01-2017to 24-01-2017"
both are same month.
Member 12938297 15-Feb-17 1:08am    
no sir..."25-01-2017to 24-02-2017"
Gopal Rakhal 15-Feb-17 1:42am    
You can use "AddMonths()" like selecteddate.AddMonths(-1); and assigned to textbox
RAJU Kanumuri 15-Feb-17 1:57am    
use OnClientDateSelectionChanged event for ajax calendar extender. In that java script method add month -1 to selected date and set to text box.

1 solution

You have to subtract a month, and then a day

dateValue = dateValue.AddMonths(-1).AddDays(-1);
 
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