protected void Page_Load(object sender, EventArgs e)
    {
        // Disable textbox editing
        selectInRole.UseFriendlyMode    = true;
        selectNotInRole.UseFriendlyMode = true;

        if (!RequestHelper.IsPostBack())
        {
            SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(ItemID);
            if (sii != null)
            {
                SearchIndexSettings     sis  = sii.IndexSettings;
                SearchIndexSettingsInfo sisi = sis.GetSearchIndexSettingsInfo(SearchHelper.SIMPLE_ITEM_ID);

                // Create new
                if (sisi != null)
                {
                    chkHidden.Checked      = ValidationHelper.GetBoolean(sisi.GetValue("UserHidden"), false);
                    chkOnlyEnabled.Checked = ValidationHelper.GetBoolean(sisi.GetValue("UserEnabled"), true);
                    chkSite.Checked        = ValidationHelper.GetBoolean(sisi.GetValue("UserAllSites"), false);
                    selectInRole.Value     = ValidationHelper.GetString(sisi.GetValue("UserInRoles"), String.Empty);
                    selectNotInRole.Value  = ValidationHelper.GetString(sisi.GetValue("UserNotInRoles"), String.Empty);
                    txtWhere.TextArea.Text = sisi.WhereCondition;
                }
            }
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!RequestHelper.IsPostBack())
        {
            SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(ItemID);
            if (sii != null)
            {
                SearchIndexSettings     sis  = sii.IndexSettings;
                SearchIndexSettingsInfo sisi = sis.GetSearchIndexSettingsInfo(SearchHelper.CUSTOM_INDEX_DATA);

                // Create new
                if (sisi != null)
                {
                    txtAssembly.Text      = ValidationHelper.GetString(sisi.GetValue("AssemblyName"), String.Empty);
                    txtClassName.Text     = ValidationHelper.GetString(sisi.GetValue("ClassName"), String.Empty);
                    txtData.TextArea.Text = ValidationHelper.GetString(sisi.GetValue("CustomData"), String.Empty);
                }
            }
        }
    }
    /// <summary>
    /// Resets all boxes.
    /// </summary>
    public void LoadControls()
    {
        SearchIndexInfo sii = SearchIndexInfoProvider.GetSearchIndexInfo(ItemID);

        string siteWhere = String.Empty;

        // Load only those site to which the index is assigned
        var siteIDs = SearchIndexSiteInfoProvider.GetIndexSiteBindings(ItemID).Column("IndexSiteID").Select(X => X.IndexSiteID.ToString()).ToList();

        if (siteIDs.Count > 0)
        {
            siteWhere = SqlHelper.GetWhereCondition <string>("SiteID", siteIDs, false);

            // Preselect current site if it is assigned to index
            if (!RequestHelper.IsPostBack() && siteIDs.Contains(SiteContext.CurrentSiteID.ToString()))
            {
                selSite.Value = SiteContext.CurrentSiteName;
            }

            selSite.UniSelector.WhereCondition = siteWhere;
            selSite.Reload(false);
        }
        else
        {
            pnlForm.Visible = false;

            ShowError(GetString("srch.index.nositeselected"));
        }

        // If we are editing existing search index
        if (sii != null)
        {
            SearchIndexSettings sis = new SearchIndexSettings();
            sis.LoadData(sii.IndexSettings.GetData());
            SearchIndexSettingsInfo sisi = sis.GetSearchIndexSettingsInfo(ItemGUID);
            if (sisi != null)
            {
                selectForm.Value       = ValidationHelper.GetString(sisi.GetValue("FormName"), "");
                txtWhere.TextArea.Text = sisi.WhereCondition;
                selSite.Value          = sisi.SiteName;
            }
        }

        // Init controls
        SetControlsStatus(false);
    }