Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Web Controls (http://www.velocityreviews.com/forums/f63-asp-net-web-controls.html)
-   -   How to access controls in Edit and Insert templates of DetailsView (http://www.velocityreviews.com/forums/t776739-how-to-access-controls-in-edit-and-insert-templates-of-detailsview.html)

The_ShotSpotter_Team 08-30-2005 12:53 AM

How to access controls in Edit and Insert templates of DetailsView
 
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

Brock Allen 08-30-2005 08:31 PM

Re: How to access controls in Edit and Insert templates of DetailsView
 
I suspect the problem is that you're calling FindControl before the DetailsView
is DataBound. Try doing this call in the DataBound event.

-Brock
DevelopMentor
http://staff.develop.com/ballen



> 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






All times are GMT. The time now is 07:33 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.