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

How to Data Bind in ContentTemplate of RadButton

3 Answers 229 Views
Button
This is a migrated thread and some comments may be shown as answers.
Tony
Top achievements
Rank 1
Tony asked on 05 Sep 2012, 12:10 PM

Hi

I have a RadListView bound to an EntityDataSource. Within the ItemTemplate I then have a RadButton with a ContentTemplate.

The RadButton is defined as follows (within the ListView ItemTemplate):

 <telerik:RadButton ID="VehicleRadButton" runat="server" ButtonType="StandardButton"

                                     AutoPostBack="true" GroupName="radVehicle"  CommandName="Select"

                                     ToggleType="Radio" Text='<%# String.Format("{0}", Eval("f1")) %>'>                             

                                     <ContentTemplate>

                                         <%# String.Format("[{0}]", Eval("f2")) %>

                                     </ContentTemplate>

 </telerik:RadButton>

 When I do this an error occurs:

Unable to cast object of type 'Telerik.Web.UI.RadButton' to type 'Telerik.Web.UI.RibbonBarTemplateItem'.

Is it possible to do this?

Thanks

Tony

3 Answers, 1 is accepted

Sort by
0
Slav
Telerik team
answered on 10 Sep 2012, 08:10 AM
Hi Tony,

It appears there is a problem with a RadButton with ContentTemplate when placed in a control that uses ItemTemplate, like ListView, and the content of the button's ContentTemplate inner property is set via Eval. I have brought this to the attention of our developers, although I cannot provide a firm estimate when it will be fixed. You can use the PITS Item of the issue in order to vote for it and track its status.

For the time being you can set the content of the button control on the code-behind as shown in the online demo Add elements in RadButton.

All the best,
Slav
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
0
Vasssek
Top achievements
Rank 1
answered on 19 Aug 2013, 09:19 AM
Hello,

I have similar issue when use RadButton in grid template column and RadButton has ContentTemplate with asp:label inside. This label needs to be databinded, but then this error is appered:

Error 6 'Telerik.Web.UI.RibbonBarTemplateItem' does not contain a definition for 'DataItem' and no extension method 'DataItem' accepting a first argument of type 'Telerik.Web.UI.RibbonBarTemplateItem' could be found (are you missing a using directive or an assembly reference?) 

It would be nice to add this functionality to radbutton control...

Best regards

Vasssek
0
Danail Vasilev
Telerik team
answered on 22 Aug 2013, 06:25 AM
Hello Vasssek,

It seems that the mentioned issue is the same as the one reported in the first post of this forum thread. However, I am sorry to say that I cannot bound to any time bounds when this will be fixed, as currently our developers are working on tasks with higher priority.

For the time being you can raise the priority of this issue by voting on its PITS item here.

Regards,
Danail Vasilev
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
Tags
Button
Asked by
Tony
Top achievements
Rank 1
Answers by
Slav
Telerik team
Vasssek
Top achievements
Rank 1
Danail Vasilev
Telerik team
Share this question
or