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

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

1 Answer 134 Views
ListView
This is a migrated thread and some comments may be shown as answers.
Jhon
Top achievements
Rank 1
Jhon asked on 01 Oct 2012, 02:00 PM
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>

1 Answer, 1 is accepted

Sort by
0
Accepted
Eyup
Telerik team
answered on 03 Oct 2012, 01:54 PM
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.
Tags
ListView
Asked by
Jhon
Top achievements
Rank 1
Answers by
Eyup
Telerik team
Share this question
or