How to access controls in Edit and Insert templates of DetailsView

  • Thread starter The_ShotSpotter_Team
  • Start date
T

The_ShotSpotter_Team

Folks,

Your guidance would be appreciated: I have a DetailsView, and I can use
FindControl("cmbFoo") to successfully find a DropDownList defined in a
<ItemTemplate> of a field in a DetailsView. However, if I move cmbFoo to
either the <EditItemTemplate> or the <InsertItemTemplate>, then
FindControl("cmbFoo") returns NULL, regardless of what mode the control is in
(i.e., this fails in read-only mode, in edit mode and in insert mode).

How do I access my cmbFoo when its home is the <EditItemTemplate> or the
<InsertItemTemplate> of a field in a DetailsView?

Thanks in advance.

Regards,
/s/ James
 
B

Brock Allen

I suspect the problem is that you're calling FindControl before the DetailsView
is DataBound. Try doing this call in the DataBound event.
 

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

Staff online

Members online

Forum statistics

Threads
473,734
Messages
2,569,441
Members
44,832
Latest member
GlennSmall

Latest Threads

Top