How can I set the DefaultValue
's in the following code to the start date (first ControlParameter) and last date (second ControlParameter) of the current month?
<SelectParameters>
<asp:ControlParameter ControlID="txtFromDate" Name="ExpenseDate" PropertyName="Text"
Type="String" DefaultValue="01-05-2013" ConvertEmptyStringToNull="true" />
<asp:ControlParameter ControlID="txtToDate" Name="ExpenseDate2" PropertyName="Text"
Type="String" DefaultValue="30-05-2013" ConvertEmptyStringToNull="true" />
</SelectParameters>
DateTime today = DateTime.Today;
int daysInMonth = DateTime.DaysInMonth(today.Year, today.Month);
DateTime startOfMonth = new DateTime(today.Year, today.Month, 1);
DateTime endOfMonth = new DateTime(today.Year, today.Month, daysInMonth);
Then you can set these values to your controls.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With