Controls failing when using LoadControl

  • Thread starter Thread starter David R
  • Start date Start date
D

David R

'lo

I've been investigating cases where my server controls (in ASP.NET1.1) are
populated with valid values, but return empty strings when their .Value
property is getted and their associated validators also fail.

So I devised a test case and ran through the circumstances surrounding this.

You may need to alter the *.sln and *.csproj files in notepad in order to
open it in VS (since I don't use localhost)

The tests are as follows:

** Test1.aspx
Simple >%@ Register with declarative control usage, the control and
validation both work fine
** Test2.aspx
Page has a WebControls.PlaceHolder control which the page's parent class
loads the TestForm.ascx into, validation and control fails
** Test3.aspx
A test to see if the PlaceHolder is the thing that's breaking it, the
declaritive control still functions flawlessly
** Test4.aspx
Loading the control directly onto the page rather than a Placeholder (I
thought that perhaps the PlaceHolder which doesn't add itself to the
control's Name="" attribute might be causing it to break). This also fails,
proving that it is just the use of LoadControl() breaks server control
validation and key properties of HtmlInputControl derivatives

Can anyone else confirm this and suggest workarounds?
 
Back
Top