So here is the situation:
I have a RadGrid with 4 columns and am allowing filtering. I'm using the <FilterTemplate> for all four columns and am binding using the NeedDataSource event.
Everything is working great except that for one of the fields I want to actually requery the database rather than just filter. It is a date field and I would rather limit the results from the database on this filter rather than just filter the existing data.
Sooo...here is what I tried:
RadComboboxEmployeeDateSubmittedFilter is the combobox that is inside the DateSubmitted column <FilterTemplate>, so the code above fires when the user selects an item from the combobox.
Here is my NeedDataSource handler:
As you can see it is referencing the _startDate and _endDate fields which get populated when the user makes a selection from the dropdown.
The problem is that RadGridEmployeeTransactions.Rebind() does not cause the RadGridEmployeeTransactions_NeedDataSource event to fire, which means the database is not re-queried and the results are not filtered.
How do I go about forcing the RadGridEmployeeTransactions_NeedDataSource event to fire so that it queries the database with the correct _startDate and _endDate values??
Thanks!
I have a RadGrid with 4 columns and am allowing filtering. I'm using the <FilterTemplate> for all four columns and am binding using the NeedDataSource event.
Everything is working great except that for one of the fields I want to actually requery the database rather than just filter. It is a date field and I would rather limit the results from the database on this filter rather than just filter the existing data.
Sooo...here is what I tried:
Public Sub RadComboboxEmployeeDateSubmittedFilter_SelectedIndexChanged(ByVal sender As Object, ByVal e As RadComboBoxSelectedIndexChangedEventArgs) |
_startDate = String.Format(CultureInfo.CurrentCulture, "1/1/{0} 12:00:00 AM", e.Value) |
_endDate = String.Format(CultureInfo.CurrentCulture, "12/31/{0} 11:59:59 PM", e.Value) |
Session.Item("TransactionLogYearFilter") = e.Value |
RadGridEmployeeTransactions.Rebind() |
End Sub |
RadComboboxEmployeeDateSubmittedFilter is the combobox that is inside the DateSubmitted column <FilterTemplate>, so the code above fires when the user selects an item from the combobox.
Here is my NeedDataSource handler:
Private Sub RadGridEmployeeTransactions_NeedDataSource(ByVal source As Object, ByVal e As GridNeedDataSourceEventArgs) Handles RadGridEmployeeTransactions.NeedDataSource |
Dim lTransactions As DataSet = Nothing |
If UserType <> EnumHelper.UserType.Employee Then |
Return |
End If |
Try |
lTransactions = MiBenefitsHelper.GetEmployeeTransactions(GroupNumber, _ |
FamilyNumber, _ |
_startDate, _ |
_endDate) |
RadGridEmployeeTransactions.DataSource = lTransactions |
Catch ex As WcfException |
PanelEmployeeTransactionLog.Visible = False |
PanelUpdateStatus.Visible = True |
LabelUpdateStatus.Text = "There was an error returning your transactions and they cannot be displayed at this time. EBMS has been notified of the problem and will have it resolved as soon as possible." |
LabelUpdateStatus.ForeColor = Color.Red |
ExceptionPolicy.HandleException(ex, "Global Policy") |
End Try |
End Sub |
As you can see it is referencing the _startDate and _endDate fields which get populated when the user makes a selection from the dropdown.
The problem is that RadGridEmployeeTransactions.Rebind() does not cause the RadGridEmployeeTransactions_NeedDataSource event to fire, which means the database is not re-queried and the results are not filtered.
How do I go about forcing the RadGridEmployeeTransactions_NeedDataSource event to fire so that it queries the database with the correct _startDate and _endDate values??
Thanks!