Hi!
We have a grid that contains a date-time column where we are displaying hours and minutes. We want to use only the date portion of the selected value for our filter, and on the SQL side of this, we are able to parse the value using the C# code below.
The problem we are seeing is that when we stick the data back into the grid, no rows are showing. We suspect the grid is filtering the data still on the date-time value as designated in the aspx code. Is there a way to accomplish this?
Thanks!
We have a grid that contains a date-time column where we are displaying hours and minutes. We want to use only the date portion of the selected value for our filter, and on the SQL side of this, we are able to parse the value using the C# code below.
The problem we are seeing is that when we stick the data back into the grid, no rows are showing. We suspect the grid is filtering the data still on the date-time value as designated in the aspx code. Is there a way to accomplish this?
Thanks!
<telerik:GridDateTimeColumn DataField=
"AssignDate"
DataFormatString=
"{0:MM/dd/yyyy hh:mm tt}"
HeaderText=
"Assign Date"
PickerType=
"DatePicker"
SortExpression=
"AssignDate"
UniqueName=
"AssignDate"
/>
if
(filter.Contains(
"[AssignDate]"
))
{
int
index = filter.IndexOf(
"([AssignDate]"
);
int
firstQuote = filter.IndexOf(
"'"
, index);
int
lastQuote = filter.IndexOf(
"'"
, firstQuote + 1);
string
stringToExcise = filter.Substring(index, lastQuote - index + 2);
string
dateToParse = filter.Substring(firstQuote + 1, lastQuote - firstQuote - 1);
DateTime dateTime = DateTime.Parse(dateToParse);
assignDate =
"(convert(varchar(10), [AssignDate], 101) = '"
+ dateTime.Month.ToString(
"0#"
) +
"/"
+ dateTime.Day.ToString(
"0#"
) +
"/"
+ dateTime.Year +
"')"
;
}