Hi, I have the following Code to filter a GridBoundColumn. The data comes from a Microsoft SQL DB. For some reason the filtering is not working.
<
telerik:GridBoundColumn
DataField
=
"TestTimeStamp"
UniqueName
=
"TestTimeStamp"
HeaderButtonType
=
"TextButton"
HeaderText="<%$ Resources:Repository,ReportingTimeStamp%>" DataType="System.DateTime"
DataFormatString="{0:g}">
<
FilterTemplate
>
From
<
telerik:RadDatePicker
ID
=
"FromOrderDatePicker2"
runat
=
"server"
Width
=
"150px"
DbSelectedDate='<%# startDate %>'>
<
ClientEvents
OnDateSelected
=
"FromDateSelected"
/>
</
telerik:RadDatePicker
>
<
br
/>
to
<
div
style
=
"padding-left: 31px;"
>
<
telerik:RadDatePicker
ID
=
"ToOrderDatePicker2"
runat
=
"server"
Width
=
"150px"
DbSelectedDate='<%# endDate %>'>
<
ClientEvents
OnDateSelected
=
"ToDateSelected"
/>
</
telerik:RadDatePicker
>
</
div
>
<
telerik:RadScriptBlock
ID
=
"scriptFilterEventDate"
runat
=
"server"
>
<
script
type
=
"text/javascript"
>
function FromDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var ToPicker = $find('<%# ((GridItem)Container).FindControl("ToOrderDatePicker2").ClientID %>');
var fromDate = FormatSelectedDate(sender);
var toDate = FormatSelectedDate(ToPicker);
if (toDate != '') {
tableView.filter("TestTimeStamp", fromDate + " " + toDate, "Between", true);
//tableView.filter("TestTimeStamp", fromDate, Telerik.Web.UI.GridFilterFunction.GreaterThan);
}
}
function ToDateSelected(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
var FromPicker = $find('<%# ((GridItem)Container).FindControl("FromOrderDatePicker2").ClientID %>');
var fromDate = FormatSelectedDate(FromPicker);
var toDate = FormatSelectedDate(sender);
if (fromDate != '') {
//tableView.filter("TestTimeStamp", fromDate, Telerik.Web.UI.GridFilterFunction.GreaterThan);
tableView.filter("TestTimeStamp", fromDate + " " + toDate, "Between", true);
}
}
function FormatSelectedDate(picker) {
var date = picker.get_selectedDate();
var dateInput = picker.get_dateInput();
var formattedDate = dateInput.get_dateFormatInfo().FormatDate(date, dateInput.get_displayDateFormat());
return formattedDate;
}
</
script
>
</
telerik:RadScriptBlock
>
</
FilterTemplate
>
</
telerik:GridBoundColumn
>