This is a migrated thread and some comments may be shown as answers.

How to inherit ContentTemplate of RadButton

1 Answer 115 Views
Button
This is a migrated thread and some comments may be shown as answers.
Towhidul
Top achievements
Rank 1
Towhidul asked on 14 Jan 2015, 07:47 PM
I have a RadButton like following:

    <telerik:RadButton ID="NewActionBtn" runat="server" NavigateUrl="New.aspx">
            <ContentTemplate>
                <span class="myClass" style="color: black"></span>
                <span class="myAnotherClass"> Add</span>
            </ContentTemplate>
     </telerik:RadButton>

I want inherit this button so I only need to pass button text for the ContentTemplate. How will I do this. I don't want a WebUserControl with ascx extension.

1 Answer, 1 is accepted

Sort by
0
Danail Vasilev
Telerik team
answered on 19 Jan 2015, 12:38 PM
Hello Towhidul,

The _contentTemplate field inside the RadButton that is used for the content template is not virtual, so that you cannot override it by inheriting the RadButton class.What I can suggest is that you either create a user control with the desired content template or you create a class that can instantiate it, as illustrated in the Button - Add elements in RadButton online demo.

Regards,
Danail Vasilev
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
Button
Asked by
Towhidul
Top achievements
Rank 1
Answers by
Danail Vasilev
Telerik team
Share this question
or