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

set Postback false to GridFilterMenuItem

3 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Avelyn Teh
Top achievements
Rank 1
Avelyn Teh asked on 29 Apr 2011, 05:37 AM
Hi all,

Please help!
Is there any way to disable postback at GridFilterMenuItem ?
I already tried as below but it doesn't work. 
Even Postback value always show 'False' at runtime my grid still postback when I select FilterMenuItem.

<FilterMenu EnableEmbeddedScripts="True" >
  <DataBindings><telerik:RadMenuItemBinding PostBack="false"/>
</DataBindings>
</FilterMenu >
&
Dim menu As GridFilterMenu = RadGrid1.FilterMenu
For Each item As RadMenuItem In menu.Items
    Dim a As String = item.Text
    item.PostBack = False
Next

3 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2011, 06:01 AM
Hello Avelyn,

One suggestion is to ajaxifying RadGrid which will prevent all postbacks.

ASPX:
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
    <AjaxSettings>
        <telerik:AjaxSetting AjaxControlID="RadGrid1">
            <UpdatedControls>
                <telerik:AjaxUpdatedControl ControlID="RadGrid1"  />
            </UpdatedControls>
        </telerik:AjaxSetting>
    </AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadGrid ID="RadGrid1"  runat="server">
    .   .   .   .   .   .  .
</telerik:RadGrid>

Thanks,
Princy.
0
Avelyn Teh
Top achievements
Rank 1
answered on 03 May 2011, 07:23 AM

Hi Princy,

Thank you for your suggestion.
I have already used RadAjaxManager from the begining.

May be I've posted wrong question.
Here is my scenario
The grid will not populate and show result each time when user selected filterfunction from filtermenuitem after they have enter in filterbox.
User may enter more than one columns and select filterfunction for each colum.
After all, user will click command button on <CommandItemTemplate> then just show the result.
Means filtering with multiple columns at just one button click.

Recently the grid populate and show result every time when user select filtermenuitem.

Thanks

0
Iana Tsolova
Telerik team
answered on 06 May 2011, 07:23 AM
Hi Avelyn,

The desired functionality is not supported by RadGrid out of the box. To implement it, you will need do it all manually. For instance, you can cancel the filter command in the OnCommand client-side event to prevent the postback. However, you will need to save in a hidden field which column are to be filtered and what are there filter functions and value. Then when you go to the server, you will need to set the CurrentFilterValue and CurrentFilterFunction for each column and build the RadGrid FilterExpression manually. For more information on how to work woth the filter expression, you can check the below articles:
http://www.telerik.com/help/aspnet-ajax/grid-operate-with-filter-expression-manually.html
http://www.telerik.com/help/aspnet-ajax/grid-applying-default-filter-on-initial-load.html

Therefore I would suggest that you use RadFilter with your RadGrid. RadFilter allows you to build  complex filter expression and then apply them on a single button click. Check out this demo to see how easy it is.

Another option is to use RadListView instead of RadGrid. Because the RadListView server API allows you to add multiple FilterExpressions at once. Find the below resources for a reference:
http://demos.telerik.com/aspnet-ajax/listview/examples/filtering/defaultcs.aspx
http://www.telerik.com/help/aspnet-ajax/listview-filterexpressions.html

I hope this helps.

All the best,
Iana
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.

Tags
Grid
Asked by
Avelyn Teh
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Avelyn Teh
Top achievements
Rank 1
Iana Tsolova
Telerik team
Share this question
or