New to Telerik UI for ASP.NET AJAX? Start a free 30-day trial
Server-side Programming Overview
You can configure the settings of RadMultiColumnComboBox and create its elements in the code-behind via the Server-Side API of the control.
RadMultiColumnComboBox Server-side Events
In the R2 2019 release, server-side events for the RadMultiColumnComboBox control are introduced. Here is a list of the available events:
- OnDataBinding
- OnDataBound
- OnInit
- OnItemDataBound
- OnLoad
- OnPreRender
- OnSelectedIndexChanged
RadMultiColumnComboBox Public Properties and Methods
For a list with the server-side properties and methods of the control, see the Server-Side API of the RadMultiColumnComboBox class. You can also find it in the intellisense in Visual Studio.
Get Selected Text and Value
RadMultiColumnComboBox exposes the Text and Value server-side properties that contain the information from the DataTextField
and DataValueField
fields respectively.
Example 1: Get selected value and text from RadMultiColumnComboBox
ASP.NET
<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1" Skin="Default"
DataTextField="TheText" DataValueField="ID"
Width="300" DropDownWidth="300">
<ColumnsCollection>
<telerik:MultiColumnComboBoxColumn Field="ID" Title="ID" />
<telerik:MultiColumnComboBoxColumn Field="TheText" Title="Name" />
<telerik:MultiColumnComboBoxColumn Field="MoreData" Title="Extra Info" />
</ColumnsCollection>
<PopupSettings />
</telerik:RadMultiColumnComboBox>
<asp:Button Text="Get Data" ID="Button1" OnClick="Button1_Click" runat="server" />
C#
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
var data = Enumerable.Range(0, 10).Select(x => new
{
ID = x,
TheText = "Name " + x,
MoreData = "Extra " + x
});
RadMultiColumnComboBox1.DataSource = data;
RadMultiColumnComboBox1.DataBind();
}
}
protected void Button1_Click(object sender, EventArgs e)
{
string text = RadMultiColumnComboBox1.Text;
string val = RadMultiColumnComboBox1.Value;
string result = string.Format("text: {0}<br />value: {1}", text, val);
Response.Write(result);
}