コード例 #1
0
    /// <summary>
    /// Binds combobox control with data.
    /// </summary>
    private void BindCombobox(CMSFormControls_Basic_DropDownListControl control, string fieldName, string fieldValue, Image image)
    {
        DataTable dt;

        // Get grouped dataset
        mergedAccounts.Tables[0].DefaultView.Sort      = fieldName + " ASC";
        mergedAccounts.Tables[0].DefaultView.RowFilter = fieldName + " NOT LIKE ''";
        dt = mergedAccounts.Tables[0].DefaultView.ToTable(true, fieldName);

        // Bind control with data
        control.DropDownList.DataSource     = dt;
        control.DropDownList.DataTextField  = fieldName;
        control.DropDownList.DataValueField = fieldName;
        control.DataBind();

        // Insert parent value to first position
        if (!String.IsNullOrEmpty(fieldValue) && !control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.DropDownList.Items.Insert(0, fieldValue);
        }
        // Preselect parent value
        if (!String.IsNullOrEmpty(fieldValue) && control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.SelectedValue = fieldValue;
        }

        foreach (ListItem item in control.DropDownList.Items)
        {
            item.Text = HTMLHelper.HTMLEncode(item.Text);
        }

        // Display appropriate icon
        DisplayTooltip(image, dt, fieldName, fieldValue, FormFieldDataTypeEnum.Unknown);
    }
コード例 #2
0
    /// <summary>
    /// Binds combobox control with data.
    /// </summary>
    private void BindCombobox(CMSFormControls_Basic_DropDownListControl control, string fieldName, string fieldValue, HtmlGenericControl image)
    {
        DataTable dt;

        // Get grouped dataset
        dt = SortGroupAccountsByColumn(fieldName + SqlHelper.ORDERBY_ASC, fieldName + " NOT LIKE ''", fieldName);

        // Bind control with data
        control.DropDownList.DataSource     = dt;
        control.DropDownList.DataTextField  = fieldName;
        control.DropDownList.DataValueField = fieldName;
        control.DataBind();

        // Insert parent value to first position
        if (!String.IsNullOrEmpty(fieldValue) && !control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.DropDownList.Items.Insert(0, fieldValue);
        }
        // Preselect parent value
        if (!String.IsNullOrEmpty(fieldValue) && control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.SelectedValue = fieldValue;
        }

        // Display appropriate icon
        DisplayTooltip(image, dt, fieldName, fieldValue, FieldDataType.Unknown);
    }
コード例 #3
0
    /// <summary>
    /// Binds combobox control with data.
    /// </summary>
    private void BindCombobox(CMSFormControls_Basic_DropDownListControl control, string fieldName, string fieldValue, Image image)
    {
        DataTable dt;
        // Get grouped dataset
        mergedContacts.Tables[0].DefaultView.Sort = fieldName + " ASC";
        mergedContacts.Tables[0].DefaultView.RowFilter = fieldName + " NOT LIKE ''";
        dt = mergedContacts.Tables[0].DefaultView.ToTable(true, fieldName);

        // Bind control with data
        control.DropDownList.DataSource = dt;
        control.DropDownList.DataTextField = fieldName;
        control.DropDownList.DataValueField = fieldName;
        control.DataBind();

        // Insert parent value to first position
        if (!String.IsNullOrEmpty(fieldValue) && !control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.DropDownList.Items.Insert(0, fieldValue);
        }
        // Preselect parent value
        if (!String.IsNullOrEmpty(fieldValue) && control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.SelectedValue = fieldValue;
        }

        foreach (ListItem item in control.DropDownList.Items)
        {
            item.Text = HTMLHelper.HTMLEncode(item.Text);
        }

        // Display appropriate icon
        DisplayTooltip(image, dt, fieldName, fieldValue, FormFieldDataTypeEnum.Unknown);
    }
    /// <summary>
    /// Binds combobox control with data.
    /// </summary>
    private void BindCombobox(CMSFormControls_Basic_DropDownListControl control, string fieldName, string fieldValue, HtmlGenericControl image)
    {
        // Get grouped dataset
        DataTable dt = SortGroupContactsByColumn(fieldName + SqlHelper.ORDERBY_ASC, fieldName + " NOT LIKE ''", fieldName);

        // Bind control with data
        control.DropDownList.DataSource = dt;
        control.DropDownList.DataTextField = fieldName;
        control.DropDownList.DataValueField = fieldName;
        control.DataBind();

        // Insert parent value to first position
        if (!String.IsNullOrEmpty(fieldValue))
        {
            if (!control.DropDownList.Items.Contains(new ListItem(fieldValue)))
            {
                control.DropDownList.Items.Insert(0, fieldValue);
            }
            // Preselect parent value
            control.SelectedValue = fieldValue;
        }

        foreach (ListItem item in control.DropDownList.Items)
        {
            item.Text = HTMLHelper.HTMLEncode(item.Text);
        }

        // Display appropriate icon
        DisplayTooltip(image, dt, fieldName, fieldValue, FieldDataType.Unknown);
    }
コード例 #5
0
    /// <summary>
    /// Binds combobox control with data.
    /// </summary>
    private void BindCombobox(CMSFormControls_Basic_DropDownListControl control, string fieldName, string fieldValue, Image image)
    {
        DataTable dt;
        // Get grouped dataset
        dt = SortGroupAccountsByColumn(fieldName + " ASC", fieldName + " NOT LIKE ''", fieldName);

        // Bind control with data
        control.DropDownList.DataSource = dt;
        control.DropDownList.DataTextField = fieldName;
        control.DropDownList.DataValueField = fieldName;
        control.DataBind();

        // Insert parent value to first position
        if (!String.IsNullOrEmpty(fieldValue) && !control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.DropDownList.Items.Insert(0, fieldValue);
        }
        // Preselect parent value
        if (!String.IsNullOrEmpty(fieldValue) && control.DropDownList.Items.Contains(new ListItem(fieldValue)))
        {
            control.SelectedValue = fieldValue;
        }

        // Display appropriate icon
        DisplayTooltip(image, dt, fieldName, fieldValue, FormFieldDataTypeEnum.Unknown);
    }