title: RadGrid.AllowFilteringByColumn="true" causes "Expected ')'" page error
body: <p>My RadGrid was working fine when loading a datasource before I set AllowFilterByColumn="true" on it. Now I get a pop-up with a page error "Expected ')'". I try to debug the page but it doesn't break on the error, so I'm assuming it's being raised in one of the Telerik js files.</p>
  
  <p>Per the suggestions of users on the Telerik forums, I've tried checking the FilterExpression value on the MasterTableView at various points in the page lifecycle, but is always an empty string.</p>
  
  <p>Any idea what's going on here?</p>
  
  <pre><code>protected void Page_Init(object sender, EventArgs e)
  {
      HydrateSession();
      _site = new Site(sessionData, sessionData.SiteID);
  
      string participantAlias = GetParticipantAliasSetting();
      CreateDismissedCheckbox(ParticipantGrid, participantAlias);
      lblHeader.InnerText = SetHeaderText(participantAlias);
      lbtnAddNew.Visible = !IsFormSearch;
      lbtnAddNew.Text = String.Format(lbtnAddNew.Text, participantAlias);
      lblAllParticipants.Text = String.Format(lblAllParticipants.Text, participantAlias);
  
      ParticipantGrid.Visible = false;
      ParticipantGrid.ItemDataBound += new GridItemEventHandler(ParticipantGrid_ItemDataBound);
      ParticipantGrid.NeedDataSource += new GridNeedDataSourceEventHandler(ParticipantGrid_NeedDataSource);
  }
  
  protected void Page_Load(object sender, EventArgs e)
  {
      if (IsPostBack)
      {
          ParticipantGrid.Visible = true;
      }
  }
  
  protected void lbtnSearch_OnClick(object sender, EventArgs e)
  {
      ParticipantGrid.MasterTableView.Columns.Clear();
      CreateStandardColumns(ParticipantGrid.MasterTableView);
      DataTable searchResults = ClientData.ViewEditParticipantSearch(sessionData, GetSearchString(), IncludeDismissed);
      CreateCustomColumns(ParticipantGrid.MasterTableView, searchResults);
      ParticipantGrid.DataSource = searchResults;
      ParticipantGrid.DataBind();
  }
  
  protected void ParticipantGrid_ItemDataBound(object sender, GridItemEventArgs e)
  {
      if (e.Item is GridDataItem)
      {
          GridDataItem item = (GridDataItem)e.Item;
          foreach (GridColumn column in item.OwnerTableView.Columns)
          {
              if (column.UniqueName == "SSN")
              {
                  MaskSSNFields(item);
              }
  
              FormatDateColumn(item, column.UniqueName);
              EmboldenSearchText(item, column.UniqueName, GetSearchString());
          }
      }
      else if (e.Item is GridCommandItem)
      {
          //we need to make sure we reset the checkbox to whatever was last checked based off of viewstate
          GridCommandItem item = (GridCommandItem)e.Item;
          CheckBox ck = item.Controls[0].FindControl("ck1") as CheckBox;
          if (ck != null)
          {
              ck.Checked = IncludeDismissed;
          }
      }
  }
  
  protected void ParticipantGrid_NeedDataSource(object sender, EventArgs e)
  {
      string eventTarget = Request.Params["__EVENTTARGET"];
      if (eventTarget != "lbtnSearch")
      {
          DataTable searchResults = ClientData.ViewEditParticipantSearch(sessionData, GetSearchString(), IncludeDismissed);
          ParticipantGrid.DataSource = searchResults;
      }
  }
  
  /// &lt;summary&gt;
  /// To properly search all participants (i.e. empty search), we need to pass a specific text string
  /// to the stored procedure that retrieves our data set.
  /// &lt;/summary&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private string GetSearchString()
  {
      return txtParticipantSearch.Text;
  }
  
  private void CreateDismissedCheckbox(RadGrid ParticipantGrid, string participantAlias)
  {
      ParticipantGrid.MasterTableView.CommandItemDisplay = GridCommandItemDisplay.Top;
      CommandItemTemplate cti = new CommandItemTemplate(string.Format("Include Dismissed {0}s", participantAlias), ParticipantGrid);
      cti.ck_OnClick += new CommandItemTemplate.OnCheckBoxClick(cti_ck_OnClick);
      ParticipantGrid.MasterTableView.CommandItemTemplate = cti;
  }
  
  /// &lt;summary&gt;
  /// Alter the text displayed in "SSN"/"SIN" columns based on site settings.
  /// &lt;/summary&gt;
  /// &lt;param name="item"&gt;A row to be added to the RadGrid.&lt;/param&gt;
  private void MaskSSNFields(GridDataItem item)
  {
      bool siteMasksSSN = GetSSNMaskSetting();
      if (siteMasksSSN)
      {
          string ssnAlias = GetSSNAliasSetting();
          if (item[ssnAlias].Text != "&amp;nbsp;")
          {
              item[ssnAlias].Text = SSNMaskUtil.MaskSSN(item[ssnAlias].Text, siteMasksSSN, false, System.Globalization.CultureInfo.CurrentCulture);
          }
      }
  }
  
  /// &lt;summary&gt;
  /// Some (hopefully few) customers will overwrite the standard "SSN"/"SIN"
  /// text that shows up in the RadGrid's HeaderText when they return the 
  /// standard demographic column with their quick search results. This method
  /// retrieves that possible alternate text.
  /// &lt;/summary&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  public string GetSSNAliasSetting()
  {
      var ssnAliasSetting =
          _site.GetSiteSettings(sessionData)
          .SingleOrDefault(ss =&gt; ss.SettingID == (int)Setting.Definition.SSNAlias);
  
      if (ssnAliasSetting == null)
      {
          if (sessionData.CountryCode != "CA")
          {
              return "SSN";
          }
          else
          {
              return "SIN";
          }
      }
      else
      {
          return ssnAliasSetting.Value.ToString();
      }
  }
  
  /// &lt;summary&gt;
  /// Lets us know whether or not a customer wants to hide certain portion
  /// of SSN/SIN numbers.
  /// &lt;/summary&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  public bool GetSSNMaskSetting()
  {
      var ssnMaskSetting =
          _site.GetSiteSettings(sessionData)
          .SingleOrDefault(ss =&gt; ss.SettingID == (int)Setting.Definition.SSNMask);
  
      if (ssnMaskSetting == null || String.IsNullOrEmpty(ssnMaskSetting.Value.ToString()))
      {
          return false;
      }
      else
      {
          return bool.Parse(ssnMaskSetting.Value.ToString());
      }
  }
  
  /// &lt;summary&gt;
  /// Some users may want to show a different text other than "Participant" on this page.
  /// If so, we want to get that text so we can properly modify this page's HTML.
  /// &lt;/summary&gt;
  /// &lt;returns&gt;Either the user-defined alias or "Participant".&lt;/returns&gt;
  public string GetParticipantAliasSetting()
  {
      var participantAliasSetting =
          _site.GetSiteSettings(sessionData)
          .SingleOrDefault(ss =&gt; ss.SettingID == (int)Setting.Definition.AddNewParticipantScreenSetting);
  
      if (participantAliasSetting == null || String.IsNullOrEmpty(participantAliasSetting.Value.ToString()))
      {
          return "Participant";
      }
      else
      {
          return participantAliasSetting.Value.ToString();
      }
  }
  
  /// &lt;summary&gt;
  /// Clicking the name of the client should link to the edit client page (varies depending
  /// on whether or not the new Edit Participant page is visible).
  /// &lt;/summary&gt;
  private string GetEditClientLink()
  {
      if (IsFormSearch)
      {
          return "/SingleForm/ClientForms.aspx?CLID={0}";
      }
      else
      {
          if (RedirectToNewEditPage)
          {
              return "/Modules/Participants/AddEditClient.aspx?CLID={0}";
          }
          else
          {
              return "/EditClient.asp?CLID={0}";
          }
      }
  }
  
  /// &lt;summary&gt;
  /// Remove timestamps from values in date columns and format dates according
  /// to session location.
  /// &lt;/summary&gt;
  /// &lt;param name="item"&gt;A row to be added to the RadGrid.&lt;/param&gt;
  /// &lt;param name="columnName"&gt;The column to be formatted.&lt;/param&gt;
  private void FormatDateColumn(GridDataItem item, string columnName)
  {
      DateTime date;
      if (DateTime.TryParse(item[columnName].Text, out date))
      {
          string dateFormatString = GetDateStringFormat();
          item[columnName].Text = string.Format(dateFormatString, date);
      }
  }
  
  /// &lt;summary&gt;
  /// Format text to be bold if it matches with the search term.
  /// &lt;/summary&gt;
  /// &lt;param name="item"&gt;A row of data in the RadGrid.&lt;/param&gt;
  /// &lt;param name="columnName"&gt;Column Name string.&lt;/param&gt;
  /// &lt;param name="searchTerm"&gt;What the user is searching for.&lt;/param&gt;
  private void EmboldenSearchText(GridDataItem item, string columnName, string searchTerm)
  {
      if (ParticipantGrid.MasterTableView.GetColumnSafe(columnName) is GridHyperLinkColumn &amp;&amp; columnName == "Name")
      {
          HyperLink nameLink = (HyperLink)item["Name"].Controls[0];
          string cellText = nameLink.Text;
          bool cellTextMatchesSearchTerm = cellText.ToLower().Contains(searchTerm.ToLower());
          if (!String.IsNullOrEmpty(searchTerm) &amp;&amp; cellTextMatchesSearchTerm)
          {
              Match searchMatch = Regex.Match(cellText, searchTerm, RegexOptions.IgnoreCase);
              nameLink.Text = cellText.Replace(searchMatch.Value, String.Format("&lt;b&gt;{0}&lt;/b&gt;", searchMatch.Value));
          }
      }
      else
      {
          string cellText = item[columnName].Text;
          bool cellTextMatchesSearchTerm = cellText.ToLower().Contains(searchTerm.ToLower());
          if (!String.IsNullOrEmpty(searchTerm) &amp;&amp; cellTextMatchesSearchTerm)
          {
              Match searchMatch = Regex.Match(cellText, searchTerm, RegexOptions.IgnoreCase);
              item[columnName].Text = cellText.Replace(searchMatch.Value, String.Format("&lt;b&gt;{0}&lt;/b&gt;", searchMatch.Value));
          }
      }
  }
  
  /// &lt;summary&gt;
  /// Format a date in a RadGrid based on session location.
  /// &lt;/summary&gt;
  /// &lt;param name="countryCode"&gt;Location as a string.&lt;/param&gt;
  /// &lt;returns&gt;DataFormatString for RadGrid DateTime columns.&lt;/returns&gt;
  public string GetDateStringFormat()
  {
      if (sessionData.CountryCode == "US")
      {
          return "{0:M/d/yyyy}";
      }
      else
      {
          return "{0:d/M/yyyy}";
      }
  }
  
  /// &lt;summary&gt;
  /// Generate each of the standard form columns for the grid. Make sure the name of the standard columns matches the type of form
  /// we are dealing with (Form =&gt; Collection or TouchPoint).
  /// &lt;/summary&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private void CreateStandardColumns(GridTableView tableView)
  {
      CreateColumn(tableView, "CLID", "CLID", false);
      CreateNameLinkColumn(tableView);
  }
  
  /// &lt;summary&gt;
  /// Generate each of the custom demographic columns for the grid based on demographic quick search settings.
  /// &lt;/summary&gt;
  /// &lt;param name="tableView"&gt;Grid to which we're adding the columns.&lt;/param&gt;
  /// &lt;param name="dataTable"&gt;The DataTable containing the search results.&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private void CreateCustomColumns(GridTableView tableView, DataTable dataTable)
  {
      foreach (System.Data.DataColumn column in dataTable.Columns)
      {
          if (ColumnIsCustomDemographic(column.ColumnName.ToLower()))
          {
              if (column.ColumnName == "SSN" || column.ColumnName == "SIN")
              {
                  CreateSSNColumn(tableView, column.ColumnName);
              }
              else
              {
                  CreateColumn(tableView, column.ColumnName, column.ColumnName);
              }
          }
      }
  }
  
  /// &lt;summary&gt;
  /// These columns are automatically returned by the stored procedure, but should not
  /// be included in the RadGrid because they are not custom demographics.
  /// &lt;/summary&gt;
  /// &lt;param name="columnName"&gt;Name of the column.&lt;/param&gt;
  /// &lt;returns&gt;Whether or not this column contains custom demographic data.&lt;/returns&gt;
  private bool ColumnIsCustomDemographic(string columnName)
  {
      return columnName != "name" &amp;&amp;
          columnName != "lname" &amp;&amp;
          columnName != "fname" &amp;&amp;
          columnName != "clid";
  }
  
  /// &lt;summary&gt;
  /// This checks if there is an alias that the customer wants to display instead of "SSN" or "SIN".
  /// If so, we will instead that alias when creating the column.
  /// &lt;/summary&gt;
  /// &lt;param name="tableView"&gt;Grid to which we're adding the column.&lt;/param&gt;
  /// &lt;param name="columnName"&gt;The DataField/HeaderText of the column.&lt;/param&gt;
  private void CreateSSNColumn(GridTableView tableView, string columnName)
  {
      string ssnAlias = GetSSNAliasSetting();
      if (!String.IsNullOrEmpty(ssnAlias))
      {
          CreateColumn(tableView, columnName, ssnAlias);
      }
      else
      {
          CreateColumn(tableView, columnName, columnName);
      }
  }
  
  /// &lt;summary&gt;
  /// Generate a single column for the grid.
  /// &lt;/summary&gt;
  /// &lt;param name="dataField"&gt;The desired data field for the column.&lt;/param&gt;
  /// &lt;param name="name"&gt;The desired display field of the column.&lt;/param&gt;
  /// &lt;returns&gt;&lt;/returns&gt;
  private void CreateColumn(GridTableView tableView, string dataField, string name, bool isVisible = true)
  {
      GridBoundColumn boundColumn = new GridBoundColumn();
      tableView.Columns.Add(boundColumn);
      boundColumn.DataField = dataField;
      boundColumn.UniqueName = name;
      boundColumn.HeaderText = name;
      boundColumn.Visible = isVisible;
      boundColumn.AutoPostBackOnFilter = true;
  }
  
  /// &lt;summary&gt;
  /// Turn the "Name" column into a hyperlink that links to a page to edit the client.
  /// &lt;/summary&gt;
  /// &lt;param name="tableView"&gt;&lt;/param&gt;
  private void CreateNameLinkColumn(GridTableView tableView)
  {
      GridHyperLinkColumn colName = new GridHyperLinkColumn();
      tableView.Columns.Add(colName);
      colName.DataTextField = "Name";
      colName.DataNavigateUrlFormatString = GetEditClientLink();
      colName.DataNavigateUrlFields = new string[] { "CLID" };
      colName.UniqueName = "Name";
      colName.HeaderText = "Name";
      colName.SortExpression = "Name";
  }
  </code></pre>
  
  <p>HTML:</p>
  
  <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
  &lt;head id="Head1" runat="server"&gt;
  &lt;title&gt;View/Edit Participants&lt;/title&gt;
  &lt;script type="text/javascript" src="/TelerikCSS/TelerikGridSupport.js"&gt;&lt;/script&gt;
  &lt;style type="text/css"&gt;
      .rgMasterTable
      {
          border-collapse: collapse !important;
      }
      .rgHeader
      {
          font-weight: bold !important;
      }
      .pageStyle
      {
          margin-top: -2px;
          padding: 3px;
          border: 1px solid #828282;
      }
      .centerControl
      {
          margin-left: auto;
          margin-right: auto;
      }
      .OverrideBorder
      {
          border-style: none !important;
          border-width: 0px !important;
      }
      #lbtnSearch
      {
          font-size: 115%;
          padding: 1px 7px 1px 7px;
          margin: 2px;
      }
      #lbtnAddNew
      {
          font-size: 115%;
          padding: 1px 7px 1px 7px;
          margin: 2px;
      }
  &lt;/style&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;script type="text/javascript"&gt;
      document.onkeydown = function (e) {
          e = e || window.event;
          if (e.keyCode == 13) {
              //See if Search button is available
              var btnsearch = document.getElementById("lbtnSearch");
              if (btnsearch) btnsearch.click();
          }
      };
  &lt;/script&gt;
  
  &lt;telerik:RadScriptManager ID="ScriptManager1" runat="server" EnableTheming="True" AsyncPostBackTimeout="600"&gt;
      &lt;Scripts&gt;
          &lt;asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.Core.js"&gt;
          &lt;/asp:ScriptReference&gt;
          &lt;asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQuery.js"&gt;
          &lt;/asp:ScriptReference&gt;
          &lt;asp:ScriptReference Assembly="Telerik.Web.UI" Name="Telerik.Web.UI.Common.jQueryInclude.js"&gt;
          &lt;/asp:ScriptReference&gt;
      &lt;/Scripts&gt;
  &lt;/telerik:RadScriptManager&gt;
  &lt;div&gt;
      &lt;table class="OuterTable" style="width:100%;"&gt;
          &lt;tr&gt;
              &lt;td&gt;
                  &lt;table class="InnerTable" style="width:100%;"&gt;
                      &lt;tr&gt;
                          &lt;td class="MainHeaderRow" id="lblHeader" runat="server" colspan="2"&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr align="center"&gt;
                          &lt;td align="left" colspan="2"&gt;
                              &lt;span id="searchForm"&gt;
                                  &lt;asp:TextBox ID="txtParticipantSearch" runat="server" Width="22%"&gt;&lt;/asp:TextBox&gt;
                                  &lt;asp:LinkButton ID="lbtnSearch" runat="server" CssClass="SecondaryButton" Text="Search" OnClick="lbtnSearch_OnClick"/&gt;
                                  &lt;asp:LinkButton ID="lbtnAddNew" runat="server" CssClass="SecondaryButton" Text="Add New {0}" OnClick="lbtnAddNew_OnClick" /&gt;
                                  &lt;br /&gt;
                                  &lt;asp:Label ID="lblAllParticipants" runat="server"&gt;To see &lt;b&gt;all {0}s&lt;/b&gt; leave the box empty. &lt;/asp:Label&gt;
                                  &lt;br /&gt;
                                  &lt;br /&gt;
                              &lt;/span&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;td colspan="2"&gt;
                              &lt;telerik:RadAjaxManager ID="RadAjaxManager" runat="server" &gt;
                                  &lt;AjaxSettings&gt;
                                      &lt;telerik:AjaxSetting AjaxControlID="lbtnSearch"&gt;
                                          &lt;UpdatedControls&gt;
                                              &lt;telerik:AjaxUpdatedControl ControlID="searchResults" LoadingPanelID="RadAjaxLoadingPanel1" /&gt;
                                          &lt;/UpdatedControls&gt;
                                      &lt;/telerik:AjaxSetting&gt;
                                      &lt;telerik:AjaxSetting AjaxControlID="searchResults"&gt;
                                          &lt;UpdatedControls&gt;
                                              &lt;telerik:AjaxUpdatedControl ControlID="searchResults" LoadingPanelID="RadAjaxLoadingPanel1" /&gt;
                                          &lt;/UpdatedControls&gt;
                                      &lt;/telerik:AjaxSetting&gt;
                                  &lt;/AjaxSettings&gt;
                              &lt;/telerik:RadAjaxManager&gt;
                              &lt;telerik:RadAjaxLoadingPanel ID="RadAjaxLoadingPanel1" runat="server" EnableEmbeddedSkins="false"&gt;
                                  &lt;div&gt;
                                      &lt;img src="/images/ajax-loader_transparent.gif" alt="Loading..."/&gt;
                                  &lt;/div&gt;
                              &lt;/telerik:RadAjaxLoadingPanel&gt;
                              &lt;asp:UpdatePanel ID="searchResults" runat="server" UpdateMode="Conditional" cssclass="pageStyle"&gt;
                                  &lt;ContentTemplate&gt;
                                      &lt;telerik:RadGrid ID="ParticipantGrid" runat="server" CellSpacing="0" Width="100%"
                                      AutoGenerateColumns="false" GridLines="None" EnableEmbeddedSkins="False"
                                      AllowSorting="true" ViewStateMode="Enabled" PagerStyle-AlwaysVisible="True"
                                      EnableLinqExpressions="false" AllowPaging="true" PageSize="250" AllowFilteringByColumn="true"&gt;
                                  &lt;/telerik:RadGrid&gt;
                                  &lt;/ContentTemplate&gt;
                              &lt;/asp:UpdatePanel&gt;
                          &lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/table&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>
  </p>