Unable to get the child control in repeater when first page load

J

jl817cn

It's strange.

The page is using master page, the repeater control is placed in
contentplaceholder. In repeater Itemtemplate, there are several labels
and textboxes, the value of textboxes is from database. there is
another custom control in repeater, which inherit the label control,
just add one customer property MyID. In page_load I will also call
another function to set the text of custom label. the function loop
through all the controls in page and set the value.

But if when the page is loaded for the first time, custom label does
not display the data retrieve from function, but in postback, it
display!

In debug, I found in the first page load, the function only finds
repeater control, but no repeateritem at all.

By the way, I am using recursive getControl method to get all the
control, which i believe is correct.

Thank you for any help!

Best

C^^
 
Y

Yuriy Solodkyy

Hi

If you use DataSourceID property for automatic data binding, data binding
occurs after the Page_Load and you cannot see any items. On the PostBack
state of repeater is restored from the ViewState and you can access these
items.

You will not see items created util OnPrerenderComplete event.

-yuriy
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top