Dynamic includes

Last post 10-25-2005 11:42 AM by pegasus-si. 2 replies.

Sort Posts:

  • Crying [:'(] Dynamic includes

    10-18-2005, 6:25 PM
    • Member
      95 point Member
    • prothrock
    • Member since 09-22-2005, 5:18 PM
    • Posts 19
    I'm writing a form that was supposed to use conditional validation, something I found to be too expensive or too time consuming to be feasible. Instead, I'm using a multi-page form to do the same thing. I need to turn off certain form elements and their validation based on what a user selects on the previous form, which can be a combination of three things: Mail, Email, or Download. (Don't ask me why they would need something emailed and downloaded. It's what the client is asking for.)

    The user is required to submit their name (first and last) for everything. If they select Mail, they need to enter their address which is validated using ASP.NET's validation and UPS address validation (for which I've written a class). If they select email, they are required to enter their email address.

    In PHP, I would just display these form elements on the fly using if statements. But since you're not supposed to do that in ASP.NET, I need a way to display these elements on the page, with their validation, without resorting to creating seven different forms and redirecting to them based on the selections of the user.

    I can try to talk to the client to allow only one selection instead of the combination, but I still don't know how to get around making three or more seperate web forms to handle the conditional validation requirements.

    If this is too obscure I'll try to post more details and examples tomorrow.

  • Re: Dynamic includes

    10-18-2005, 7:24 PM
    • Member
      475 point Member
    • TylerFree
    • Member since 06-22-2005, 7:55 PM
    • Olympia, WA
    • Posts 94
    You can put your elements within Panels <asp:panel id="panel1" runat="server" etc...

    And in your code behind, set panel1.visible = false, etc. to hide/show panels based on your criteria.

    Let me know if this makes sense.

    Thanks,
    Tyler

  • Re: Dynamic includes

    10-25-2005, 11:42 AM
    • Member
      45 point Member
    • pegasus-si
    • Member since 11-30-2003, 2:42 AM
    • Posts 9
    One solution is to make a table where each row contains seperate web form.Make rows "runat="server" and then use "visible property".

    So:
    You make the first row containing name and option for email and mail.You make this row visible.
    You make another row for mail and another for email.You set this to "visible" to false;
    If user selects mail you set the first row "visible" to false and mail row to "true" and so on.



    Greetings from Slovenia
    Daniel



Page 1 of 1 (3 items)