Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET restricts server forms to one per page... workarounds... ???

Reply
Thread Tools

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

 
 
nzanella@gmail.com
Guest
Posts: n/a
 
      01-12-2005

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

 
Reply With Quote
 
 
 
 
Philip Q [MVP]
Guest
Posts: n/a
 
      01-12-2005
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]

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      01-12-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
MattC
Guest
Posts: n/a
 
      01-14-2005
Just set CausesValidation=false on both buttons and handle the validation in
teh code behind for the value relating to the button clicked.

MattC
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed) 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
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
TSA restricts lithium batteries on airplanes TH O Digital Photography 156 01-16-2008 12:04 AM
restricts Access to DLL jkilmister@gmail.com ASP .Net Security 1 07-13-2007 12:27 PM
VOIP policy map restricts http and Term Service Traffic - Need Resolution Andrew Albert Cisco 0 02-08-2005 05:09 AM
Static class - one per JVM or one per app? junk1@davidbevan.co.uk Java 5 12-20-2004 08:26 PM
Static class - one per JVM or one per app? junk1@davidbevan.co.uk Java 0 12-20-2004 08:15 PM



Advertisments