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

Grid Filtering option not working

1 Answer 120 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Santanu
Top achievements
Rank 1
Santanu asked on 28 Dec 2014, 05:10 PM
Hi 

I am trying to enable basic filtering option in Radgrid but the filtering option is not working. The text-box for filter is coming up but while clicking the filter button the context menu is not coming and the filter is also not working . The grid and the SQL Datasource is given bellow. Other function of the grid is working.

<telerik:RadGrid ID="RadGrid3" runat="server" AllowAutomaticDeletes="True" 
                            AllowAutomaticInserts="True" AllowAutomaticUpdates="True" EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true"
                            DataSourceID="SqlMenuGrp" GridLines="None" AllowFilteringByColumn="true" AllowSorting="True" AllowPaging="true" PageSize="30" 
                            AutoGenerateColumns="False" Width="800" Skin="Outlook" >
                  
                        <MasterTableView DataSourceID="SqlMenuGrp" EnableHeaderContextMenu="true" AllowFilteringByColumn="true" CommandItemDisplay="TopAndBottom" 
                         AutoGenerateColumns="False" DataKeyNames="Menu_Txn_ID">
                         <EditFormSettings>
                                        <EditColumn CancelImageUrl="../image/RadControls/Grid/Skins/Default/Cancel.gif" EditImageUrl="../image/RadControls/Grid/Skins/Default/Edit.gif"
                                            InsertImageUrl="../image/RadControls/Grid/Skins/Default/Insert.gif" UniqueName="EditCommandColumn"
                                            UpdateImageUrl="../image/RadControls/Grid/Skins/Default/Update.gif">
                                        </EditColumn>
                                    </EditFormSettings>
                          
                            <Columns>
                                <telerik:GridEditCommandColumn  ButtonType="ImageButton" UniqueName="EditCommandColumn">
                                </telerik:GridEditCommandColumn>
                                <telerik:GridBoundColumn DataField="Menu_Txn_ID" DataType="System.Int32" ReadOnly="True" UniqueName="Menu_Txn_ID" Visible="false" ></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Menu_Ref_Name" HeaderText="Menu Ref Name" UniqueName="Menu_Ref_Name" CurrentFilterFunction="Contains" AutoPostBackOnFilter="true" ShowFilterIcon="false"></telerik:GridBoundColumn>
                                <telerik:GridBoundColumn DataField="Menu_Ref_ID" HeaderText="Menu Ref ID" UniqueName="Menu_Ref_ID"></telerik:GridBoundColumn>
                                <telerik:GridDropDownColumn DataSourceID="SqlMenuDetails" SortExpression="Menu_ID" ListTextField="Menu_Text" ListValueField="Menu_ID" UniqueName="Menu_ID" DataField="Menu_ID" DropDownControlType="DropDownList" HeaderText="Menu Name"></telerik:GridDropDownColumn>
                                

                            </Columns>
                            <EditFormSettings ColumnNumber="2" CaptionDataField="Menu_Ref_Name" CaptionFormatString="Edit <h6> {0} </h6>">
                                <FormTableItemStyle Wrap="False"></FormTableItemStyle>
                                <FormMainTableStyle GridLines="None" CellSpacing="0" CellPadding="3" BackColor="White" Width="100%" />
                                <FormTableStyle CellSpacing="0" CellPadding="2" Height="80px" BackColor="White" />
                                <FormTableAlternatingItemStyle Wrap="False"></FormTableAlternatingItemStyle>
                                <EditColumn ButtonType="ImageButton" InsertText="Insert" UpdateText="Update record"
                                            UniqueName="EditCommandColumn1" CancelText="Cancel edit">
                                 </EditColumn>
                                 <FormTableButtonRowStyle HorizontalAlign="Right"></FormTableButtonRowStyle>
                            </EditFormSettings>
            
                        </MasterTableView>
                        <ClientSettings>
                                <ClientEvents OnRowDblClick="RowDblClick" />
                        </ClientSettings>

                    </telerik:RadGrid>
                 </div>
            </div>

            <asp:SqlDataSource ID="SqlMenuGrp" runat="server" 
                    ConnectionString="<%$ ConnectionStrings:ConStr %>" 
                    SelectCommand="Select * from UR_Txn_Menu_User_Group ORDER BY Menu_Ref_Name"  
                    UpdateCommand="UPDATE UR_Txn_Menu_User_Group SET [Menu_ID] = @Menu_ID, [Menu_Ref_ID] = @Menu_Ref_ID, Menu_Ref_Name = @Menu_Ref_Name WHERE Menu_Txn_ID = @Original_Menu_Txn_ID"
                    InsertCommand="INSERT INTO [UR_Txn_Menu_User_Group] ([Menu_ID],[Menu_Ref_ID],[Menu_Ref_Name]) VALUES ( @Menu_ID,Menu_Ref_ID, UPPER(@Menu_Ref_Name))"
                     DeleteCommand="UPDATE UR_Txn_Menu_User_Group WHERE Menu_Txn_ID = @Original_Menu_Txn_ID"
                  OldValuesParameterFormatString="original_{0}" ConflictDetection="CompareAllValues">
                    <UpdateParameters>
                        <asp:Parameter Name="Original_Menu_Txn_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_Ref_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_Ref_Name" Type="String" />
                     
                    </UpdateParameters>
                    <InsertParameters>
                        <asp:Parameter Name="Original_Menu_Txn_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_Ref_ID" Type="Int32" />
                        <asp:Parameter Name="Menu_Ref_Name" Type="String" />
                   
                    </InsertParameters>
                  <DeleteParameters>
                        <asp:Parameter Name="Original_Menu_Txn_ID" Type="Int32" />
                    </DeleteParameters>
                 </asp:SqlDataSource>

                <asp:SqlDataSource ID="SqlMenuDetails" runat="server"
                 ConnectionString="<%$ ConnectionStrings:ConStr %>" 
                    SelectCommand="Select * from UR_Menu_Details WHERE Is_Enabled ='Y'" >
                </asp:SqlDataSource>

