DotNetNewsgroup.com  
web access to complete list of Microsoft.NET newsgroups
   home   |   control panel login   |   archive  |  
 
  carried group
academic
adonet
aspnet
aspnet.announcements
aspnet.buildingcontrols
aspnet.caching
aspnet.datagridcontrol
aspnet.mobile
aspnet.security
aspnet.webcontrols
aspnet.webservices
assignment_manager
datatools
dotnet.distributed_apps
dotnet.general
dotnet.myservices
dotnet.nternationalization
dotnet.scripting
dotnet.security
dotnet.vjsharp
dotnet.vsa
dotnet.xml
dotnetfaqs
framework
framework.clr
framework.compactframework
framework.component_services
framework.controls
framework.databinding
framework.drawing
framework.enhancements
framework.interop
framework.odbcnet
framework.performance
framework.remoting
framework.sdk
framework.setup
framework.webservices
framework.windowsforms
framework.wmi
frwk.windowsforms.designtime
lang.csharp
lang.jscript
lang.vb
lang.vb.controls
lang.vb.data
lang.vb.upgrade
lang.vc
lang.vc.libraries
  
 
start date: Sat, 11 Aug 2007 22:51:01 +0100,    posted on: microsoft.public.dotnet.framework.aspnet        back       

Thread Index
  1    Aussie Rules am
          2    Mark Rae [MVP]
          3    Teemu Keiski
          4    (Steven Cheng[MSFT])
                 5    (Steven Cheng[MSFT])
          6    Aussie Rules am
                 7    (Steven Cheng[MSFT])


basic form question - two forms one page. ??   
Hi,

I have an asp.net 2.0 page that has two sections. Each section allows the 
user to enter a value into a text box, click a button and then perform some 
function. Each text boxes function is different to the other and takes the 
user to a different part of the web site after doing some SQL work

I have placed a form tag around each of the text boxes section. Each has a 
different 'form id', however when i try to execute the web site, it says 'A 
page can have only one server-side form tag.

How do i cope with my situation ?

Thanks
Date:Sat, 11 Aug 2007 22:51:01 +0100   Author:  

Re: basic form question - two forms one page. ??   
"Aussie Rules" <AussieRules@nospam.nospam> wrote in message 
news:uBeprJG3HHA.4672@TK2MSFTNGP05.phx.gbl...


> How do i cope with my situation ?


Use one form.

Each button has its own server-side events, so just take appropriate action 
as required.

E.g.

Button1 does its processing and then does a Response.Redirect to page2.aspx 
(or whatever)

Button2 does its processing and then does a Response.Redirect to page7.aspx 
(or whatever)


-- 
Mark Rae
ASP.NET MVP
http://www.markrae.net
Date:Sat, 11 Aug 2007 23:12:16 +0100   Author:  

Re: basic form question - two forms one page. ??   
You can have multiple forms but only one can be server-side e.g with 
runat="server". You can use cross-page postbacks in ASP.NET 2.0 to post on 
different pages per button basis (set PostBackUrl="targetpage.aspx" on the 
Button) while having single form on the Page. Assuming that you initiate 
some task based on Button click...

-- 
Teemu Keiski
AspInsider, ASP.NET MVP
http://blogs.aspadvice.com/joteke
http://teemukeiski.net

"Aussie Rules" <AussieRules@nospam.nospam> wrote in message 
news:uBeprJG3HHA.4672@TK2MSFTNGP05.phx.gbl...

> Hi,
>
> I have an asp.net 2.0 page that has two sections. Each section allows the 
> user to enter a value into a text box, click a button and then perform 
> some function. Each text boxes function is different to the other and 
> takes the user to a different part of the web site after doing some SQL 
> work
>
> I have placed a form tag around each of the text boxes section. Each has a 
> different 'form id', however when i try to execute the web site, it says 
> 'A page can have only one server-side form tag.
>
> How do i cope with my situation ?
>
> Thanks 
Date:Sun, 12 Aug 2007 09:32:09 +0300   Author:  

Re: basic form question - two forms one page. ??   
Hi Aussie,

The ASP.NET web page is a customized html based web page, one particularity 
is that ASP.NET web page use a <form> with "runat=server" attribute, this 
is used as the container of any other ASP.NET server controls, and all 
those server controls' postback event can be correctly detected if they're 
put inside this server-side form tag. Also, there can only contains single 
"runat=server" <form> tag in an ASP.NET web page.

For your scenario, if you want to post different data field entries through 
different button on the same page, I think you can consider the following 
two means:

1. If you're using ASP.NET 2.0, you can utilize the "cross-page post" 
feature, this can let you define multiple buttons on a single page and 
configure them to postbac k to different url:

#How to: Post ASP.NET Web Pages to a Different Page
http://msdn2.microsoft.com/en-us/library/ms178140.aspx

#Cross-Page Posting in ASP.NET Web Pages  
http://msdn2.microsoft.com/en-us/library/ms178139.aspx


2. You can certainly put multiple html <form> tags in a single ASP.NET web 
page. However, make sure that only one form has the "runat" attribute set 
as "true".  Also, for ASP.NET server controls, they can only be put in 
"runat=server" <form>     e.g.


=======in aspx page========

<body>
...
<form id="form1" runat="server">
you can put ASP.NET server controls here
.........
</form>

<form id="form2" action="other page'>
you can put only pure html elements here
........
</form>

<form id="form2" action="other page'>
you can put only pure html elements here
........
</form>
........
=============

If you have any more specific questions on this, please feel free to post 
here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

 

==================================================

Get notification to my posts through email? Please refer to 
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

 

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues 
where an initial response from the community or a Microsoft Support 
Engineer within 1 business day is acceptable. Please note that each follow 
up response may take approximately 2 business days as the support 
professional working with you may need further investigation to reach the 
most efficient resolution. The offering is not appropriate for situations 
that require urgent, real-time or phone-based interactions or complex 
project analysis and dump analysis issues. Issues of this nature are best 
handled working with a dedicated Microsoft Support Engineer by contacting 
Microsoft Customer Support Services (CSS) at 
http://msdn.microsoft.com/subscriptions/support/default.aspx.

==================================================
 	

This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Mon, 13 Aug 2007 02:40:06 GMT   Author:  

Re: basic form question - two forms one page. ??   
Hi Aussie,

Have you got any further idea on this issue or does the suggestion in 
previous replies help you some? If there is anything else we can help, 
please feel free to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


This posting is provided "AS IS" with no warranties, and confers no rights.
Date:Wed, 15 Aug 2007 01:09:45 GMT   Author:  

Re: basic form question - two forms one page. ??   
Hi,

thanks this is now sorted with you input..

thanks
"Steven Cheng[MSFT]"  wrote in message 
news:FPVoAkt3HHA.4200@TK2MSFTNGHUB02.phx.gbl...

> Hi Aussie,
>
> Have you got any further idea on this issue or does the suggestion in
> previous replies help you some? If there is anything else we can help,
> please feel free to post here.
>
> Sincerely,
>
> Steven Cheng
>
> Microsoft MSDN Online Support Lead
>
>
> This posting is provided "AS IS" with no warranties, and confers no 
> rights.
> 
Date:Wed, 15 Aug 2007 12:28:54 +0100   Author:  

Re: basic form question - two forms one page. ??   
Glad to be of assistance!

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead
Date:Wed, 15 Aug 2007 12:34:45 GMT   Author:  

Google
 
Web dotnetnewsgroup.com


COPYRIGHT ?2005, EUROFRONT WORLDWIDE LTD., ALL RIGHT RESERVE  |   Contact us