Hi,
I have a few questions with regards to filtering in RadGrid.
1)
Is there anyway for me to set these filtering settings by default so that I dun have to type this for every columns?
<telerik:GridBoundColumn DataField="FieldName" HeaderText="1st WS" HeaderStyle-Width="20px"
HeaderTooltip="Something" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
2) When I use CurrentFilterFunction="Contains", how I specify case insensitive matching?
3) Is there anyway to apply the filter without a flicker on the page due to AutoPostBackOnFilter="true" ?
Thanks
I have a few questions with regards to filtering in RadGrid.
1)
Is there anyway for me to set these filtering settings by default so that I dun have to type this for every columns?
<telerik:GridBoundColumn DataField="FieldName" HeaderText="1st WS" HeaderStyle-Width="20px"
HeaderTooltip="Something" AutoPostBackOnFilter="true" CurrentFilterFunction="Contains">
2) When I use CurrentFilterFunction="Contains", how I specify case insensitive matching?
3) Is there anyway to apply the filter without a flicker on the page due to AutoPostBackOnFilter="true" ?
Thanks
11 Answers, 1 is accepted
0

Jayesh Goyani
Top achievements
Rank 2
answered on 16 Jul 2011, 01:49 PM
hi,
1.
as per my knowledge in Radgrid you can not achieve this directly(by skin).
write this function in your global/common file and called this function "SetCurrentFilterforGrid" in your page.
2. for insensitive matching : <GroupingSettings CaseSensitive="false" />
3. Please explain your problem because i am not able to understand this.
let me know if any concern.
Thanks,
Jayesh Goyani
1.
as per my knowledge in Radgrid you can not achieve this directly(by skin).
write this function in your global/common file and called this function "SetCurrentFilterforGrid" in your page.
//// your web page code
........
SetCurrentFilterforGrid(RadGrid1);
........
//// commmon / global class
public
static
void
SetCurrentFilterforGrid(
ref
RadGrid RadGrid1)
{
foreach
(GridColumn column
in
RadGrid1.Columns)
{
column.CurrentFilterFunction = GridKnownFunction.Contains;
}
}
2. for insensitive matching : <GroupingSettings CaseSensitive="false" />
3. Please explain your problem because i am not able to understand this.
let me know if any concern.
Thanks,
Jayesh Goyani
0

STEVEN
Top achievements
Rank 1
answered on 17 Jul 2011, 03:31 AM
Thank you for the quick response.
1)
This is what I have done in the Code Behind
But it doesn't work as expected. I would like the Grid to auto-apply the 'Contain' filter when the user's mouse exits the filter box.
2) This works, insensitive matching : <GroupingSettings CaseSensitive="false" />
3) This is related to (1). How can I avoid a full postback, and only refresh the grid with the filtered data?
1)
This is what I have done in the Code Behind
public partial class MyGrid : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SetCurrentFilterforGrid(ref RadGrid1); } public static void SetCurrentFilterforGrid(ref RadGrid RadGrid1) { foreach (GridColumn column in RadGrid1.Columns) { column.CurrentFilterFunction = GridKnownFunction.Contains; column.AutoPostBackOnFilter = true; } } }
But it doesn't work as expected. I would like the Grid to auto-apply the 'Contain' filter when the user's mouse exits the filter box.
2) This works, insensitive matching : <GroupingSettings CaseSensitive="false" />
3) This is related to (1). How can I avoid a full postback, and only refresh the grid with the filtered data?
0

Jayesh Goyani
Top achievements
Rank 2
answered on 17 Jul 2011, 09:31 AM
Hi,
for stop the full post back use below code.
please elaborate the first case in detail.(Means you want to set some text in filter box and apply contain filter fuction correct ??)
Thanks,
Jayesh Goyani
for stop the full post back use below code.
<
telerik:RadAjaxManager
ID
=
"RadAjaxManager1"
runat
=
"server"
>
<
AjaxSettings
>
<
telerik:AjaxSetting
AjaxControlID
=
"RadGrid1"
>
<
UpdatedControls
>
<
telerik:AjaxUpdatedControl
ControlID
=
"RadGrid1"
/>
</
UpdatedControls
>
</
telerik:AjaxSetting
>
</
AjaxSettings
>
</
telerik:RadAjaxManager
>
please elaborate the first case in detail.(Means you want to set some text in filter box and apply contain filter fuction correct ??)
Thanks,
Jayesh Goyani
0

STEVEN
Top achievements
Rank 1
answered on 17 Jul 2011, 03:56 PM
Hi,
For the first case, you are right.
In addition, I will like the Grid to auto-apply the CONTAIN filter when the mouse leaves the filterbox, so that the user dun have to choose the FILTER function AND dun have to click the filtering button.
I have another question, what is the purpose of EnableAlternatingItems here?
Thanks
For the first case, you are right.
In addition, I will like the Grid to auto-apply the CONTAIN filter when the mouse leaves the filterbox, so that the user dun have to choose the FILTER function AND dun have to click the filtering button.
I have another question, what is the purpose of EnableAlternatingItems here?
<ClientSettings EnableAlternatingItems="true"
Thanks
0
Accepted

