views:

70

answers:

2

Hi,

I have values stored in the database describing panels, combos, textboxes, labels etc...to be dynamically generated based on what the user set it up to be on a setup form, mainly used for input, including validation rules and datatypes to be specified during the setup of the form.

Problem is, I need to render the "Form" in both winforms and asp.net. What would be a good approach to this? I need both results on the different platforms(asp.net & winforms) to look and behave the same way. I was thinking of using XSLT, but not sure on how it can be applied to winforms.

Please advice.

Thanks.

+1  A: 

I've done exactly this a couple of times and my suggestion is to realize right away that you won't be able to single-source the interface. The Web and Forms namespaces are just too dissimilar.

However, you can go quite a long way if your data/business layers are abstract enough to handle being used from both interfaces. In fact if you don't already have a good layers in place this is the perfect time to work on it.

Another thing to think about - if it's possible to serialize your forms after they've been constructed (cache them as an xml file or whatever), you may see that it's much faster to do that than construct them each time. I got a lot of mileage out of that, caching "template" forms in ASP.NET sped things up nicely.

Good luck!

overslacked
A: 

If you literally need both the winforms and web versions of your app to look and behave exactly the same, I think your only option is to write this as an ActiveX control (yes, they're still around) which is either hosted on a form or hosted in a web browser. I guess using Flash is also an option (although not a .Net one, obviously), and Silverlight is sort of a possibility (you can port a Silverlight application from the web version to a winforms version, but not the other direction - at least not easily).

MusiGenesis