Question

I am working with someone else's code. The code was originally designed so that data would dynamically create controls (and sub-controls of those controls...) on the OnInit event on numerous web control panels. And then later validation methods would check those dynamically created controls for valid data. This continues to work just fine for my web site. However, I need to be able to validate that data without my website (as in this will just be server side). The simpilist solution appeared to be to just have the panels initialize and then run the validation methods. That'd be great...if I could figure out how to initialize those panels server side without a web page.

Can this be done? Is there any way to get a panel to initialize without having a page to display that panel?

Was it helpful?

Solution

That way lies madness - you could use reflection to call the control's InitRecursive method, but it needs a Page (among other things) to run correctly.

You should extract the validation code into a new class that you can call from your server code an change your WebControl to use that class as well.

OTHER TIPS

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top