469,926 Members | 1,558 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,926 developers. It's quick & easy.

Multiple Forms on page

hello,

I have to deal with the weird limitation of asp.net, as I need to have
multiple forms on my page, well three at least actually, one for the login,
one for the search engine, and another one for a certain bulletin list,
however asp.net allows only one form per page with runat="server" attribute,
I am aware of the visibility issue and that I can hide all of the forms
except one but this won't help cause I need all of the three forms visible.

The solution I got so far was to enclose all the body of the page with a
form tag (<body><form runat...>), however it doesn't appear to be a rational
solution to me; why would I put all the elements of the page in a form tag.
What other workarounds could I use?

Thanks
Yehia A.Salam

Apr 22 '07 #1
3 3906
On Sun, 22 Apr 2007 02:23:19 +0200, "Yehia A.Salam"
<ye*****@hotmail.comwrote:
>hello,

I have to deal with the weird limitation of asp.net, as I need to have
multiple forms on my page, well three at least actually, one for the login,
one for the search engine, and another one for a certain bulletin list,
however asp.net allows only one form per page with runat="server" attribute,
I am aware of the visibility issue and that I can hide all of the forms
except one but this won't help cause I need all of the three forms visible.

The solution I got so far was to enclose all the body of the page with a
form tag (<body><form runat...>), however it doesn't appear to be a rational
solution to me; why would I put all the elements of the page in a form tag.
What other workarounds could I use?
Why look for a workaround to an artificial constraint? Use controls as
containers for the various piece parts instead of forms.

You may be in the situation where each of the existing forms use some
JavaScript. on the client-side to build query strings instead of
performing postbacks. If this is the case you may need to investigate
WriteClientScriptBlock and similar methods of the System.Web.UI.Page
type to write the scripts at run time. At the same time you will need
to use controls' ClientID (decorated name) rather than the ID
property.

regards
A.G.
Apr 22 '07 #2
THe "weird limitation" you describe isn't a limitation at all, it's a
feature. Controls in an ASP.NET page need to be wrapped inside a form because
the entire postback event model depends on this.
There is no reason why a postback generated by any of your controls all of
which are wrapped inside a single FORM tag cannot handle individual specific
actions that your business logic dictates.
Peter

--
Site: http://www.eggheadcafe.com
UnBlog: http://petesbloggerama.blogspot.com
Short urls & more: http://ittyurl.net


"Yehia A.Salam" wrote:
hello,

I have to deal with the weird limitation of asp.net, as I need to have
multiple forms on my page, well three at least actually, one for the login,
one for the search engine, and another one for a certain bulletin list,
however asp.net allows only one form per page with runat="server" attribute,
I am aware of the visibility issue and that I can hide all of the forms
except one but this won't help cause I need all of the three forms visible.

The solution I got so far was to enclose all the body of the page with a
form tag (<body><form runat...>), however it doesn't appear to be a rational
solution to me; why would I put all the elements of the page in a form tag.
What other workarounds could I use?

Thanks
Yehia A.Salam
Apr 22 '07 #3
In addition to the other answers, you can still use "normal" FORMs without
the runat tag. You can post them to an ASPX page and use the Request object
to read the values.

"Yehia A.Salam" <ye*****@hotmail.comwrote in message
news:5D**********************************@microsof t.com...
hello,

I have to deal with the weird limitation of asp.net, as I need to have
multiple forms on my page, well three at least actually, one for the
login, one for the search engine, and another one for a certain bulletin
list, however asp.net allows only one form per page with runat="server"
attribute, I am aware of the visibility issue and that I can hide all of
the forms except one but this won't help cause I need all of the three
forms visible.

The solution I got so far was to enclose all the body of the page with a
form tag (<body><form runat...>), however it doesn't appear to be a
rational solution to me; why would I put all the elements of the page in a
form tag. What other workarounds could I use?

Thanks
Yehia A.Salam

Apr 22 '07 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by James X. Li | last post: by
8 posts views Thread by TJS | last post: by
5 posts views Thread by Alex Maghen | last post: by
1 post views Thread by draw | last post: by
2 posts views Thread by =?Utf-8?B?VGFtbXkgTmVqYWRpYW4=?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.