/// <summary>
    /// Fills class name selector with data.
    /// </summary>
    private void FillClassNameSelector(string assemblyName)
    {
        // Clear items
        drpClassName.DropDownList.Items.Clear();

        if (String.IsNullOrEmpty(assemblyName))
        {
            return;
        }

        if (MacroProcessor.ContainsMacro(assemblyName))
        {
            // Include macro value if specified
            drpClassName.DropDownList.Items.Add(ClassName);
            return;
        }

        var classes = ClassHelper.GetClasses(assemblyName, Settings);

        if (classes != null)
        {
            // Fill drop-down list
            foreach (string className in classes)
            {
                drpClassName.DropDownList.Items.Add(className);
            }

            // Select first item if nothing was selected
            if ((classes.Count > 0) && !AllowEmpty && (drpClassName.SelectedIndex < 0) && String.IsNullOrEmpty(drpClassName.SelectedValue))
            {
                drpClassName.SelectedIndex = 0;
            }
        }
    }
Ejemplo n.º 2
0
    protected override void Render(HtmlTextWriter writer)
    {
        base.Render(writer);

        if (SimpleMode)
        {
            return;
        }

        foreach (ListItem item in drpAssemblyName.DropDownList.Items)
        {
            // Get assembly name
            string assemblyName = GetAssemblyName(item.Value);

            // Get classes
            var classes = ClassHelper.GetClasses(assemblyName, Settings);
            if (classes != null)
            {
                foreach (string className in classes)
                {
                    // Register all possible values for event validation
                    Page.ClientScript.RegisterForEventValidation(drpClassName.DropDownList.UniqueID, className);
                }
            }
        }
    }
Ejemplo n.º 3
0
    /// <summary>
    /// Fills assembly selector with data.
    /// </summary>
    private void FillAssemblySelector()
    {
        if (AllowEmpty)
        {
            drpAssemblyName.DropDownList.Items.Add(noneValue);
        }

        var classes = ClassHelper.GetClasses(ClassHelper.ASSEMBLY_APPCODE, Settings);

        if ((classes != null) && (classes.Count > 0))
        {
            drpAssemblyName.DropDownList.Items.Add(customClassString);
        }

        // Get assembly names filtered by given restriction settings
        var assemblies = ClassHelper.GetAssemblyNames(AssembliesFilter, Settings)
                         // Web site App_Code assembly are not supported. Custom class must be used instead
                         .Where(assemblyName => !assemblyName.StartsWith(APPCODE_PREFIX, StringComparison.OrdinalIgnoreCase));

        // Fill assemblies list
        foreach (string assemblyName in assemblies)
        {
            drpAssemblyName.DropDownList.Items.Add(assemblyName);
        }

        // Include macro value if specified
        if (!String.IsNullOrEmpty(AssemblyName) && MacroProcessor.ContainsMacro(AssemblyName))
        {
            drpAssemblyName.DropDownList.Items.Insert(0, AssemblyName);
        }

        // Clear selected value if drop down is empty
        if (drpAssemblyName.DropDownList.Items.Count == 0)
        {
            drpAssemblyName.SelectedValue = String.Empty;
        }
        else
        {
            // Select first item if nothing was selected
            if (drpAssemblyName.SelectedIndex < 0 && String.IsNullOrEmpty(drpAssemblyName.SelectedValue))
            {
                drpAssemblyName.SelectedIndex = 0;
            }
        }
    }
Ejemplo n.º 4
0
    /// <summary>
    /// Fills assembly selector with data.
    /// </summary>
    private void FillAssemblySelector()
    {
        if (AllowEmpty)
        {
            drpAssemblyName.DropDownList.Items.Add(noneValue);
        }

        var classes = ClassHelper.GetClasses(ClassHelper.ASSEMBLY_APPCODE, Settings);

        if ((classes != null) && (classes.Count > 0))
        {
            drpAssemblyName.DropDownList.Items.Add(customClassString);
        }

        // Get assembly names filtered by given restriction settings
        var assemblies = ClassHelper.GetAssemblyNames(AssembliesFilter, Settings);

        // Fill assemblies list
        foreach (string assemblyName in assemblies)
        {
            drpAssemblyName.DropDownList.Items.Add(assemblyName);
        }

        // Include macro value if specified
        if (!String.IsNullOrEmpty(AssemblyName) && MacroProcessor.ContainsMacro(AssemblyName))
        {
            drpAssemblyName.DropDownList.Items.Insert(0, AssemblyName);
        }

        // Clear selected value if drop down is empty
        if (drpAssemblyName.DropDownList.Items.Count == 0)
        {
            drpAssemblyName.SelectedValue = String.Empty;
        }
        else
        {
            // Select first item if nothing was selected
            if (drpAssemblyName.SelectedIndex < 0 && String.IsNullOrEmpty(drpAssemblyName.SelectedValue))
            {
                drpAssemblyName.SelectedIndex = 0;
            }
        }
    }