[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

10/15/2009 at 02:47PM PDT, ID: 24816517 | Points: 500
[x]
Attachment Details

Finding an asp.net control in a partet/child repeater

Asked by mdunlap99 in Programming for ASP.NET, JavaScript, JavaScript Frameworks

I have a page that contains a repeater with a parent/child relationship.  rptrParent has datatable1 as a datasource.  The datatable1 has a relationship defined to a key field in datatable2.  rptrChild has datasource set to
DataSource='<%# CType(Container.DataItem,datarowview).Row.GetChildRows("myrelation") %>' .  rptrChild contains a chkbox control and a textbox control.  rptrChild.ItemDatabound method does a findcontrol() to locate each control.  the checkbox control receives an Attribute.Add("onClick","Settxtchk(this.checked,txtchk.Clientid").  The javascript is simply to set the textbox.value to the checkbox.checked value using the txtchk.ClientId.

The issue is this.  The txtchk.ClientId is passed in the ItemDatabound method as something like this:
ctl00_ContentPlaceHolder1_rptReqItems_ctl01_rptRfqItems_ctl00_txtchk  
That's cool.  However, when the click event is reaised, the txtchk.ClientId errors as not found.  When I look at the html source, I see that the actual txtchk.ClientId is like this:
ctl00_ContentPlaceHolder1_rptReqItems_ctl01_rptRFQItems_30_ctl00_txtchk
and the position where the '30' is is incremented with each rptrParent item.

Is there a way to predict this parent increment when adding the Settxtchk() script to the checkbox control so that the txt.ClientId will be correct?

Thanks in advance.
[+][-]10/15/09 05:51 PM, ID: 25586198

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10/19/09 08:19 AM, ID: 25605954

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11/19/09 03:52 PM, ID: 25866566

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 30-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20091111-EE-VQP-91 - Hierarchy / EE_QW_EXPERT_20070906