Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Dynamic .NET forms with XML

Options
  • 26-05-2005 4:56pm
    #1
    Moderators, Home & Garden Moderators, Regional Midwest Moderators, Regional West Moderators Posts: 16,724 Mod ✭✭✭✭


    Lads
    Any of you have any experience of dynamic forms in .NET with XML files and XSLT files???

    I know you can create a form in .NET with a flat XML file but how do you have handle events and that?
    Googled it to death, found some simple examples but not that include events and that actually work, why people post code that does not compile is beyond me


Comments

  • Registered Users Posts: 15,443 ✭✭✭✭bonkey


    Winforms or webforms?

    If the latter, then I'd imagine that what you have is code-behind.

    If you look at the file(s) generated from "normal" webforms, you'll see that the hooking of events etc. isn't anything special. If you can generate content with XML, you can sure generate in-line code too.


  • Registered Users Posts: 3,548 ✭✭✭Draupnir


    id use ASP.NET with C# behind. its pretty straight forward then.


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    I haven't generated forms using xml (I think it's a bad idea personally) but I would imagine you would be interpreting the xml file and creating your web controls in the page init event. This is the only place you can create controls and allow them to persist through postbacks so this is where you would do it and also hook up your event procedures.


  • Moderators, Home & Garden Moderators, Regional Midwest Moderators, Regional West Moderators Posts: 16,724 Mod ✭✭✭✭yop


    musician wrote:
    I haven't generated forms using xml (I think it's a bad idea personally) but I would imagine you would be interpreting the xml file and creating your web controls in the page init event. This is the only place you can create controls and allow them to persist through postbacks so this is where you would do it and also hook up your event procedures.


    That sounds spot on alright.

    I can make my XML file, run my vb.net code and this loads my "new" form.

    It is hooking the metods onto this I cannot get a grip off, maybe I am googling on the wrong key words.


  • Moderators, Science, Health & Environment Moderators Posts: 8,950 Mod ✭✭✭✭mewso


    The thing about dynamically creating controls is if you are planning to capture events and values entered by a user the controls must be created every time the page is initialised otherwise they will dissappear on postback.


  • Advertisement
  • Registered Users Posts: 15,443 ✭✭✭✭bonkey




  • Closed Accounts Posts: 8,264 ✭✭✭RicardoSmith


    yop wrote:
    Lads
    Any of you have any experience of dynamic forms in .NET with XML files and XSLT files???

    I know you can create a form in .NET with a flat XML file but how do you have handle events and that?
    Googled it to death, found some simple examples but not that include events and that actually work, why people post code that does not compile is beyond me


    I don't fully understand it but we've such a system at work. I'm new to the job and new to .Net so its all a bit of a mystery to me. I'm coming from a VB background and no OO experience. From my understanding thus far is that we have a main object that handles all the redirects, and puts the xml/xslt together. Everything pass'es though this one object. I'm not sure how much of it is proprietry though. Our system seems fine if you have a lots of similar forms. But once you need forms that are outside the design scope it becomes very restrictive. But like I said I know very little about it. Its all new to me :confused:


  • Moderators, Home & Garden Moderators, Regional Midwest Moderators, Regional West Moderators Posts: 16,724 Mod ✭✭✭✭yop


    No bother Ricardo, same as, finding some examples but to be honest it is a bit of a pit!! I will keep digging anyway!!


  • Registered Users Posts: 640 ✭✭✭Kernel32


    I don't fully understand it but we've such a system at work. I'm new to the job and new to .Net so its all a bit of a mystery to me. I'm coming from a VB background and no OO experience. From my understanding thus far is that we have a main object that handles all the redirects, and puts the xml/xslt together. Everything pass'es though this one object. I'm not sure how much of it is proprietry though. Our system seems fine if you have a lots of similar forms. But once you need forms that are outside the design scope it becomes very restrictive. But like I said I know very little about it. Its all new to me :confused:

    This sounds very similar to a design I used for a large website. It was .Net but all the markup was done using XSLT with all data streamed to XML. What we did was have each page inherit from a base page which itself inherited from System.Web.UI.Page. The page load of the base page would then be executed for each and every request. We defined an interface that the pages would implement and the base page communicated with the inheriting pages using this interface. This allowed us to create a uniform way for the page to pass the data back to the base page. The base page contained all the code to do the server side transformations plus lots of other stuff. It was a very nice design at the time.

    The downside came later on. We originally had some very good developers work on it and the core design was solid but you actually had to know what you were doing in order to maintain it. It eventually got handed off to developers who didn't know their head from their a$$ and they hacked it up because they didn't understand it.


Advertisement