Skip to content

Commit 16c43d8

Browse files
docs(mccb): get server text and value examples
1 parent 0de9c6e commit 16c43d8

File tree

1 file changed

+69
-0
lines changed
  • controls/multicolumncombobox/server-side-programming

1 file changed

+69
-0
lines changed

controls/multicolumncombobox/server-side-programming/overview.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,72 @@ You can configure the settings of **RadMultiColumnComboBox** and create its elem
1616

1717
For a list with the server-side properties and methods of the control, see the [Server-Side API of the RadMultiColumnComboBox class](https://testdocs.telerik.com/devtools/aspnet-ajax/api/server/Telerik.Web.UI/RadMultiColumnComboBox). You can also find it in the intellisense in Visual Studio.
1818

19+
## Get Selected Text and Value
20+
21+
**RadMultiColumnComboBox** exposes the **Text** and **Value** server-side properties that contain the information from the `DataTextField` and `DataValueField` fields respectively.
22+
23+
>caption Example 1: Get selected value and text from RadMultiColumnComboBox
24+
25+
````ASP.NET
26+
<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1" Skin="Default"
27+
DataTextField="TheText" DataValueField="ID"
28+
Width="300" DropDownWidth="300">
29+
<ColumnsCollection>
30+
<telerik:MultiColumnComboBoxColumn Field="ID" Title="ID" />
31+
<telerik:MultiColumnComboBoxColumn Field="TheText" Title="Name" />
32+
<telerik:MultiColumnComboBoxColumn Field="MoreData" Title="Extra Info" />
33+
</ColumnsCollection>
34+
<PopupSettings />
35+
</telerik:RadMultiColumnComboBox>
36+
37+
<asp:Button Text="Get Data" ID="Button1" OnClick="Button1_Click" runat="server" />
38+
````
39+
40+
````C#
41+
protected void Page_Load(object sender, EventArgs e)
42+
{
43+
if (!Page.IsPostBack)
44+
{
45+
var data = Enumerable.Range(0, 10).Select(x => new
46+
{
47+
ID = x,
48+
TheText = "Name " + x,
49+
MoreData = "Extra " + x
50+
});
51+
52+
RadMultiColumnComboBox1.DataSource = data;
53+
RadMultiColumnComboBox1.DataBind();
54+
55+
}
56+
}
57+
58+
protected void Button1_Click(object sender, EventArgs e)
59+
{
60+
string text = RadMultiColumnComboBox1.Text;
61+
string val = RadMultiColumnComboBox1.Value;
62+
string result = string.Format("text: {0}<br />value: {1}", text, val);
63+
Response.Write(result);
64+
}
65+
````
66+
````VB
67+
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
68+
If Not Page.IsPostBack Then
69+
Dim data = Enumerable.Range(0, 10).[Select](Function(x) New With {
70+
Key .ID = x,
71+
Key .TheText = "Name " & x,
72+
Key .MoreData = "Extra " & x
73+
})
74+
75+
RadMultiColumnComboBox1.DataSource = data
76+
RadMultiColumnComboBox1.DataBind()
77+
End If
78+
End Sub
79+
80+
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click
81+
Dim text As String = RadMultiColumnComboBox1.Text
82+
Dim val As String = RadMultiColumnComboBox1.Value
83+
Dim result As String = String.Format("text: {0}<br />value: {1}", text, val)
84+
Response.Write(result)
85+
End Sub
86+
````
87+

0 commit comments

Comments
 (0)