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

Filter context menu not required on RadGrid

6 Answers 260 Views
Grid
This is a migrated thread and some comments may be shown as answers.
kdyeqb
Top achievements
Rank 1
kdyeqb asked on 27 Mar 2012, 09:02 AM
Hi
I have a RadGrid with filter on two columns.When I click Filter Icon a context menu with the filter options opens up.But i do not wish to have this context menu.What I would like to have is , whenever I click on the icon the default "Contains" filter function should work without the opening of context menu.
I had gone through the demos on your website,it doesn't tell how to hide this context menu.

Please help.

Thanks

6 Answers, 1 is accepted

Sort by
0
Shinu
Top achievements
Rank 2
answered on 27 Mar 2012, 11:25 AM
Hi,

In order to remove HeaderContextMenu of filter you can clear all the FilterMenu options in Radgrid like below. Also you can set CurrentFilterFunction  and AutoPostBackOnFilter property for column to perform a particular filter operation.

Aspx:
<telerik:RadGrid ID="RadGrid2" DataSourceID="SqlDataSource1" AutoGenerateColumns="false"
            AllowFilteringByColumn="True" runat="server">
            <MasterTableView>
                <Columns>
                      <telerik:GridBoundColumn DataField="ShipName" HeaderText="ShipName" UniqueName="ShipName"
                        DataType="System.String" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true">
                    </telerik:GridBoundColumn>
                </Columns>
            </MasterTableView>
</telerik:RadGrid>

C#:
protected void Page_Load(object sender, EventArgs e)
{
 RadGrid2.FilterMenu.Items.Clear();
}

Thanks,
-Shinu.
0
kdyeqb
Top achievements
Rank 1
answered on 28 Mar 2012, 06:29 AM
Hi
Thanks for your help.

Is it necessary to keep AutopostBackOnfilter property to true?What if I would llike to make it with this property to false.

Thanks
0
Shinu
Top achievements
Rank 2
answered on 28 Mar 2012, 07:47 AM
Hi,

If you set AutoPostBackOnFilter property of a column to True, the user does not need to press the filter button to initiate filtering. Instead, a postback filter operation occurs when the user types a filter in the filter box and presses [Enter] from the keyboard.

When AutoPostBackOnFilter is True, the column assumes a filter operation of Contains for string types or EqualTo for numeric types.

This is the logic I have used and please have a look into this documentation I refered.

Thanks,
-Shinu.
0
kdyeqb
Top achievements
Rank 1
answered on 28 Mar 2012, 12:03 PM
Hi
Also  one thing I would like to ask;I am not able to see "No child records to display" when the filtered result is zero.After performing filter operation,no msg appears .How I can get this msg?

Thanks
0
Shinu
Top achievements
Rank 2
answered on 29 Mar 2012, 08:44 AM
Hi,

I guess you are using the filter in hierarchical RadGrid, Any way I tried filtering in a hierarchical RadGrid and I am getting the msg 'No child records to display" when there is no filtered output. Please make sure that you are not giving like NoDetailRecordsText=" " in the GridTableView. Please take a look into the sample code snippet I tried.

ASPX:
<telerik:RadGrid ID="RadGrid1" DataSourceID="SqlDataSource1" runat="server" AutoGenerateColumns="False" AllowFilteringByColumn="true" >
            <MasterTableView  Name="Master"  ClientDataKeyNames="CustomerID" DataSourceID="SqlDataSource1" DataKeyNames="CustomerID"
 
CommandItemDisplay="Top">
                <DetailTables>
                    <telerik:GridTableView   Name="GridTableView1" DataKeyNames="OrderID" DataSourceID="SqlDataSource2"
                        runat="server" CommandItemDisplay="Top" >
                        <ParentTableRelation>
                            <telerik:GridRelationFields DetailKeyField="CustomerID" MasterKeyField="CustomerID" />
                        </ParentTableRelation>            
                        <Columns>
                            <telerik:GridBoundColumn SortExpression="OrderID" HeaderText="OrderID" HeaderButtonType="TextButton"
                                DataField="OrderID" UniqueName="OrderID"  AutoPostBackOnFilter="true">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="OrderDate" HeaderText="Date Ordered" HeaderButtonType="TextButton"
                                DataField="OrderDate" UniqueName="OrderDate">
                            </telerik:GridBoundColumn>
                            <telerik:GridBoundColumn SortExpression="EmployeeID" HeaderText="EmployeeID" HeaderButtonType="TextButton"
                                DataField="EmployeeID" UniqueName="EmployeeID">
                            </telerik:GridBoundColumn>                             
                        </Columns>
                    </telerik:GridTableView>
                </DetailTables>
                <Columns>
                    <telerik:GridBoundColumn  SortExpression="CustomerID" HeaderText="CustomerID" HeaderButtonType="TextButton"
                        DataField="CustomerID" UniqueName="CustomerID">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="ContactName" HeaderText="Contact Name" HeaderButtonType="TextButton"
                        DataField="ContactName" UniqueName="ContactName">
                    </telerik:GridBoundColumn>
                    <telerik:GridBoundColumn SortExpression="CompanyName" HeaderText="Company" HeaderButtonType="TextButton"
                        DataField="CompanyName" UniqueName="CompanyName">
                    </telerik:GridBoundColumn>   
                </Columns>
          </MasterTableView>
</telerik:RadGrid>

C#:
public void Page_Load(object sender, EventArgs e)
{
    RadGrid1.FilterMenu.Items.Clear();
}

Please provide the complete code for further assistance.

Thanks,
Shinu.


0
kdyeqb
Top achievements
Rank 1
answered on 05 Apr 2012, 09:00 AM
Hi
When I go for a standalone application "No Child records to display" message appears & it works fine.
But as when I merge it into my application the same thing doesn't work.I am still unable to see this no record message.
I have not set any property of "NoDetailRecordsText" in my code.

Please suggest

Thanks
Tags
Grid
Asked by
kdyeqb
Top achievements
Rank 1
Answers by
Shinu
Top achievements
Rank 2
kdyeqb
Top achievements
Rank 1
Share this question
or