Unable to cast object of type 'asp.usercontrols_....._ascx' to type 'usercontrols_.....'

  • Thread starter Thread starter marshausk
  • Start date Start date
M

marshausk

"InvalidCastException was unhandled by user code" is the title of the
error. It's related to 2 different user controls on my page that are
dynamically loaded. I've added both the Register and Reference
statements. The error comes and goes randomly. Today I'm working on
the containing page and haven't done any work in either user control.
The only way I can get the code to run successfully is to make a change
to all 4 files - the 2 user control ascx files and their corresponding
code behinds. If I make a change to just one set of files the error
occurs in the other. If I make a change to the 2nd set it tells me it
can't cast the first. Nice endless loop. What makes it worse is we're
using VSS so the files with the errors are sometimes checked out by
other users and my development effectively stops.

Makes for a painful day of coding. Please help.
 
Back
Top