New to Telerik UI for ASP.NET AJAX? Download free 30-day trial

Selected Values of Controls when used in Templates


Instructions to bind SelectedValue, SelectedText, SelectedDate, Text properties of different controls when they are used in Templates.

In some scenarios we would like to bind the values of parent controls to selected value, text, date of Controls that are used their Templates. There are numerous examples and demos using properties such as SelectedValue of a DropDownList, SelectedData of a RadDatePicker, etc when they are in Templates.

SelectedValue property used in Template

There is a question, however, why these properties are not showing up in the Intellisense, and how to use them?

Missing property in IntellIsense


The answer is, they are server properties only and cannot be accessed declaratively.

SelectedValue available in IntellIsense

If they were declared in the markup they would generate an exception: The "Selectedvalue" property cannot be set declaratively.

SelectedValue property used Declaratively

Selected Values of Controls in Templates

Templates, on the other hand, can interpret these properties even if declared in the markup.

Here is a list of Controls and their Server properties that can be used to Bind() values to them

ASP DropDownList

<asp:DropDownList ID="DropDownList2" runat="server" SelectedValue='<%# Bind("ShipName") %>'>


<telerik:RadDropDownList ID="RadDropDownList2" runat="server" SelectedText='<%# Bind("ShipName") %>'>


<telerik:RadComboBox ID="RadComboBox1" runat="server" SelectedText='<%# Bind("ShipName") %>'>
<telerik:RadComboBox ID="RadComboBox1" runat="server" SelectedValue='<%# Bind("ShipName") %>'>

RadComboBox with Load On Demand

<telerik:RadComboBox ID="RadComboBox1" runat="server" Text='<%# Bind("ShipName") %>'>


Use the Value server-side property

<telerik:RadMultiColumnComboBox runat="server" ID="RadMultiColumnComboBox1"
    DataTextField ="ShipName"
    Value='<%# Bind("ShipName") %>'>

RadDatePicker, RadTimePicker, RadDateTimePicker

<telerik:RadDatePicker ID="RadDatePicker1" runat="server" DbSelectedDate='<%# Bind("ShipName") %>'>
<telerik:RadTimePicker ID="RadTimePicker1" runat="server" DbSelectedDate='<%# Bind("ShipName") %>'>
<telerik:RadDateTimePicker ID="RadDateTimePicker1" runat="server" DbSelectedDate='<%# Bind("ShipName") %>'>


Use the Value server-side property

<telerik:RadRadioButtonList ID="rblTimeTypeInsert" runat="server" SelectedValue='<%# Bind("Size") %>' >
        <telerik:ButtonListItem Text="Small" Value="Small" />
        <telerik:ButtonListItem Text="Medium" Value="Medium" />
        <telerik:ButtonListItem Text="Large" Value="Large" />
In this article