Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Web Controls > FindControl

Reply
Thread Tools

FindControl

 
 
aratienza
Guest
Posts: n/a
 
      12-07-2004
We have a repeater inside a datagrid inside a repeater. How can we access
the datagrid from the inner repeater?

We've tried something like this in the inner repeater's itemdatabound:

DataGrid dg1 = (DataGrid)parentRepeater.FindControl("DataGridCont rol")

The code doesn't work.

Any help is appreciated.

Thank you,
Arlynn
 
Reply With Quote
 
 
 
 
aratienza
Guest
Posts: n/a
 
      12-08-2004
Thank you for your reply but the code didn't work.

However, the code below works. I don't know why but it works.
(DataGrid)((((((Repeater)sender).Parent).Parent).P arent).Parent);

Below is the code snippet from my ASPX page:

<asp:Repeater
ID="rptIntervals"
Runat="server"
OnItemDataBound="rptIntervals_ItemDataBound">

<itemtemplate>
<table width="100%">
<tr>
<td>
<%#DataBinder.Eval(Container.DataItem, "Interval")%>
</td>
</tr>
</table>


<aspataGrid
ID="MAPPsDataGrid"
Runat="server"
OnItemDataBound="MAPPsDataGrid_ItemDataBound">

<Columns>
<asp:boundcolumn
datafield="DocumentID"
headertext="DocumentID" Visible="True"/>

<asp:boundcolumn
datafield="IntervalID"
headertext="IntervalID" Visible="False"/>

<asp:TemplateColumn
HeaderText="Process">
<ItemTemplate>
<asp:HyperLink
ID="lnkViewMAPP"
Runat="server"/>
</ItemTemplate>
</asp:TemplateColumn>

<asp:boundcolumn
datafield="EffectiveDate"
headertext="Eff. Date"/>

<asp:templatecolumn
headertext="Related Materials">
<itemtemplate>
<asp:repeater
ID="rptDocumentTypes"
Runat="server"
OnItemDataBound="rptDocumentTypes_ItemDataBound">

<itemtemplate>
<table width="200">
<tr>
<td class="bodyText">
<b><asp:label cssclass="Toggle" id="lblDocumentType"
runat="server"/></b><br>

</td>
</tr>

<tr
id="<%#rptIntervals.Items.Count%><%#DataBinder.Eva l(Container.DataItem,
"DocumentTypeID")%>menu" style="display:visible">
<td class="bodyText">
<asp:repeater
ID="rptRelatedDocuments"
Runat="server"
ItemDataBound="rptRelatedDocuments_ItemDataBound">
<itemtemplate>
<ol class="RelatedDocuments">
<asp:label
cssclass="Toggle"
id="lblRelatedDocuments"
runat="server"/>
</ol>
</itemtemplate>
</asp:repeater>
</td>
</tr>
</table>

</itemtemplate>
<asp:repeater>
</itemtemplate>
</asp:templatecolumn>

</Columns>
</aspataGrid>
</itemtemplate>
</asp:Repeater>





"Leon Friesema" wrote:

> On Tue, 7 Dec 2004 13:59:07 -0800, aratienza
> <(E-Mail Removed)> wrote:
>
> >We have a repeater inside a datagrid inside a repeater. How can we access
> >the datagrid from the inner repeater?
> >
> >We've tried something like this in the inner repeater's itemdatabound:
> >
> >DataGrid dg1 = (DataGrid)parentRepeater.FindControl("DataGridCont rol")
> >
> >The code doesn't work.
> >
> >Any help is appreciated.
> >
> >Thank you,
> >Arlynn

>
> Each control has a Parent control which you can allocate, if none:
> null, so inside the innerRepeater: DataGrid
> dg1=((DataGrid)this.Parent);
>
> Leon
>

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
FindControl method doesn't work ani ASP .Net 0 11-05-2003 03:47 PM
Assigned ID gets changed! (FindControl not working) Ivan Demkovitch ASP .Net 1 10-07-2003 08:16 PM
FindControl() returns NULL when object exists in Template? James G. Beldock ASP .Net 1 08-07-2003 09:19 PM
FindControl Ravikanth[MVP] ASP .Net 2 07-22-2003 08:16 AM
OnEditCommand - .FindControl Returning Null George Durzi ASP .Net 0 07-14-2003 09:54 PM



Advertisments