Skip to content

DevExpress-Examples/asp-net-web-forms-combobox-format-multi-column-text

Repository files navigation

Combo Box for ASP.NET Web Forms - How to format input text for multi-column combo box

In multi-column mode, the edit box displays the selected row’s values separated by a semicolon. Use the TextFormatString property to format the selected item’s output text. The text pattern can contain literals and indexed placeholders such as {0}, {1}, and so on.

Implementation Details

In this example, a radio button list control allows users to select a pattern to apply to the combo box text. The ASPxRadioButtonList.SelectedIndexChanged event handler sets the ASPxComboBox.TextFormatString property according to the selected pattern.

protected void ASPxRadioButtonList1_SelectedIndexChanged(object sender, EventArgs e) {
    if (ASPxRadioButtonList1.SelectedIndex == 0) { 
        ASPxComboBox1.TextFormatString = "{0} {1}, {2} Company";   
    }
    if (ASPxRadioButtonList1.SelectedIndex == 1) { 
        ASPxComboBox1.TextFormatString = "{1} {0}, {2} Company";
    }      
}

Files to Review

Does this example address your development requirements/objectives?

(you will be redirected to DevExpress.com to submit your response)

About

Use the TextFormatString property to format the selected item’s output text.

Topics

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •