This is a migrated thread and some comments may be shown as answers.

Issue with FIlterExpression of RadGrid using toggle button in FIlter template

3 Answers 27 Views
Ajax
This is a migrated thread and some comments may be shown as answers.
Ruchi
Top achievements
Rank 1
Ruchi asked on 31 Jul 2014, 09:57 AM
Hello Team,

I am working on Web Application. used FIlterTemplate in GridBoundColumn of RadGrid.

Placed RadButton in Filter template with Toggle type : "CustomToggle" and ButtonType : "ToggleButton".

In preRender Event of Radgrid, I found grid.mastertableview.FIlterExpression is Empty.

Please find below Script used OnClientToggleStateChanged :

<telerik:RadScriptBlock ID="RadScriptBlock2" runat="server">
<script type="text/javascript">
function ToggleStateChanged(sender, args) {
var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
if (args._currentToggleState._attributes.text == "All") {
  tableView.get_filterExpressions().clear();
}
else {
   tableView.filter("UserName", "<%= Context.User.Identity.GetUserName() %>", "EqualTo");                                                                                }
}
</script>
</telerik:RadScriptBlock>  

Can anyone help me out? stuck with a simple filter functionality.

Thanks and Regards,
Ruchi Patel







3 Answers, 1 is accepted

Sort by
0
Eyup
Telerik team
answered on 05 Aug 2014, 07:52 AM
Hi Ruchi,

To achieve this behavior, you can filter the column with empty value or NoFilter function as demonstrated in this live sample:
http://demos.telerik.com/aspnet-ajax/grid/examples/functionality/filtering/filter-templates/defaultcs.aspx

Hope this helps.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
0
Ruchi
Top achievements
Rank 1
answered on 05 Aug 2014, 08:28 AM
Hello Eyup,

Thank you for the reply.

I tried the same as well. but on code behind i didn't get the Filter expression.

as mentioned in example you send:
  protected void RadGrid1_PreRender(object sender, System.EventArgs e)       
{           
if (RadGrid1.MasterTableView.FilterExpression != string.Empty)           
{               
RefreshCombos();           
}       
}       
protected void RefreshCombos()      
 {           
SqlDataSource2.SelectCommand = SqlDataSource2.SelectCommand + " WHERE " + RadGrid1.MasterTableView.FilterExpression.ToString();           
}

getting "RadGrid1.MasterTableView.FilterExpression" as Empty.

Thanks and Regards,
Ruchi Patel
0
Eyup
Telerik team
answered on 08 Aug 2014, 08:49 AM
Hello Ruchi,

Can you please send us sample screenshots or video demonstrating your initial request and the exact desired behavior? Thus, we will be able to figure out your specific requirement and send a sample web site to demonstrate how you can achieve it.

Regards,
Eyup
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Ajax
Asked by
Ruchi
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Ruchi
Top achievements
Rank 1
Share this question
or