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

Filter from RadGrid RadComboBox not working

2 Answers 93 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Eric Klein
Top achievements
Rank 1
Eric Klein asked on 01 Sep 2010, 03:09 PM
I have a radgrid on my page
<telerik:RadGrid ID="RadGrid1" runat="server" Skin="Office2007" AllowPaging="True"
                            PageSize="25" AutoGenerateColumns="False" GridLines="None" AllowSorting="True"
                            AllowFilteringByColumn="true" AlternatingItemStyle-BackColor="#eeeeee" ShowGroupPanel="True"
                            ShowStatusBar="True" OnNeedDataSource="RadGrid1_NeedDataSource" OnItemCommand="RadGrid1_ItemCommand"
                            OnPageIndexChanged="RadGrid1_PageIndexChanged" OnPageSizeChanged="RadGrid1_PageSizeChanged"
                            OnItemCreated="RadGrid1_ItemCreated" OnPreRender="RadGrid1_PreRender" Width="100%" >
                            <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
                            <MasterTableView DataKeyNames="ExcelImportID" PagerStyle-Mode="NextPrevNumericAndAdvanced" AllowFilteringByColumn="True">
                                <AlternatingItemStyle BackColor="#EEEEEE"></AlternatingItemStyle>
                                <RowIndicatorColumn>
                                    <HeaderStyle Width="20px"></HeaderStyle>
                                </RowIndicatorColumn>
                                <Columns>
                                    <telerik:GridBoundColumn SortExpression="ClientName" DataField="ClientName" HeaderText="Client Name"
                                        HeaderStyle-Width="300px">
                                        <FilterTemplate>
                                            <telerik:RadComboBox ID="RadComboBoxClientName" DataTextField="ClientName" DataValueField="ClientName"
                                                AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("ClientName").CurrentFilterValue %>'
                                                runat="server" Skin="Office2007" AutoPostBack="true" OnSelectedIndexChanged="ClientCombo_SelectedIndexChanged" />
                                        </FilterTemplate>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn SortExpression="BankName" DataField="BankName" HeaderText="Bank Name"
                                        HeaderStyle-Width="300px">
                                        <FilterTemplate>
                                            <telerik:RadComboBox ID="RadComboBoxBankName" DataTextField="BankName" DataValueField="BankName"
                                                AppendDataBoundItems="true" SelectedValue='<%# ((GridItem)Container).OwnerTableView.GetColumn("BankName").CurrentFilterValue %>'
                                                runat="server" Skin="Office2007"  AutoPostBack="true" OnSelectedIndexChanged="BankCombo_SelectedIndexChanged" />
                                        </FilterTemplate>
                                    </telerik:GridBoundColumn>
                                    <telerik:GridBoundColumn DataField="ExcelFile" HeaderText="Excel File Name" SortExpression="ExcelFile"
                                        HeaderStyle-Width="300px" UniqueName="ExcelFile" Visible="True" />
                                    <telerik:GridBoundColumn DataField="ImportBy" HeaderText="Imported By" SortExpression="ImportBy"
                                        UniqueName="ImportBy" Visible="True" />
                                    <telerik:GridBoundColumn DataField="ImportDate" HeaderText="ImportDate" SortExpression="ImportDate"
                                        UniqueName="ImportDate" Visible="True" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" />
                                    <telerik:GridBoundColumn DataField="ProcessedBy" HeaderText="Processed By" SortExpression="Error"
                                        UniqueName="ProcessedBy" Visible="True" />
                                    <telerik:GridBoundColumn DataField="ProcessedDate" HeaderText="Processed Date" SortExpression="Processed Date"
                                        UniqueName="ProcessedDate" Visible="True" DataType="System.DateTime" DataFormatString="{0:MM/dd/yyyy}" />
                                </Columns>
                                <PagerStyle Mode="NextPrevNumericAndAdvanced"></PagerStyle>
                            </MasterTableView>
                            <ClientSettings AllowDragToGroup="True">
                            </ClientSettings>
                        </telerik:RadGrid>

and in the code behind I have

protected void BankCombo_SelectedIndexChanged(object o, RadComboBoxSelectedIndexChangedEventArgs e)
      {
          string filterExpression;
          filterExpression = "([BankName] = '" + e.Value + "')";
          RadGrid1.MasterTableView.FilterExpression = filterExpression;
          RadGrid1.MasterTableView.Rebind();
    }

but when I run I get the erroe Expression expected on the Rebind().  What is wrong?

2 Answers, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 01 Sep 2010, 03:39 PM
Hi Eric,

Try setting RadGrid EnableLinqExpressions property to false and let me know if it helps to eliminate the error message.

All the best,
Pavlina
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
Eric Klein
Top achievements
Rank 1
answered on 01 Sep 2010, 03:42 PM
Thank you that was it.  I was  going over the settings and just missed that one.  As soon as I saw your post I knew it was the issue.  Thanks again.
Tags
Grid
Asked by
Eric Klein
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Eric Klein
Top achievements
Rank 1
Share this question
or