473,394 Members | 1,740 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

ASP.NET restricts server forms to one per page... workarounds... ???


Hello,

I just ran into the restriction of ASP.NET allowing no more than
one <form> tag with the runat="server" attribute per page. This
seems like a big restriction to me. I ran across the following
article:

http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/

which suggests the following workaround (which consists of
defining user controls for the contents of each form and
incorporating the result into one single form):

<form runat="server">
<msdn:MyRegForm runat="server" id="userRegForm"
action="register.aspx" />
<hr>
<msdn:MyLogForm runat="server" id="userLogForm"
action="login.aspx" />
</form>

However, I was not satisfied with this solution. The reason
is that if there are ASP validation controls on both forms
then error messages will be displayed for Form B whenever
the user submits Form A and conversely, which is plain
incorrect. So the solution described therein is just
not really a solution.

What I am going to do is ditch the ASP.NET framework's
web controls altogether and code my pages PHP style,
with ASP and no .NET, and manage my own POST variables.

Is there another way that actually works and isn't messy?
Regards,

Thanks,

Neil

Nov 19 '05 #1
3 1292
There are several options available to you, take a look at the article -
http://aspalliance.com/415
Some of the methods are quite messy, but can be simplified depending on your
situation.

--
Philip Q
Microsoft MVP [ASP.NET]

<nz******@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...

Hello,

I just ran into the restriction of ASP.NET allowing no more than
one <form> tag with the runat="server" attribute per page. This
seems like a big restriction to me. I ran across the following
article:

http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/

which suggests the following workaround (which consists of
defining user controls for the contents of each form and
incorporating the result into one single form):

<form runat="server">
<msdn:MyRegForm runat="server" id="userRegForm"
action="register.aspx" />
<hr>
<msdn:MyLogForm runat="server" id="userLogForm"
action="login.aspx" />
</form>

However, I was not satisfied with this solution. The reason
is that if there are ASP validation controls on both forms
then error messages will be displayed for Form B whenever
the user submits Form A and conversely, which is plain
incorrect. So the solution described therein is just
not really a solution.

What I am going to do is ditch the ASP.NET framework's
web controls altogether and code my pages PHP style,
with ASP and no .NET, and manage my own POST variables.

Is there another way that actually works and isn't messy?
Regards,

Thanks,

Neil

Nov 19 '05 #2
The Validation issue is solvable. Microsoft will fix it in ASP.NET 2.0 by
introducing Validation Groups. This allows you to assign a group name to a
submit button and the validators it fires.

Today, my "Professional Validation And More"
(http://www.peterblum.com/vam/home.aspx) already gives you validation groups
along with numerous other much requested enhancements to validation such as
client-side validation on the Mozilla browsers, Opera 7 and Safari.

--- Peter Blum
www.PeterBlum.com
Email: PL****@PeterBlum.com
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<nz******@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...

Hello,

I just ran into the restriction of ASP.NET allowing no more than
one <form> tag with the runat="server" attribute per page. This
seems like a big restriction to me. I ran across the following
article:

http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/

which suggests the following workaround (which consists of
defining user controls for the contents of each form and
incorporating the result into one single form):

<form runat="server">
<msdn:MyRegForm runat="server" id="userRegForm"
action="register.aspx" />
<hr>
<msdn:MyLogForm runat="server" id="userLogForm"
action="login.aspx" />
</form>

However, I was not satisfied with this solution. The reason
is that if there are ASP validation controls on both forms
then error messages will be displayed for Form B whenever
the user submits Form A and conversely, which is plain
incorrect. So the solution described therein is just
not really a solution.

What I am going to do is ditch the ASP.NET framework's
web controls altogether and code my pages PHP style,
with ASP and no .NET, and manage my own POST variables.

Is there another way that actually works and isn't messy?
Regards,

Thanks,

Neil

Nov 19 '05 #3
Just set CausesValidation=false on both buttons and handle the validation in
teh code behind for the value relating to the button clicked.

MattC
<nz******@gmail.com> wrote in message
news:11*********************@c13g2000cwb.googlegro ups.com...

Hello,

I just ran into the restriction of ASP.NET allowing no more than
one <form> tag with the runat="server" attribute per page. This
seems like a big restriction to me. I ran across the following
article:

http://msdn.microsoft.com/msdnmag/is...5/CuttingEdge/

which suggests the following workaround (which consists of
defining user controls for the contents of each form and
incorporating the result into one single form):

<form runat="server">
<msdn:MyRegForm runat="server" id="userRegForm"
action="register.aspx" />
<hr>
<msdn:MyLogForm runat="server" id="userLogForm"
action="login.aspx" />
</form>

However, I was not satisfied with this solution. The reason
is that if there are ASP validation controls on both forms
then error messages will be displayed for Form B whenever
the user submits Form A and conversely, which is plain
incorrect. So the solution described therein is just
not really a solution.

What I am going to do is ditch the ASP.NET framework's
web controls altogether and code my pages PHP style,
with ASP and no .NET, and manage my own POST variables.

Is there another way that actually works and isn't messy?
Regards,

Thanks,

Neil

Nov 19 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: David C. Holley | last post by:
How would I run a JavaScript function in a *.asp page and then pass the value returned to VBScript for further processing? ***Converting the function to VBScript is *NOT* an option.
4
by: HeroOfSpielburg | last post by:
Hello, I am trying to using the Shift_JIS character set in my web pages, and have specified it as such in the <head>. <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> ...
2
by: Hazzard | last post by:
I just realized that the code I inherited is using all asp.net server controls (ie. webform controls) and when I try to update textboxes on the client side, I lose the new value of the textbox when...
15
by: randyr | last post by:
I am developing an asp.net app based on a previous asp application. in the asp applications global.asa file I had several <object id="id" runat="server" scope="scope" class="comclass"> tags for...
22
by: Mr Newbie | last post by:
I was thinking about developing a workflow application yesterday and was musing over the different approaches than one could take in restricting specific actions on a ticket( Form ) at any said...
5
by: Alan Silver | last post by:
Hello, Reading articles on the various forms of attack that people try against web sites, it seems that a lot of them involve people modifying a page and posting it back to the server. Thus, if...
1
by: Jules | last post by:
For a project I'm developing a custom ASP.NET 2.0 website. The case: - Forms authentication - Cookieless forms authentication and sessionstates is enabled via cookieless="AutoDetect". - On the...
4
by: =?UTF-8?Q?Jeff=E2=80=A6Relf?= | last post by:
Hi T_Wake, Speaking of my userContent.CSS, You told me: The text follows an inline image unless the CSS gives it a float value which allows it to overwrite text. Web pages can't override my...
18
by: maxhugen | last post by:
I have an Access app (split into FE and BE) running for some years, that is now also being used in a second office, connected by a WAN. This office has network problems, as it's over-utilized (97%...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.