It is possible to add complex content (i.e., server controls and HTML elements) in a RadButton
instead of plain text. There are three ways to achieve this:
- Set the ContentTemplate property.
- In the markup of your page you can add controls to the ContentTemplate inner property as shown below:
<
telerik:RadButton
runat
=
"server"
ID
=
"RadButton1"
Width
=
"90"
Height
=
"90"
>
<
ContentTemplate
>
<
span
>RadButton Content</
span
>
</
ContentTemplate
>
</
telerik:RadButton
>
- In the code-behind, you can set the ContentTemplate property to an instance of a class that implements the ITemplate interface.
- Add controls to the Controls collection of the RadButton instance from the code-behind.
Important: Please note that the RadButton is rendered as a
span HTML element, wrapping the inserted content, so you should add in the template only
inline elements in order to maintain XHTML compliance .