Hi, I'm using FilterCellValueChanged event to capture the user entered text and when the text length meets a certain configured value (3), I'm using that that text to query a dataset and load the grid. As the currently configured length is 3, I'm able to enter only 2 characters and by the time I enter the 3rd character, it executes the code I have to query and load. However, it does not allow me to continue typing the remaining characters... Is there any property to be updated for that? Appreciate your help!
Private Sub grdEventEntry_FilterCellValueChanged(sender As Object, e As FilterCellValueChangedEventArgs) Handles grdEventEntry.FilterCellValueChanged Dim sCondition Try Dim filterCell As UltraGridFilterCell = e.FilterCell Dim editor As EmbeddableEditorBase = filterCell.EditorResolved If Not mlEventEntryId > 0 AndAlso (Not IsNothing(editor.CurrentEditText) AndAlso Not IsDBNull(editor.CurrentEditText) AndAlso editor.CurrentEditText.ToString.Length >= miEventTypLen) Then
'
' End If Catch ex As Exception ExceptionManager.Publish(ex) End Try End Sub
Hi,
There's very little information here for me to go on.
What, exactly, are you doing when the number of characters reaches 3?
Are you changing the grid's data source?
Are you setting the DataSource property on the grid?
If the answer to either of those last two questions is true - why are you doing that? The grid filtering is handling by the grid, you don't have to manually filter your data source. Or are you doing that intentionally for some reason?
When you say you cannot type any remaining characters, what does that mean? Does the filter cell still have focus? Is there a blinking caret at the end of the text? What happens when you type?
My best guess with such limited information is that whatever you are doing to "load the grid" is causing the filter cell to lose focus, so when you type, those characters aren't going into that cell. In which case, the solution would be very simple - you just have to set focus back to that cell, put it in edit mode, and put the caret at the end of the text.
Hi Mike, thanks for your prompt reply. Here's some more information...
There are 2 ways this grid's datasource must be loaded. First way is based on value selected in another dropdown, the database will be queried to load a certain set of records into a dataset and that will be bound to the grid. In another scenario, if the other dropdown is not selected, then we would like to load the grid with specific records that match the text that's being typed in the grid filtercell. After the user types at least 3 characters, I kickoff the call the query the database or filter within a pre-fetched dataset and get only the records that contain the text that's entered and bind that to the grid
Here's when I'm facing the issue of not being able to type more than 2 characters...
when you say set focus back to that cell, is there a .focus method available for grid filtercell... or how do I do that...
Thank you
Focus issue got resolved when the grid datasource update logic was moved out of filtercellvaluechange event
Thank You
I'm glad you got it worked out. Just in case you ever need it, here's how you would put focus into the filter cell:
this.ultraGrid1.Focus(); this.ultraGrid1.Rows.FilterRow.Cells["String 1"].Activate(); this.ultraGrid1.PerformAction(UltraGridAction.EnterEditMode);