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

Find controls in detailsTable

2 Answers 56 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Dominic
Top achievements
Rank 2
Dominic asked on 28 Oct 2008, 10:26 PM
Hi

I have a grid that contains a DetailTable and in it i have a control (image button) that i need to find , how i can achieve it ?  Do he have an event like itemCreated or ItemDataBound where i can find the control in my detailTable ?

Thanks in advance for your help.

2 Answers, 1 is accepted

Sort by
0
Accepted
Shinu
Top achievements
Rank 2
answered on 29 Oct 2008, 04:04 AM
Hi,

Try the following code snippet to achieve the desired scenario. Also eet the Name property for the detail table.

ASPX:
<DetailTables > 
   <telerik:GridTableView DataSourceID="SqlDataSource1"  Name="Detail"  runat="server" > 
     <Columns> 
        <telerik:GridTemplateColumn UniqueName="MyTempCol" > 
         <ItemTemplate> 
             <asp:ImageButton ID="ImageButton1" runat="server" /> 
         </ItemTemplate> 
        </telerik:GridTemplateColumn> 
     </Columns> 
   </telerik:GridTableView> 
 </DetailTables> 

CS:
protected void RadGrid1_ItemDataBound(object sender, Telerik.Web.UI.GridItemEventArgs e) 
    { 
        if ((e.Item is GridDataItem) && (e.Item.OwnerTableView.Name == "Detail")) 
        { 
            GridDataItem item = (GridDataItem)e.Item; 
            ImageButton imgbtn = (ImageButton)item["MyTempCol"].FindControl("ImageButton1"); 
        } 
 
         
    } 


Thanks
Shinu.
0
Dominic
Top achievements
Rank 2
answered on 29 Oct 2008, 01:24 PM

Hi

Thanks for your answer.

Everything is working fine, thanks for your help.

Tags
Grid
Asked by
Dominic
Top achievements
Rank 2
Answers by
Shinu
Top achievements
Rank 2
Dominic
Top achievements
Rank 2
Share this question
or