Here's my code:
I need to pass the data to the controller.
@{
DateTime today = DateTime.Now; //current date
DateTime firstDay = today.AddDays(-(today.Day - 1)); //first day
today = today.AddMonths(1);
DateTime lastDay = today.AddDays(-(today.Day)); //last day
}
//@using (Html.BeginForm())
//{
//<fieldset>
<br /><br />
<h2>Please select date range for the report</h2>
<table>
<tr>
<td>Begin Date</td>
<td>
@(Html.Telerik().DatePicker()
.Name("BeginDate")
.ShowButton(true)
.Value(firstDay)
)
</td>
</tr>
<tr>
<td>End Date</td>
<td>
@(Html.Telerik().DatePicker()
.Name("EndDate")
.ShowButton(true)
.Value(lastDay)
)
</td>
</tr>
<tr>
<td></td>
<td>
<input type="submit" value="Show Report" />
</td>
</tr>
</table>
//</fieldset>
//}
The datepicker was not bound to model, I need the value for the grid data which I'm using. (telerik grid ajax)
Also i want to prevent the user to enter an Enddate that is larger than the BeginDate
Thanks