I've implemented a grid with toolbar and a filtering option. I'd like to turn the grids filter on and off when clicking the toolbar button "Filter".
Here is the aspx code and the JS function being called on client click. Most of it is from the forum or the documentation:
And I have some code handling other button clicks in VB.
My problem is that tbButton.get_checked() always returns true. No matter what the current state is. I assume that there is a second request setting it back... Any ideas how to solve it? Or what exactly the problem is?
Thanks a lot in advance.
Here is the aspx code and the JS function being called on client click. Most of it is from the forum or the documentation:
<
telerik:RadToolBar
runat
=
"server"
ID
=
"RadToolBar1"
OnClientButtonClicked
=
"onButtonClicked"
EnableViewState
=
"False"
ResolvedRenderMode
=
"Classic"
SingleClick
=
"none"
>
<
Items
>
<
telerik:RadToolBarButton
Text
=
"Open"
ImageUrl
=
"~/Images/reply.gif"
CommandName
=
"openMail"
/>
<
telerik:RadToolBarButton
IsSeparator
=
"true"
/>
<
telerik:RadToolBarButton
CommandName
=
"showFilter"
Text
=
"Filter"
CheckOnClick
=
"True"
>
</
telerik:RadToolBarButton
>
</
Items
>
</
telerik:RadToolBar
>
function
onButtonClicked(sender, args) {
var
commandName = args.get_item().get_commandName();
if
(commandName ==
"showFilter"
) {
if
(tbButton.get_checked()) {
alert(
"checked"
)
$find(
'<%=RadGrid1.ClientID %>'
).get_masterTableView().hideFilterItem();
}
else
{
alert(
"unchecked"
)
$find(
'<%=RadGrid1.ClientID %>'
).get_masterTableView().showFilterItem();
}
}
}
And I have some code handling other button clicks in VB.
Private
Sub
RadToolBar1_ButtonClick(sender
As
Object
, e
As
Telerik.Web.UI.RadToolBarEventArgs)
Handles
RadToolBar1.ButtonClick
Dim
tbBtn
As
RadToolBarButton = TryCast(e.Item, RadToolBarButton)
Select
Case
tbBtn.CommandName.ToLower
Case
"openmail"
OnMessageListSelectionChanged(displayedID,
True
,
False
)
End
Select
End
Sub
My problem is that tbButton.get_checked() always returns true. No matter what the current state is. I assume that there is a second request setting it back... Any ideas how to solve it? Or what exactly the problem is?
Thanks a lot in advance.