i am using RadGrid with Filter option. and also having a commanditem checkbox which controls Hide/Show of FilterItem.
For example if checkbox is checked then filteritem will be visible otherwise will be invisible.i am controlling it using this javascript code.
function showFilterItem(val)
{
try
{
var picker = $find("ctl00_ContentPlaceHolder1_User_RadGrid_ctl00_ctl02_ctl00_chkViewFilter");
if (val.checked)
{
$find(
'ctl00_ContentPlaceHolder1_User_RadGrid').get_masterTableView().showFilterItem();
document.getElementById(
"ctl00_ContentPlaceHolder1_HiddenField8").value=1;
}
else
{
$find(
'ctl00_ContentPlaceHolder1_User_RadGrid').get_masterTableView().hideFilterItem();
document.getElementById(
"ctl00_ContentPlaceHolder1_HiddenField8").value=0;
}
}
catch(ex)
{
}
}
<CommandItemTemplate>
<table cellpadding="0" cellspacing="0" border="0" width="920px" align="center">
<tr>
<td width="675px" align="left" style="padding-right: 15px">
<asp:CheckBox ID="chkViewFilter" runat="server" Checked="false" onclick="showFilterItem(this)" />
<asp:Label ID="Label4" runat="server" Text="Show Filter"></asp:Label>
</td>
</
tr>
</table>
</CommandItemTemplate>
It is working fine. but my requirement is that In starting/Page_Load i want to hide the FilterItem. and this filteritem will be visible only when that checkbox will be checked.
if i try to make FilterItem visible false using this serverside code then i am unable to make this filteritem visible again using above javascript code.
if (!IsPostBack)
{
foreach (GridFilteringItem filterItem in User_RadGrid.MasterTableView.GetItems(GridItemType.FilteringItem))
{
filterItem.Visible =
false;
}
}
so please guide me how to achieve my result.
Thanks a lot in advance.
Binod.