/// <summary>
        /// Method to convert the value of the freetext searchoption to a sql searchstring
        /// </summary>
        /// <param name="option">freetext searchoption</param>
        /// <returns>string for freetext search in the database</returns>
        private static string GetFreeSearch(SearchOption option)
        {
            string freesearchstring="";
            if (!string.IsNullOrEmpty(option.value))
            {
                string splitpattern = "(?:\")(.*?)(?:\")|([^\\s,]+)";
                Regex _regex = new Regex(splitpattern);
                // bouw de zoekcriteria
                List<string> criteria = new List<string>();
                Match ma = _regex.Match(option.value);
                while (ma.Success)
                {
                    Group g = ma.Groups[1];
                    try
                    {
                        string sSearchItem = string.Empty;
                        if (g.Success) // een woordcombinatie tussen ""
                        {
                            sSearchItem = g.Value;
                        }
                        g = ma.Groups[2];
                        if (g.Success) // een los woord
                        {
                            sSearchItem = g.Value;
                            if (option.searchtype == SeachType.Like)
                            {
                                sSearchItem += "*";
                            }
                        }

                        if (string.IsNullOrEmpty(freesearchstring))
                        {
                            freesearchstring = sSearchItem;
                        }
                        else
                        {

                            freesearchstring += "\" AND \"" + sSearchItem;
                        }
                    }
                    catch (Exception ee)
                    {
                    }
                    ma = ma.NextMatch();
                }
                freesearchstring = "\"" + freesearchstring + "\"";
            }
            return freesearchstring;
        }
        private DataTable SearchSite(SearchOption option)
        {
            string freeSearch =  GetFreeSearch(option);

                      DataSet set = new DataSet();
            try
            {

                SqlParameter[] parameters = new SqlParameter[2];
                parameters[0] = new SqlParameter(cstrParFreeSearch, SqlDbType.NVarChar, 250);
                             parameters[0].Value = string.IsNullOrEmpty(freeSearch) ? (object)DBNull.Value : freeSearch;
                             parameters[1] = new SqlParameter(cstrParSiteUrl, SqlDbType.NVarChar, 250);
                             string siteurl = ConfigurationManager.AppSettings["TranslatePathTo"].ToString();
                             if (siteurl.EndsWith("/"))
                             {
                                 siteurl = siteurl.Substring(0, siteurl.Length - 1);
                             }
                if (SubPath!="")
                {
                    siteurl+="/"+SubPath;
                }
                             parameters[1].Value = siteurl;
                             set = SqlHelper.ExecuteQueryProcedure(SearchSiteProcedure, parameters);
            }
            catch (Exception searchException)
            {
            }

            if (set.Tables.Count > 0)
            {
                return set.Tables[0];
            }
            else
            {
                return new DataTable();
            }
        }
        public void BindGrid()
        {
            SearchOption option;
            if (chbFreeSearchEqual.Checked)
            {
                option = new SearchOption(SeachOptionType.FreeSearch, txtSearch.Text, SeachType.Equal);

            }
            else
            {
                option = new SearchOption(SeachOptionType.FreeSearch, txtSearch.Text, SeachType.Like);

            }
            DataTable dat = SearchSite(option);
            grvResult.Caption = dat.Rows.Count + " gevonden pagina's";

            if (dat.Rows.Count > 0)
            {
                dat = UpdateUrlsAndTitles(dat);

                txtMessage.Text = "";
            }
            else
            {
                txtMessage.Text = "Er zijn geen pagina's gevonden.";
            }
            grvResult.DataSource = dat;
            grvResult.DataBind();
        }