I have a toolbar inside my CommandItem in RadGrid.
I'm able to correctly bubble events or fire custom events in the ItemCommand event.
The issue I'm facing is with RadToolBarSplitButton not persisting the button pressed after grid rebind.
For example one of my SplitButtons in the dropdown removes all filters like that
I've tryed to access the bar and set the defaultindex to persist the choice but that is overridden in the itemcreated event fired again after rebind. Any hint other than persisintg the choice somewhere (session/viewstate/cookie) and reading it in the ItemCreated event? Shouldn't this already be persisted (and restored) by default somewhere in cookie/viewstate/controlstate?. If this doesn't happens in a RadGrid/ItemCommand implementation how could I read the default persistence mechanism in the ItemCreated event without reinventing the wheel with my custom persistance?
What I tryed (with no success) is this:
EDIT: if I bind RebindGridCommandName to the button, instead of my custom command (and in this case rebinding happens the same since the command is for refreshing the grid) this button is persisted without any addittional code handling. With my custom command intercepted in the ItemCommand event this doesn't happen
I'm able to correctly bubble events or fire custom events in the ItemCommand event.
The issue I'm facing is with RadToolBarSplitButton not persisting the button pressed after grid rebind.
For example one of my SplitButtons in the dropdown removes all filters like that
Protected
Sub
RadGrid1_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Select
Case
e.CommandName
Case
"ClearFilters"
For
Each
column
As
GridColumn
In
RadGrid1.MasterTableView.Columns
column.CurrentFilterFunction = GridKnownFunction.NoFilter
column.CurrentFilterValue =
String
.Empty
Next
RadGrid1.MasterTableView.FilterExpression =
String
.Empty
RadGrid1.MasterTableView.Rebind()
End
Select
End
Sub
I've tryed to access the bar and set the defaultindex to persist the choice but that is overridden in the itemcreated event fired again after rebind. Any hint other than persisintg the choice somewhere (session/viewstate/cookie) and reading it in the ItemCreated event? Shouldn't this already be persisted (and restored) by default somewhere in cookie/viewstate/controlstate?. If this doesn't happens in a RadGrid/ItemCommand implementation how could I read the default persistence mechanism in the ItemCreated event without reinventing the wheel with my custom persistance?
What I tryed (with no success) is this:
Protected
Sub
RadGrid1_ItemCommand(
ByVal
source
As
Object
,
ByVal
e
As
GridCommandEventArgs)
Handles
RadGrid1.ItemCommand
Select
Case
e.CommandName
Case
"ClearFilters"
Dim
toolbar
As
RadToolBar =
DirectCast
(e.CommandSource, RadToolBar)
Dim
button
As
RadToolBarSplitButton =
DirectCast
(toolbar.FindItemByText(
"Ricerca"
), RadToolBarSplitButton)
button.EnableDefaultButton =
True
button.DefaultButtonIndex = 2
For
Each
column
As
GridColumn
In
RadGrid1.MasterTableView.Columns
column.CurrentFilterFunction = GridKnownFunction.NoFilter
column.CurrentFilterValue =
String
.Empty
Next
RadGrid1.MasterTableView.FilterExpression =
String
.Empty
RadGrid1.MasterTableView.Rebind()
End
Select
End
Sub
EDIT: if I bind RebindGridCommandName to the button, instead of my custom command (and in this case rebinding happens the same since the command is for refreshing the grid) this button is persisted without any addittional code handling. With my custom command intercepted in the ItemCommand event this doesn't happen