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

[Solved] GridDropDownColumn - specific Filter Field

2 Answers 165 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Tauz
Top achievements
Rank 1
Tauz asked on 05 Mar 2010, 05:16 AM
Hi,

I'm using your griddropdowncolumn very nicelly, but realized there's a problem with the filtered field it uses by default.
Facts:
  • have 2 tables related in grid
  • one table named Table  with these columns IDTable, TableDesc, IDForeign
  • my foreign table is called Foreign and has IDForeign and ForeignDesc columns
  • columns in Grid are: TableDesc (GridBoundColumn) and ForeignDesc(GridDropDownColumn)
  • grid alows filtering
  • Filter works fine in column TableDesc but NOT in ForeignDesc

If you insert data in both tables and try to filter by any content in the ForeignDesc column it doesn't return anything, it only works if you use the IDForeign content in the filter. It should be possible to use the ForeignDesc content for filtering the data, no?
What am I doing wrong? Here's what I have.
 

<telerik:RadGrid ID="rdTableForeign" runat="server" DataSourceID="sdsTable" AllowPaging="True" 
        ShowFooter="True" AutoGenerateColumns="False" AllowSorting="True" EnableViewState="true" 
        AllowFilteringByColumn="True" AllowAutomaticInserts="False" AllowAutomaticUpdates="True">  
        <GroupingSettings CaseSensitive="false" /> 
        <MasterTableView DataKeyNames="IDTable" AutoGenerateColumns="false" AllowMultiColumnSorting="True" 
            EnableViewState="true" EnableColumnsViewState="true">  
            <PagerStyle Mode="NextPrevNumericAndAdvanced" AlwaysVisible="true" /> 
            <Columns> 
                <telerik:GridEditCommandColumn UniqueName="EditCommandColumn" HeaderText="Edit" ButtonType="ImageButton">  
                    <ItemStyle Width="50px" /> 
                </telerik:GridEditCommandColumn> 
                <telerik:GridBoundColumn DataField="TableDesc" HeaderText="Description" UniqueName="TableDesc" DataType="System.String">  
                </telerik:GridBoundColumn> 
                <telerik:GridDropDownColumn DataSourceID="dsForeign" ListTextField="ForeignDesc" 
                    AllowFiltering="true" ListValueField="IDForeign" UniqueName="GridDropDownColumn" 
                    SortExpression="ForeignDesc" HeaderText="Foreign" DropDownControlType="RadComboBox" 
                    DataField="IDForeign" DataType="System.String">  
                </telerik:GridDropDownColumn> 
            </Columns> 
            <EditFormSettings> 
                <EditColumn ButtonType="ImageButton" /> 
            </EditFormSettings> 
        </MasterTableView> 
        <ClientSettings> 
            <Resizing AllowColumnResize="true" /> 
        </ClientSettings> 
    </telerik:RadGrid> 
    <asp:SqlDataSource ID="sdsTable" ConnectionString="<%$ ConnectionStrings:MyConnection %>" 
        SelectCommand="SELECT * FROM [Table]" runat="server" UpdateCommand="wcspTableUpdate" 
        UpdateCommandType="StoredProcedure">  
        <UpdateParameters> 
            <asp:Parameter Name="IDTable" Type="Int32" /> 
            <asp:Parameter Name="TableDesc" Type="Int32" /> 
        </UpdateParameters> 
    </asp:SqlDataSource> 
    <asp:SqlDataSource runat="server" ID="dsForeign" ConnectionString="<%$ ConnectionStrings:MyConnection %>" 
        SelectCommand="SELECT [IDForeign], [ForeignDesc] FROM [Foreign]"></asp:SqlDataSource> 

 

 

 

Thanks for any help!

Tauz

2 Answers, 1 is accepted

Sort by
0
Accepted
Yavor
Telerik team
answered on 10 Mar 2010, 08:32 AM
Hello Tauz,

The filtering of the control is performed based on the underlying datasource. If a field is not in the datasource of the grid, one cannot filter on it. One possible option would be to use a join, when constructing the datasource of the grid, and pass the resulting data to the grid control. In this way, you will be able to filter on all the fields.
I hope this information helps.

Regards,
Yavor
the Telerik team

Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
0
Tauz
Top achievements
Rank 1
answered on 13 Mar 2010, 09:27 PM
Hi,
thanks for you response. I thought that maybe i was doing something wrong or there will be something missing.

best regards,
Tauz
Tags
Grid
Asked by
Tauz
Top achievements
Rank 1
Answers by
Yavor
Telerik team
Tauz
Top achievements
Rank 1
Share this question
or