Radbutton inside asp.repeater get_id Container.Dataitem

2 posts, 1 answers
  1. steve
    steve avatar
    5 posts
    Member since:
    Apr 2016

    Posted 22 Sep Link to this post

    I would like to see if it's possible to pass the value from a container.data with rad button in an asp.repeater control.


    <script type="text/javascript">
    function open_windowtemplate_AddSection(sender, args) {
    var button = sender.get_id();


    <asp:Repeater ID="rpt_Channel" runat="server" OnItemDataBound="rpt_Channel_ItemDataBound">
    <td colspan="4" class="MainLineItem">
    <div style="float:left;">&#9632; <asp:Label ID="lbl_ChapterName" runat="server" Text='<%#DataBinder.Eval(Container.DataItem, "Chapter")%>'></asp:Label></div>
    <div style="float:right">
    <asp:ImageButton ID="imgbtn_AddSection" runat="server" AlternateText="Click to add section" ImageUrl="~/Includes/images/green_plus_add.png" Height="20px" CommandName="Add" />
    <telerik:RadButton ID="radbutton_AddSection" runat="server" Text="+" CommandArgument='<%Databinder.Eval(Container.DataItem, "Channel_ID") %>'
    ButtonType="StandardButton" OnClientClicked='open_windowtemplate_AddSection' AutoPostBack="false">

  2. Answer
    Ianko avatar
    1510 posts

    Posted 27 Sep Link to this post

    Hello Steve,


    I am not sure what is the exact difficulty with the case here. 


    The only issues I see is the alerted value in the open_windowtemplate_AddSection click hander of RadButton. And they are:


    1.  $(button) would not return you the proper jQuery element. get_id returns you only the id, not the selector to use for jQuery. Make sure to modify that so that it works. For example, $("#" + button).
    2. Even if you get the proper jQuery element there is no commandarguments property that would return you the CommandArgument assigned in the RadButton control. 

      For that, there is the client-side API of the RadButton reference: http://docs.telerik.com/devtools/aspnet-ajax/controls/button/client-side-programming/overview. And the method is get_commandArgument().

      I suggest you testing with this piece of code:
      function open_windowtemplate_AddSection(sender, args) {

    If this does not help you with the case. Please, provide a simple, locally runnable markup of the situation you have and elaborate more on the difficulty you have with it.


    Telerik by Progress
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. DevCraft R3 2016 release webinar banner
Back to Top