Hi.
Following some examples, I found this:
http://www.telerik.com/community/code-library/aspnet-ajax/general/filtering-range-with-raddatepicker-instances-in-a-custom-filtering-column.aspx
I am trying to filter a data source between 2 selected dates.
I am almost there with the implementation of the solution however the problem is, even when the dates are selected, the SelectedDate on the ItemCommand event is null (Nothing in VB.NET)
any ideas where I have gone wrong?
Code:
dateFrom and dateTo show "Nothing"
any ideas? I want to be able to obtain the dates the user has selected.
Following some examples, I found this:
http://www.telerik.com/community/code-library/aspnet-ajax/general/filtering-range-with-raddatepicker-instances-in-a-custom-filtering-column.aspx
I am trying to filter a data source between 2 selected dates.
I am almost there with the implementation of the solution however the problem is, even when the dates are selected, the SelectedDate on the ItemCommand event is null (Nothing in VB.NET)
any ideas where I have gone wrong?
<
telerik:GridTemplateColumn
HeaderStyle-HorizontalAlign
=
"Center"
HeaderText
=
"DateFilter"
SortExpression
=
"DateTime"
UniqueName
=
"DateFilter"
AllowFiltering
=
"true"
ShowFilterIcon
=
"true"
AutoPostBackOnFilter
=
"false"
DataType
=
"System.DateTime"
DataField
=
"DateTime"
ItemStyle-HorizontalAlign
=
"Left"
>
<
HeaderStyle
Width
=
"90px"
></
HeaderStyle
>
<
ItemStyle
HorizontalAlign
=
"Left"
Width
=
"90px"
></
ItemStyle
>
<
FilterTemplate
>
<
telerik:RadComboBox
ID
=
"ddlDateFilter"
runat
=
"server"
DropDownWidth
=
"200px"
>
<
Items
>
<
telerik:RadComboBoxItem
Text
=
""
Selected
=
"true"
/>
</
Items
>
<
ItemTemplate
>
From <
telerik:RadDatePicker
ID
=
"RadDatePickerFrom"
runat
=
"server"
onclick
=
"PreventDropDownClose(event);"
>
</
telerik:RadDatePicker
>
To <
telerik:RadDatePicker
ID
=
"RadDatePickerTo"
runat
=
"server"
onclick
=
"PreventDropDownClose(event);"
>
</
telerik:RadDatePicker
>
<
asp:Button
ID
=
"cmdFilterDates"
runat
=
"server"
Text
=
"Filter"
CommandName
=
"FilterDates"
/>
</
ItemTemplate
>
</
telerik:RadComboBox
>
</
FilterTemplate
>
</
telerik:GridTemplateColumn
>
Code:
Protected Sub grdShiftObservation_OnItemCommand(ByVal sender As Object, ByVal e As Telerik.Web.UI.GridCommandEventArgs) Handles grdShiftObservation.ItemCommand
If String.Equals(e.CommandName, "filterdates", StringComparison.OrdinalIgnoreCase) Then
Dim cell As TableCell = CType(e.Item, Telerik.Web.UI.GridFilteringItem)("DateFilter")
Dim dateFilterComboBox As RadComboBox = CType(cell.Controls(0).FindControl("ddlDateFilter"), RadComboBox)
Dim dateFrom As RadDatePicker = CType(dateFilterComboBox.SelectedItem.FindControl("RadDatePickerFrom"), RadDatePicker)
Dim dateTo As RadDatePicker = CType(dateFilterComboBox.SelectedItem.FindControl("RadDatePickerTo"), RadDatePicker)
End If
End Sub
dateFrom and dateTo show "Nothing"
any ideas? I want to be able to obtain the dates the user has selected.