Princy
Top achievements
Rank 2
answered on 18 Jul 2011, 05:46 AM
Hello Steven,
The EnableAlternatingItems is for avoiding the Zebra line appearance for the skins which is having different styles for the item and alternating item. For that you need to set this property to false and see the difference.
Hope it helps.
Thanks,
Princy.
The EnableAlternatingItems is for avoiding the Zebra line appearance for the skins which is having different styles for the item and alternating item. For that you need to set this property to false and see the difference.
Hope it helps.
Thanks,
Princy.
0

STEVEN
Top achievements
Rank 1
answered on 19 Jul 2011, 01:33 PM
Hi,
My 1st question is unanswered. How do I go about this?
I will like the Grid to auto-apply the CONTAIN filter when the mouse leaves the filterbox, so that the user dun have to choose the FILTER function AND dun have to click the filtering button.
My 1st question is unanswered. How do I go about this?
I will like the Grid to auto-apply the CONTAIN filter when the mouse leaves the filterbox, so that the user dun have to choose the FILTER function AND dun have to click the filtering button.
0

Princy
Top achievements
Rank 2
answered on 19 Jul 2011, 01:51 PM
Hello Steven,
You can try the same approach in the following help documentation.
Search on Key Press/Button Click.
Thanks,
Princy.
You can try the same approach in the following help documentation.
Search on Key Press/Button Click.
Thanks,
Princy.
0

STEVEN
Top achievements
Rank 1
answered on 26 Jul 2011, 10:21 AM
I am able to get this to work if I explicitly configure the CurrentFilterFunction & AutoPostBackOnFilter for every column in the aspx.
But unable to work when I set it in the code behind. I am looking for a way to configure all our RadGrid behavior with minimum coding/configuration, preferably from a centralized location.
This is the aspx file
THis is the code behind
But unable to work when I set it in the code behind. I am looking for a way to configure all our RadGrid behavior with minimum coding/configuration, preferably from a centralized location.
This is the aspx file
<form id="form1" runat="server"> <telerik:RadScriptManager ID="RadScriptManager1" runat="server"> <Scripts> <%--Needed for JavaScript IntelliSense in VS2010--%> <%--For VS2008 replace RadScriptManager with ScriptManager--%> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js" /> <asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js" /> </Scripts> </telerik:RadScriptManager> <telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" /> <telerik:RadAjaxPanel ID="RadAjaxPanel1" runat="server"> <telerik:RadGrid ID="RadGrid1" runat="server" GridLines="None" AllowSorting="True" PageSize="10" AllowPaging="True" PagerStyle-Position="Bottom" PagerStyle-Mode="NextPrevNumericAndAdvanced" DataSourceID="DataSource1" AllowFilteringByColumn="True"> <GroupingSettings CaseSensitive="false" /> <ClientSettings> <Scrolling AllowScroll="true" FrozenColumnsCount="3" UseStaticHeaders="true" EnableVirtualScrollPaging="true" /> </ClientSettings> <MasterTableView Width="100%" AllowMultiColumnSorting="true" AllowNaturalSort="true"> </MasterTableView> </telerik:RadGrid> <telerik:RadWindowManager ID="RadWindowManager1" runat="server"> </telerik:RadWindowManager> </telerik:RadAjaxPanel> <asp:SqlDataSource SelectCommand="SELECT Customers.* FROM Customers" ConnectionString="<%$ ConnectionStrings:TelerikVSXConnectionString1 %>" ProviderName="System.Data.SqlClient" ID="DataSource1" runat="server"></asp:SqlDataSource> </form>
THis is the code behind
public partial class MyGrid : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { SetCurrentFilterforGrid(this.RadGrid1); } public static void SetCurrentFilterforGrid(RadGrid RadGrid1) { foreach (GridColumn column in RadGrid1.Columns) { column.CurrentFilterFunction = GridKnownFunction.Contains; column.AutoPostBackOnFilter = true; } } }
0
Hi Steven,
Kind regards,
Marin
the Telerik team
From the code sample that you posted it looks like you are using autogenerated columns for the RadGrid. If this is the case you should iterate over the AutoGeneratedColumns collection instead and set the desired properties in a later event after which you should rebind the grid:
protected
void
Page_PreRenderComplete(
object
sender, EventArgs e)
{
foreach
(GridColumn column
in
RadGrid1.MasterTableView.AutoGeneratedColumns)
{
column.CurrentFilterFunction = GridKnownFunction.EqualTo;
column.AutoPostBackOnFilter =
true
;
}
RadGrid1.Rebind();
}
Kind regards,
Marin
the Telerik team
Browse the vast support resources we have to jump start your development with RadControls for ASP.NET AJAX. See how to integrate our AJAX controls seamlessly in SharePoint 2007/2010 visiting our common SharePoint portal.
0

STEVEN
Top achievements
Rank 1
answered on 02 Aug 2011, 10:51 AM
Thanks, I manage to get this working.
2 things to modify to get it working:
1) Use the RadGrid1.MasterTableView.AutoGeneratedColumns 2) Use Page_PreRenderComplete instead of Page_Load. My question is why Page_PreRenderComplete instead of Page_Load?
2 things to modify to get it working:
1) Use the RadGrid1.MasterTableView.AutoGeneratedColumns 2) Use Page_PreRenderComplete instead of Page_Load. My question is why Page_PreRenderComplete instead of Page_Load?
0

Jayesh Goyani
Top achievements
Rank 2
answered on 02 Aug 2011, 11:23 AM