Any way to include an HTML form with server-side controls?

Discussion in 'ASP .Net' started by Paul, Sep 5, 2006.

  1. Paul

    Paul Guest

    Hi all,

    I have a page with a mutli view control where one of the views needs to
    contain a separate HTML get form with a submit button that goes to
    another page. In ASP this was no problem - there was no container form
    and it just went to the target page. In ASP .NET however, there is a
    container form and having an embedded form breaks the page. Adding
    another server-side form just gets the "A page can have only one
    server-side Form tag" runtime error.

    I need to have some server-side logic in the HTML form to determine
    whether it is displayed or not. I can use the same form and catch the
    server-side Click event for the other button, but that relies on
    javascript to wire up a default button for the main form.

    How can I achive this in .NET *without using javascript*?

    Thanks,

    Paul
     
    Paul, Sep 5, 2006
    #1
    1. Advertising

  2. Hi,

    Paul wrote:
    > Hi all,
    >
    > I have a page with a mutli view control where one of the views needs to
    > contain a separate HTML get form with a submit button that goes to
    > another page. In ASP this was no problem - there was no container form
    > and it just went to the target page. In ASP .NET however, there is a
    > container form and having an embedded form breaks the page. Adding
    > another server-side form just gets the "A page can have only one
    > server-side Form tag" runtime error.
    >
    > I need to have some server-side logic in the HTML form to determine
    > whether it is displayed or not. I can use the same form and catch the
    > server-side Click event for the other button, but that relies on
    > javascript to wire up a default button for the main form.
    >
    > How can I achive this in .NET *without using javascript*?
    >
    > Thanks,
    >
    > Paul


    The "one form" limitation is a real PITA.

    Does it absolutely have to be a button? Changing a button's default
    action without using any JavaScript is AFAICS impossible...

    If you can use a hyperlink instead, then it's easy to make a GET

    http://www,domain.com/page.aspx?param1=value1&param2=value2

    Why can't you use any JavaScript at all?

    HTH,
    Laurent
    --
    Laurent Bugnion, GalaSoft
    Software engineering: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, Sep 5, 2006
    #2
    1. Advertising

  3. Paul

    Paul Guest

    Hi Laurent,

    I have a general UI preference of using buttons for attracting a user's
    attention. I want to avoid javascript so that I know it will work for
    everyone.

    Is a link the only other non-javascript alternative?

    Thanks,

    Paul

    Laurent Bugnion wrote:
    > Hi,
    >
    > Paul wrote:
    > > Hi all,
    > >
    > > I have a page with a mutli view control where one of the views needs to
    > > contain a separate HTML get form with a submit button that goes to
    > > another page. In ASP this was no problem - there was no container form
    > > and it just went to the target page. In ASP .NET however, there is a
    > > container form and having an embedded form breaks the page. Adding
    > > another server-side form just gets the "A page can have only one
    > > server-side Form tag" runtime error.
    > >
    > > I need to have some server-side logic in the HTML form to determine
    > > whether it is displayed or not. I can use the same form and catch the
    > > server-side Click event for the other button, but that relies on
    > > javascript to wire up a default button for the main form.
    > >
    > > How can I achive this in .NET *without using javascript*?
    > >
    > > Thanks,
    > >
    > > Paul

    >
    > The "one form" limitation is a real PITA.
    >
    > Does it absolutely have to be a button? Changing a button's default
    > action without using any JavaScript is AFAICS impossible...
    >
    > If you can use a hyperlink instead, then it's easy to make a GET
    >
    > http://www,domain.com/page.aspx?param1=value1&param2=value2
    >
    > Why can't you use any JavaScript at all?
    >
    > HTH,
    > Laurent
    > --
    > Laurent Bugnion, GalaSoft
    > Software engineering: http://www.galasoft-LB.ch
    > Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    > Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Paul, Sep 5, 2006
    #3
  4. Paul wrote:
    > I have a general UI preference of using buttons for attracting a user's
    > attention. I want to avoid javascript so that I know it will work for
    > everyone.


    You could use CSS to make the link look like a button, or use an image
    instead of text for the link.

    --
    BVH
     
    Bart Van Hemelen, Sep 5, 2006
    #4
  5. Hi,

    Paul wrote:
    > Hi Laurent,
    >
    > I have a general UI preference of using buttons for attracting a user's
    > attention. I want to avoid javascript so that I know it will work for
    > everyone.
    >
    > Is a link the only other non-javascript alternative?
    >
    > Thanks,
    >
    > Paul
    >
    > Laurent Bugnion wrote:


    In that case I recommend using Bart's proposed solution (an image
    looking like a button). A strictly no-JavaScript solution will only be
    able to submit the form using the target defined in the "action" attribute.

    Non-JavaScript enabled solutions must rely on the most basic HTTP
    mechanisms only, and they are very primitive. ASP.NET (with the "one
    form" restriction) made it even more restrictive, unfortunately.

    HTH,
    Laurent
    --
    Laurent Bugnion, GalaSoft
    Software engineering: http://www.galasoft-LB.ch
    Private/Malaysia: http://mypage.bluewin.ch/lbugnion
    Support children in Calcutta: http://www.calcutta-espoir.ch
     
    Laurent Bugnion, Sep 5, 2006
    #5
    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. Replies:
    2
    Views:
    391
  2. Deane
    Replies:
    3
    Views:
    1,218
    Deane
    Aug 1, 2007
  3. Andreas Bogenberger
    Replies:
    3
    Views:
    1,003
    Andreas Bogenberger
    Feb 22, 2008
  4. Replies:
    0
    Views:
    124
  5. Replies:
    0
    Views:
    110
Loading...

Share This Page