Filter from RadGrid RadComboBox not working

3 posts, 0 answers
  1. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 01 Sep 2010 Link to this post

    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. Pavlina
    Admin
    Pavlina avatar
    6084 posts

    Posted 01 Sep 2010 Link to this post

    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
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Eric Klein
    Eric Klein avatar
    183 posts
    Member since:
    Aug 2009

    Posted 01 Sep 2010 Link to this post

    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.
Back to Top