How to Data Bind in ContentTemplate of RadButton

4 posts, 0 answers
  1. Tony
    Tony avatar
    13 posts
    Member since:
    Dec 2011

    Posted 05 Sep 2012 Link to this post

    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

  2. Slav
    Admin
    Slav avatar
    1355 posts

    Posted 10 Sep 2012 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Vasssek
    Vasssek avatar
    143 posts
    Member since:
    Aug 2010

    Posted 19 Aug 2013 Link to this post

    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
  5. Danail Vasilev
    Admin
    Danail Vasilev avatar
    1490 posts

    Posted 22 Aug 2013 Link to this post

    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.
Back to Top