473,396 Members | 2,011 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,396 software developers and data experts.

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

Aug 11 '07 #1
6 2955
"Aussie Rules" <Au*********@nospam.nospamwrote in message
news:uB**************@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

Aug 11 '07 #2
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" <Au*********@nospam.nospamwrote in message
news:uB**************@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

Aug 12 '07 #3
Hi Aussie,

The ASP.NET web page is a customized html based web page, one particularity
is that ASP.NET web page use a <formwith "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" <formtag 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 <formtags 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/subscripti...ult.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/subscripti...t/default.aspx.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


Aug 13 '07 #4
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.

Aug 15 '07 #5
Hi,

thanks this is now sorted with you input..

thanks
"Steven Cheng[MSFT]" <st*****@online.microsoft.comwrote in message
news:FP**************@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.
Aug 15 '07 #6
Glad to be of assistance!

Have a good day!

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead

Aug 15 '07 #7

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

Similar topics

4
by: Dave | last post by:
Hi, Is there anyway to mimic forms authentication's loginUrl and RedirectFromLoginPage functionality using Windows authentication? We are developing intranet sites using basic authentication...
6
by: Erez Shor | last post by:
Hi, I need to build and asp page which access a remote windows server's registry and create a registry key. In order for the ASP page to be able to access the registry on the remote server I need...
6
by: Bliss | last post by:
ok I am rather new to the .net framework. I come from a J2EE background. I am not a java snob though =-) I happen to like both platforms. At any rate I came accross a simple problem that I was...
1
by: IronYuppie | last post by:
This seems to be so straightforward, but I keep having the following issue. I'm trying to make a login and create user page, but everytime i click through the CreateNewUser url, it brings me back...
4
by: | last post by:
I have a "form field highlight" javascript that I've added to some of my ASP.NET forms using the following syntax: body.Attributes.Add("onClick", "highlight(event);");...
7
by: gerryLowry::Ability Business Computer Services {KC | last post by:
"Getting Back Your Visual Basic 6.0 Goodies" by Billy Hollis, 2003-5-14, states: "Getting a Forms Collection Visual Basic 6.0 developers are often fond of looping through the currently loaded...
13
by: usenet | last post by:
How and where can one find out about the basics of VB/Access2003 syntax? I am a died in the wool C/C++/Java Linux/Unix programmer and I am finding it difficult to understand the program format...
21
by: Roland | last post by:
The following issue is puzzling me: There are 2 ways of writing the code below: .... Dim fnt as Font = New Font(...) DrawString(myText, fnt,...) fnt.dispose(). or DrawString(myText, New...
2
by: BobF | last post by:
<given> When starting a new AJAX Control enabled site, a set of files are created. These are created -without- a master page. </given> To add a master page, I've been adding the master via...
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?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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.