How do I access my codigoBehind a <telerik: RadButton in a ListView.ItemTemplate?

2 posts, 1 answers
  1. Jhon
    Jhon avatar
    8 posts
    Member since:
    Apr 2012

    Posted 01 Oct 2012 Link to this post

    How do I access my codigoBehind a <telerik: RadButton in a ListView.ItemTemplate?

    <telerik:RadListView  ID="RadListView1" >

    // content

    <LayoutTemplate>

    // content

     </LayoutTemplate>
    <ItemTemplate>
    <div style="width:100%; height:20px; margin-left:5px; float:left">
                                                             <a style="font-family: Calibri; font-weight: bold; font-size: 14px;"> <%#Eval("Name")%></a>
                                                        </div>

    <telerik:RadButton ID="rbDetails" runat="server" Text="Detalhes" Skin="Office2007" CommandName="details" Visible="false" >
                                                                <Icon PrimaryIconUrl="../Images/btns/btnMostra.png"  PrimaryIconTop="2px" PrimaryIconLeft="4px" PrimaryIconWidth="30px" PrimaryIconHeight="30px" />
                                                            </telerik:RadButton>

    </ItemTemplate>

    </telerik:RadListView>
  2. Answer
    Eyup
    Admin
    Eyup avatar
    3012 posts

    Posted 03 Oct 2012 Link to this post

    Hello Jhon,

    Could you please try the following approach?
    protected void RadListView1_ItemDataBound(object sender, RadListViewItemEventArgs e)
    {
        if (e.Item is RadListViewDataItem)
        {
            RadListViewDataItem dataItem = e.Item as RadListViewDataItem;
            RadButton radButton = dataItem.FindControl("rbDetails") as RadButton;
        }
    }

    I hope this will prove helpful. Please give it a try and let me know about the result.

    Regards,
    Eyup
    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
Back to Top