1 Answer, 1 is accepted

Sort by
0
Konstantin Dikov
Telerik team
answered on 29 Dec 2014, 09:06 AM
Hello Santanu,

I have tested your RadGrid settings and everything is working correctly on my end.

Can you please elaborate if the problem that you are referring to appears for all columns or just for a particular one. Additionally, please inspect your browser's console and see if there are any JavaScript errors that could prevent the proper work of the controls.

Here is the example that I have tested (with removed DropDownColumn):
<telerik:RadGrid ID="RadGrid3" runat="server" AllowAutomaticDeletes="True" OnNeedDataSource="RadGrid1_NeedDataSource"
    AllowAutomaticInserts="True" AllowAutomaticUpdates="True" EnableHeaderContextMenu="true" EnableHeaderContextFilterMenu="true"
    GridLines="None" AllowFilteringByColumn="true" AllowSorting="True" AllowPaging="true" PageSize="30"
    AutoGenerateColumns="False" Width="800" Skin="Outlook">
    <MasterTableView EnableHeaderContextMenu="true" AllowFilteringByColumn="true" CommandItemDisplay="TopAndBottom"
        AutoGenerateColumns="False" DataKeyNames="Menu_Txn_ID">
        <Columns>
            <telerik:GridEditCommandColumn ButtonType="ImageButton" UniqueName="EditCommandColumn">
            </telerik:GridEditCommandColumn>
            <telerik:GridBoundColumn DataField="Menu_Txn_ID" DataType="System.Int32" ReadOnly="True" UniqueName="Menu_Txn_ID" Visible="false"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Menu_Ref_Name" HeaderText="Menu Ref Name" UniqueName="Menu_Ref_Name" CurrentFilterFunction="Contains"
                AutoPostBackOnFilter="true" ShowFilterIcon="false"></telerik:GridBoundColumn>
            <telerik:GridBoundColumn DataField="Menu_Ref_ID" HeaderText="Menu Ref ID" UniqueName="Menu_Ref_ID"></telerik:GridBoundColumn>
            <%--<telerik:GridDropDownColumn DataSourceID="SqlMenuDetails" SortExpression="Menu_ID"
                ListTextField="Menu_Text" ListValueField="Menu_ID" UniqueName="Menu_ID" DataField="Menu_ID" DropDownControlType="DropDownList"
                HeaderText="Menu Name"></telerik:GridDropDownColumn>--%>
        </Columns>
    </MasterTableView>
</telerik:RadGrid>

And the code-behind:
protected void RadGrid1_NeedDataSource(object sender, GridNeedDataSourceEventArgs e)
{
    DataTable table = new DataTable();
    table.Columns.Add("Menu_Txn_ID", typeof(int));
    table.Columns.Add("Menu_Ref_Name", typeof(string));
    table.Columns.Add("Menu_Ref_ID", typeof(int));
    for (int i = 1; i < 5; i++)
    {
        table.Rows.Add(i, "ref name" + i, i);
    }
 
    (sender as RadGrid).DataSource = table;
}



Regards,
Konstantin Dikov
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
Grid
Asked by
Santanu
Top achievements
Rank 1
Answers by
Konstantin Dikov
Telerik team
Share this question
or