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

Filter by unique name - not by Datafield/Displayname does not work

2 Answers 71 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Thomas
Top achievements
Rank 1
Thomas asked on 05 Jan 2011, 04:07 PM
Hello,
I am trying to filter a column in a radgrid with a custom filter template, based on the id´s of the objects and not the display names (in some cases we have entries with the name / display name)

My Code is:
<telerik:GridBoundColumn AllowFiltering="true" AllowSorting="true" DataField="Accountrole.Name"
                    HeaderText="<%$ Resources:Administration,Role %>" UniqueName="Accountrole.RoleId">
                    <FilterTemplate>
                        <telerik:RadComboBox ID="RadComboBoxRole" DataSourceID="RoleDataSource" DataTextField="Name"
                            DataValueField="RoleId" AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("Accountrole.RoleId").CurrentFilterValue %>'
                            runat="server" OnClientSelectedIndexChanged="RoleIndexChanged">
                            <Items>
                                <telerik:RadComboBoxItem Text="<%$ Resources:Basic,All %>" />
                            </Items>
                        </telerik:RadComboBox>
                        <telerik:RadScriptBlock ID="RadScriptBlock1" runat="server">
                            <script type="text/javascript">
                                function RoleIndexChanged(sender, args) {
                                    var tableView = $find("<%# ((GridItem)Container).OwnerTableView.ClientID %>");
                                    tableView.filter("Accountrole.RoleId", args.get_item().get_value(), "EqualTo");
                                }
                            </script>
                        </telerik:RadScriptBlock>
                    </FilterTemplate>
                </telerik:GridBoundColumn>

Unfortunately the filtering does not work because my entity data source get athe following filterexpression from the grid (seen in debug mode):
RadGrid1.MasterTableView.FilterExpression  = "(it.Accountrole.Name = \"1\")" 
but it should be:
RadGrid1.MasterTableView.FilterExpression  = "(it.Accountrole.RoleId= \"1\")"

How can I tell the Grid to generate the correct filter expression?

Thanks in advance!

2 Answers, 1 is accepted

Sort by
0
Maria Ilieva
Telerik team
answered on 10 Jan 2011, 12:19 PM
Hello Thomas,

Please review the answer provided in the official support ticket you have with us. Let me know if it helps and if further help is needed.


Best wishes,
Maria Ilieva
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
Maria Ilieva
Telerik team
answered on 10 Jan 2011, 12:19 PM
Hello Thomas,

Please review the answer provided in the official support ticket you have with us. Let me know if it helps and if further help is needed.


Best wishes,
Maria Ilieva
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
Thomas
Top achievements
Rank 1
Answers by
Maria Ilieva
Telerik team
Share this question
or