Nested forms and server-side control in ASP.NET

Discussion in 'Software' started by mredelin, Dec 20, 2007.

  1. mredelin

    mredelin

    Joined:
    Dec 20, 2007
    Messages:
    1
    I am designing a web site with a masterpage and a number of child pages. Because Javascript is necessary both for the Masterpage and for the child pages, I have included a single <FORM> tag in the masterpage:

    <form id="form1" name="form1" runat="server">

    The child pages fit inside this form tag, and do not contain any form tags of their own (to avoid getting an error message stating that I can have only one server side control).

    The problem I am having is that Javascript won't recognize any HTML form object from the child pages -- e.g if I try to access a drop down menu with id=”Cause” in one of my child pages, the debugger gets to the following line of Javascript code:

    var QuestionList = document.form1.Cause;

    and returns the following error message:

    “Microsoft Jscript runtime error: ‘document.form1.cause’ is null or not an object”

    Any ideas? It won't work to create a second form on the child page and embed the "Cause" drop down menu in that, because then I will need to use a second 'runat="server"' statement -- one on the masterpage, one on the child page -- and will get a message saying the page won't load because there is more than one server side control.
    mredelin, Dec 20, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sara_23apr
    Replies:
    1
    Views:
    5,893
  2. thehobbit
    Replies:
    0
    Views:
    3,681
    thehobbit
    Nov 22, 2006
  3. Squiggle
    Replies:
    0
    Views:
    462
    Squiggle
    Aug 21, 2007
  4. onesocksid

    Nested Master Pages with ASP.NET

    onesocksid, Jan 25, 2008, in forum: General Computer Support
    Replies:
    0
    Views:
    885
    onesocksid
    Jan 25, 2008
  5. Kavitha Shalini
    Replies:
    1
    Views:
    453
    Hermit Dave
    Jan 17, 2004
Loading...

Share This Page