RadlistView ItemTemplate button click not firing

2 posts, 0 answers
  1. Abdul Kadar
    Abdul Kadar avatar
    35 posts
    Member since:
    Oct 2008

    Posted 11 Apr Link to this post

    Hi

    I am using a RADBUTTON in the itemtemplate of Radlistview.

    Kindly let me know how to add the click-event for that RADbutton on server-side and perform the below operations

    1) While clicking the RADBUTTON, : Need to store the bookid of the selected item in the Session 

    2) Then redirect to cartpage.aspx (After storing the id in the session)

    Pls guide how to achieve this scenario

     

                <telerik:RadListView ID="RadListView1" runat="server" ItemPlaceholderID="ProductItemContainer"

                    DataKeyNames="BookID"  OnNeedDataSource="RadListView1_NeedDataSource" >
                    <LayoutTemplate>
                        <fieldset>
                               <table>
      <tr>
    <td>
    <asp:Panel ID="ProductItemContainer" runat="server">
    </asp:Panel>                                
    </td>

    </tr>
    </table>
    </fieldset>
    </LayoutTemplate>
    <ItemTemplate>
    <fieldset>

    <table>
    <tr>
    <td class="productItem">
        <a href="default2.aspx?isbn=<%# Eval("BookID")%>">
    <img src="<%# Eval("imageurl")%>" alt="#= BookName #" />
                                       </a>
    </td>

    </tr>
    <tr>
    <td>
     <%# Eval("BookName")%> 
    </td>
    </tr>
    <tr>
    <td>
    <telerik:RadButton CommandName="Button1" ID="BtnAddtoCart" runat="server" Text="Add to Cart"></telerik:RadButton>
    </td>
    </tr>
    </table>
    </fieldset>
    </ItemTemplate>
    </telerik:RadListView>
          

     

  2. Eyup
    Admin
    Eyup avatar
    3014 posts

    Posted 14 Apr Link to this post

    Hi Abdul,

    You can use the OnClick event handler of the button and acquire the item ID using the GetDataKeyValue method, similar to the approach demonstrated in this section:
    http://docs.telerik.com/devtools/aspnet-ajax/controls/grid/rows/accessing-cells-and-rows#accessing-raw-field-data-and-key-values

    I hope this will prove helpful.

    Regards,
    Eyup
    Telerik
    Do you need help with upgrading your ASP.NET AJAX, WPF or WinForms projects? Check the Telerik API Analyzer and share your thoughts.
  3. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top