Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

Asp.Net Programming

FindControl in FormView Edit Template


Before I pull out what little hair I have left, I'm swallowing my
pride and asking the Oracles of .Net:

I'm trying to set  a property in a dropdown list control in a
FormView, based on a session parameter.  The control is in the edit
template of the FormView, which is not visible from the view
template.  I'm able to change properties of controls on the view
template.  However, when trying to set them on the edit template the
control fails to instantiate.  I have tried using the FormView
ModeChanged event but, the FormView does not render to the edit
template prior to the ModeChanged event firing. I stepped through the
code and the event fires before the FormView shows the edit template
and therefore the control is not visible to the code.  Is there
another event to use for controls on the edit template?

Code:
Protected Sub fv1_ModeChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles fv1.ModeChanged
        If fv1.CurrentMode = FormViewMode.Edit And Session("Type").ToString()
= "T" Then
                Dim ddl As DropDownList = fv1.FindControl("ddl2")
                ddl.Enabled = True
                ddl.Dispose()
        End If
End Sub

The code works if the control is on the view template, but fails if
the control is on the edit template. I set a test button on the edit
template to trigger the property change and it works.

Thanks,
Steve T.

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc