I'm still not having success. I've tried the "foreach(RepeaterItem rptItem
in rptCheckBox.Items)" approach and it works if I put the original ID value
in, chkHistoric, but if I put the changed ID value in, chkP34031Historic, it
doesn't find it. I did turn on tracing and the control is referred to as:
Repeater1:_ctl1:chkP34031Historic (first instance)
Repeater1:_ctl2:chkP70450Historic (second instance)
I think maybe I need to do a nested loop on Repeater1, but I'm not sure how
to get to these controls or reference them with the trace info.
More trace info that includes the whole repeater section:
txtParcelID
System.Web.UI.WebControls.TextBox
260
0
_ctl13
System.Web.UI.ResourceBasedLiteralControl
474
0
Repeater1
System.Web.UI.WebControls.Repeater
16501
36
Repeater1:_ctl0
System.Web.UI.WebControls.RepeaterItem
85
0
Repeater1:_ctl0:_ctl0
System.Web.UI.LiteralControl
85
0
Repeater1:_ctl1
System.Web.UI.WebControls.RepeaterItem
8132
0
Repeater1:_ctl1:_ctl0
System.Web.UI.DataBoundLiteralControl
1381
236
Repeater1:_ctl1:chkP34031Forest
System.Web.UI.WebControls.CheckBox
154
36
Repeater1:_ctl1:_ctl1
System.Web.UI.ResourceBasedLiteralControl
310
0
Repeater1:_ctl1:chkP34031OpenSpace
System.Web.UI.WebControls.CheckBox
178
36
Repeater1:_ctl1:_ctl2
System.Web.UI.ResourceBasedLiteralControl
285
0
Repeater1:_ctl1:chkP34031NonProfit
System.Web.UI.WebControls.CheckBox
160
36
Repeater1:_ctl1:_ctl3
System.Web.UI.ResourceBasedLiteralControl
284
0
Repeater1:_ctl1:chkP34031Historic
System.Web.UI.WebControls.CheckBox
139
0
Repeater1:_ctl1:_ctl4
System.Web.UI.ResourceBasedLiteralControl
583
0
Repeater1:_ctl1:radP34031PropType1
System.Web.UI.WebControls.RadioButton
186
0
Repeater1:_ctl1:_ctl5
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PropType2
System.Web.UI.WebControls.RadioButton
229
0
Repeater1:_ctl1:_ctl6
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PropType3
System.Web.UI.WebControls.RadioButton
188
0
Repeater1:_ctl1:_ctl7
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PropType4
System.Web.UI.WebControls.RadioButton
199
0
Repeater1:_ctl1:_ctl8
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PropType5
System.Web.UI.WebControls.RadioButton
198
0
Repeater1:_ctl1:_ctl9
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PropType6
System.Web.UI.WebControls.RadioButton
190
0
Repeater1:_ctl1:_ctl10
System.Web.UI.ResourceBasedLiteralControl
338
0
Repeater1:_ctl1:radP34031PrincipalUse1
System.Web.UI.WebControls.RadioButton
212
0
Repeater1:_ctl1:_ctl11
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PrincipalUse2
System.Web.UI.WebControls.RadioButton
222
0
Repeater1:_ctl1:_ctl12
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PrincipalUse3
System.Web.UI.WebControls.RadioButton
199
0
Repeater1:_ctl1:_ctl13
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PrincipalUse4
System.Web.UI.WebControls.RadioButton
205
0
Repeater1:_ctl1:_ctl14
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PrincipalUse5
System.Web.UI.WebControls.RadioButton
214
0
Repeater1:_ctl1:_ctl15
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl1:radP34031PrincipalUse6
System.Web.UI.WebControls.RadioButton
198
0
Repeater1:_ctl1:_ctl16
System.Web.UI.LiteralControl
28
0
Repeater1:_ctl1:txtPrincipalUseOther
System.Web.UI.WebControls.TextBox
128
0
Repeater1:_ctl1:_ctl17
System.Web.UI.ResourceBasedLiteralControl
264
0
Repeater1:_ctl2
System.Web.UI.WebControls.RepeaterItem
8254
0
Repeater1:_ctl2:_ctl0
System.Web.UI.DataBoundLiteralControl
1521
424
Repeater1:_ctl2:chkP70450Forest
System.Web.UI.WebControls.CheckBox
154
36
Repeater1:_ctl2:_ctl1
System.Web.UI.ResourceBasedLiteralControl
310
0
Repeater1:_ctl2:chkP70450OpenSpace
System.Web.UI.WebControls.CheckBox
160
36
Repeater1:_ctl2:_ctl2
System.Web.UI.ResourceBasedLiteralControl
285
0
Repeater1:_ctl2:chkP70450NonProfit
System.Web.UI.WebControls.CheckBox
160
36
Repeater1:_ctl2:_ctl3
System.Web.UI.ResourceBasedLiteralControl
284
0
Repeater1:_ctl2:chkP70450Historic
System.Web.UI.WebControls.CheckBox
139
0
Repeater1:_ctl2:_ctl4
System.Web.UI.ResourceBasedLiteralControl
583
0
Repeater1:_ctl2:radP70450PropType1
System.Web.UI.WebControls.RadioButton
186
0
Repeater1:_ctl2:_ctl5
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PropType2
System.Web.UI.WebControls.RadioButton
229
0
Repeater1:_ctl2:_ctl6
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PropType3
System.Web.UI.WebControls.RadioButton
188
0
Repeater1:_ctl2:_ctl7
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PropType4
System.Web.UI.WebControls.RadioButton
199
0
Repeater1:_ctl2:_ctl8
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PropType5
System.Web.UI.WebControls.RadioButton
198
0
Repeater1:_ctl2:_ctl9
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PropType6
System.Web.UI.WebControls.RadioButton
190
0
Repeater1:_ctl2:_ctl10
System.Web.UI.ResourceBasedLiteralControl
338
0
Repeater1:_ctl2:radP70450PrincipalUse1
System.Web.UI.WebControls.RadioButton
212
0
Repeater1:_ctl2:_ctl11
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PrincipalUse2
System.Web.UI.WebControls.RadioButton
222
0
Repeater1:_ctl2:_ctl12
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PrincipalUse3
System.Web.UI.WebControls.RadioButton
199
0
Repeater1:_ctl2:_ctl13
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PrincipalUse4
System.Web.UI.WebControls.RadioButton
205
0
Repeater1:_ctl2:_ctl14
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PrincipalUse5
System.Web.UI.WebControls.RadioButton
214
0
Repeater1:_ctl2:_ctl15
System.Web.UI.LiteralControl
146
0
Repeater1:_ctl2:radP70450PrincipalUse6
System.Web.UI.WebControls.RadioButton
198
0
Repeater1:_ctl2:_ctl16
System.Web.UI.LiteralControl
28
0
Repeater1:_ctl2:txtPrincipalUseOther
System.Web.UI.WebControls.TextBox
128
0
Repeater1:_ctl2:_ctl17
System.Web.UI.ResourceBasedLiteralControl
264
0
Repeater1:_ctl3
System.Web.UI.WebControls.RepeaterItem
30
0
Repeater1:_ctl3:_ctl0
System.Web.UI.LiteralControl
30
0
_ctl14
System.Web.UI.ResourceBasedLiteralControl
657
0
txtPersPropDesc
"Steven Cheng[MSFT]" <v-******@online.microsoft.com> wrote in message
news:Yf**************@cpmsftngxa07.phx.gbl...
Hi John,
Thanks for posting here and your confirmation on my former suggestions.
From your description, currently you're wondering how to correctly
retrieve those controls(which has been renamed) from the repeater control,yes?
If there is anything I misunderstood, please feel free to let me know.
As for this question, I think Rimu Atkinson's suggestion is quite correct.
Every asp.net page or server control has a control hierarchy all its
direct sub controls are set in its controls collection. And the
Control.FindControl method is used to find control in a page or server
control's direct(one level below) child controls. If you want to find
controls all over a whole page, you need to loop through all the control
and its child control's controls collection, do you think so?
For detailed description on the Control.FindControl method, please view
the following reference in MSDN:
#Control.FindControl Method
http://msdn.microsoft.com/library/en...WebUIControlCl assFindControlTopic.asp?frame=true
So as for you situation, if you'd like to find and retrieve the controls
in the repeater's template, you need to FindControl at the direct parent
control of those one in the template(such as Label or TextBox). For
example, -----------------
private void lnkFirst_Click(object sender, System.EventArgs e)
{
foreach(RepeaterItem rptItem in rptCheckBox.Items)
{
Label lblName = (Label)rptItem.FindControl("lblName");
// .... find other control as above
}
}
We can find a control in its parent's controls collection as long as we
have its id. Since you've change the controls id to other custom value
from the database, you do need to retrieve them via the proper id
value(generated from the data's value).
Also, you can use the "Trace" function in ASP.NET to trace the whole
Control hierarchy in a certain asp.net page, just set the below directive
in the page:
<%@ Page Language="VB" Trace="True" TraceMode="SortByCategory" %>
For more detailed info on ASP.NET tracing, you may view the following
reference:
#Tracing
http://msdn.microsoft.com/library/en...001.asp?frame= true
In addition ,here is another kb article on find child control in template
control, I believe it also helpful to you.
#How to find child controls that are located in the template of a parent
control
http://support.microsoft.com/?id=323261
Please check out the suggestions. If you feel anything unclear, please
feel free to let me know.
Regards,
Steven Cheng
Microsoft Online Support
Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)