Need Help With <form runat=server></form> Tags

Hello everyone I have a real newbie question for anyone that wants to help me out...... I am creating a e-commerce website right now (yes a massive project for me) and I am having this problem.

I have set up my site with a master page and then the content pages. On my master page I have a login view and inside that login view I have a login name

<asp:LoginName ID="LoginName1" runat="server">

I just draged and dropped it so when my users are signed in they can see a welcome message... this login name requires a <form runat=server> Tag in which I've placed in it....(this works fine on its own)

Now on another page thats linked to my master page its actually my register.aspx page that I've created so people can register with me.

I have a Create User Wizard Tag which also works good on its own but it also requires a

<form runat=server> Tag.

<asp:CreateUserWizard ID="CreateUserWizard1" runat="server">

The problem lies when I try to view my page in a browser before debugging ( I dont think it would make a difference if I debuged first ) but I get an error message telling me that I am only allowed one <form runat=server> Tag in my application. I think it has something to do with my register page that refers back to the master page for the standard look of my page and see's the other form tag and gets confused.

So my question is how would I overcome this or what other type of tequnique can I use to make both of these things work at the same time?, is there a way to use two <form runat=server> Tags?

Thank You Very Much.


MaxBounty
Internet Marketing Center
Agloco | Own The Internet
-1
minidak03
8/24/2006 6:08:17 AM
asp.net.navigation-controls 13714 articles. 0 followers. Follow

5 Replies
4424 Views

Similar Articles

[PageSpeed] 10
Get it on Google Play
Get it on Apple App Store

Hello again I have also tried naming the form tags like so <form id="Form1" runat="server"></form>
And the next time it asks me for a form tag I put <form id="Form2" runat="server"></form>

This also did not work for me.
MaxBounty
Internet Marketing Center
Agloco | Own The Internet
0
minidak03
8/24/2006 7:29:39 PM

In your master page put the <form runat="server"> under the <body> tag and the closing </form> tag upper the </body>.

Now, your LoginName control and the <asp:contentplaceholder> are between the <form ruant="server"> and the </form> tags.
In you Content Page(aspx) don't use the <form runat=server> tag.

Everything should works fine.

Roman.

0
Ratiner
8/24/2006 9:15:40 PM

Thanks for the reply Roman however I did exactly what you said and it did not work, the result I had was not an error message but it left my login button and my register button useless, if I clicked on them nothing happened, I tried changing around the destination urls, and still nothing...

but when I put the form tag back right in front of the code block then everything went back to working fine for my login and logout control but I still cannot add another form tag on another content page (register.aspx) without getting the error "Document must contain only one form tag".........here is what I have it set up to be right now (this code is placed on my master page)

<form runat=server>
            <asp:LoginView ID="LoginView2" runat="server">
                <LoggedInTemplate>
                     Welcome Back<br />
                        <asp:LoginName ID="LoginName1" runat="server" style="left: 1px; top: 15px; z-index: 100;" Height="23px" />             
                    <asp:LoginStatus ID="LoginStatus1" runat="server" Style="position: static" />
                    
                    
                </LoggedInTemplate>
                <AnonymousTemplate>
                    <asp:Login ID="Login1" runat="server" BackColor="Bisque" BorderColor="#FF8000"
                        BorderPadding="4" BorderStyle="Solid" BorderWidth="1px" Font-Bold="True" Font-Names="Palatino Linotype"
                        Font-Size="1.3em" ForeColor="Black" Height="135px" Style="position: static" CreateUserText="Register" CreateUserUrl="~/Register.aspx" PasswordRecoveryText="Forgot Your Password?" PasswordRecoveryUrl="~/passwordRecovery.aspx">
                        <TitleTextStyle BackColor="#FF8000" Font-Bold="True" Font-Size="0.9em" ForeColor="White" />
                        <InstructionTextStyle Font-Italic="True" ForeColor="Black" />
                        <TextBoxStyle Font-Size="0.8em" />
                        <LoginButtonStyle BackColor="#FF8000" BorderColor="#FF8000" BorderStyle="Solid" BorderWidth="1px"
                            Font-Names="Verdana" Font-Size="0.8em" ForeColor="White" />
                        <CheckBoxStyle BackColor="Transparent" />
                        <HyperLinkStyle ForeColor="RoyalBlue" />
                    </asp:Login>
                </AnonymousTemplate>
            </asp:LoginView>
          </form> 
 It works great for my one login and logout control but again if I require another form tag for my register page to work I cant put one in......I am betting the solution to this is right in front of my face too...
MaxBounty
Internet Marketing Center
Agloco | Own The Internet
0
minidak03
8/24/2006 9:59:39 PM

Ok finally a bit of success here what I did was move my <form runat=server> Tag up just above my

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">  and left the </form> tag under the </asp:LoginView> this enables me to have a item that requires a form runat=server tag on my master page and I dont even have to worry about putting it in my other content pages......

So with that solved........I went to switch to my design view and got an error saying 4 of my div tags are missing there end tags........but they are not missing there end tags, I never touched those tags I only moved my one <form runat=server> tag out of the div tags........is there anyway to re-bind a start and end tag?.....I tried re-writing that part of the code and still nothing.......If its not one problem its another LOL.

Any help on this would be of great help. Thank You.

 
MaxBounty
Internet Marketing Center
Agloco | Own The Internet
0
minidak03
8/24/2006 11:59:00 PM

VICTORY

For anyone still reading this I have found a solution to one of the biggest headaches alive.....the hiarchy (sorry for the spelling) of tags and the <form runat=server> tag. I'll give you an overview so you dont have to read every single post here.

First off I am using Visual Web Developer 2005 Express Edition.

If you have a masterpage in which an object on that masterpage needs a <form runat=server> tag (like a login) and you also need to put an object in your content pages (that are connectd to your masterpage) that requires another <form runat=server> Tag, all you have to do is make sure your start tag <form runat=server> goes before your

<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

</asp:ContentPlaceHolder>

and make sure your </form> tag goes right after your object on the masterpage...This will enable you to automaticly have a <form runat=server> tag in your content pages and you can also have an object that requires that tag on your masterpage. (WARNING -  putting your <form runat=server> tag right after your <body> tag and your </form> tag just before your </body> tag may result in your log in or what other object you have not to function........this is solved next)

Second is victory number two....you see after I did this I had a problem with some of my start tags not finding there end tags and their end tags not finding there start tags....to get around this trace your code to make sure that they are all in the appropreate tags (like a div tag)....here is some code to help me explain this a bit.

This first chunck of code is the right way to do it

<!-- BEGIN :: MAIN COL -->

<form runat=server>

   <div id="page_maincol">

      <asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

      </asp:ContentPlaceHolder>

   </div>

<!-- //END :: MAIN COL -->

<!-- BEGIN :: RIGHT SIDEBAR -->

<div id="page_rightcol">

   <div class="borderbox2">

      <div class="rightcol_box" style="width: 204px">

           <div id="latest">

               <asp:LoginView ID="LoginView2" runat="server">

         </div>

      </div>

   </div>

</div>

</form>

<!-- //END :: RIGHT SIDEBAR -->

And the wrong way to do it, I'm only containing the first little chunck from above..

<div id="page_maincol">

<

form runat=server>

&nbsp;<asp:ContentPlaceHolder ID="ContentPlaceHolder1" runat="server">

<a href="Default.aspx"><span style="color: #0000ff"></span></a>

</asp:ContentPlaceHolder>

</div>

But notice where my <form runat=server> tag is now.....as far as I can tell this does NOT work because the <form runat=server> tag in contained in the <div id="page_maincol"> and this tag ends before it gets to the login view for the main page and it causes your other tags to become out of sync if you will.....So make sure you just keep a close eye on how your code higharcy is set up for using the <form runat=server> tag.


MaxBounty
Internet Marketing Center
Agloco | Own The Internet
0
minidak03
8/25/2006 1:12:38 AM
Reply:

Similar Artilces:

How to strip a string of <html>, ,</html>, <body>, </body>, <form ... >, </form> tags?
I have stream which is the HTML input of a page. Now I want to use only that part of this page, that is within <form .....> and </form> tags, and excluding these tags.How would I go about stripping <html>, ,</html>, <body>, </body>, <form ... >, </form>, <head> and </head> tags? I have to make sure that <head ...javascript..> and its corresponding </head> tags are not stripped in this process.sun21170    Wait... you said you wanted to strip the head tags, and you're also saying you need to NOT strip the ...

Control <> of type <> must be placed inside a form tag with runat=server
Hi, I created a User Control and tried to place it in the header but I get the following error message Control 'Header1_cal_DropDownList1' of type 'DropDownList' must be placed inside a form tag with runat=server. Why does this happen ? It also does not work for Calendar and Textbox. Thanks Gslick Hi Gslick, Thanks for downloading the Issue Tracker! Unfortunately, the Header.ascx and Footer.ascx files do not include the opening and closing <form runat="Server"> tags. These tags are contained in the individual pages. This means that you ...

What if I remove <form id="form1" runat="server"></form>
If I am creating an aspx page, which does not need to be a form, i.e. no input is taken from the user, do I need to encapsulate the whole page with in  <form1 runat="server">   What are the implications of removing the form? I realize there will be no viewstate, and again, I won't be able to accept user input, but will everything else work as expected? It seems to be so far, I've just not seen ANY examples where the form tag has been removed. Thanks, Darragh You need the server-side form tag if you are going to have server-side controls on the form.RyanRyan Olshan...

can I delete <form id="form1" runat="server"> and </form>
Hi: Our website is written by using simple html code, one of the page has some virtual shopping cart code with <form> ....</form>, (for example here: http://www.centercoin.com/coin_supplies/coin_collecting_starter_set.htm ), if I have 10 products, I will have 10 of <from> ...</form> in this page, that is ok. Now, I am trying to redesign the website using asp.net2.0, I notice all the asp page will automatically create a <form id="form1" runat="server"> ...</form>, such as: <html xmlns="http://www.w3.org/19...

Can't use "defaultbutton" in <form></form> tag in login control page.
I have a login control and I tried to set the default button as the submit button within my form tag in the login page.But, I am getting the following error.Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. I already generated the machine key.Any clue! hi robin, Please try this fix if.. add the below given code into your web.config or the file that you are executing and see if your issue gets fixed. and let me know if this was helpfull."<system.web>  <pages enableViewStateMac="false" />  </system.web> "Oredit the page that is getting loaded <%@ xyz....xyz...** Inherits="MyAssembly.MyPage" enableViewStateMac="False" %>" enableViewStateMac="False" "Joydeep SenDotnet DeveloperDont forget to click “Mark as Answer” on the post that helped you.This credits that member, earns you a point and mark your thread as Resolved for the sake of Future Readers Hi,robinspaul robinspaul: Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <machineKey> configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster. The Same Thing Is Discussed At http://forums.asp.net/p/955145/245300...

Header and Footer user control contains <html>, <body>, and <form> elements
Hi, I have read that we can not/should not use html, body and form tag in the user control. But here these tags are used in the Header control. I would like to know that although we can use those tags in User Control, should we use or should we follow other alternative for this. Thanks in advance, ---------------------------- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconcreatingpageletcontrol.asp ...

Firefox issue with dynamic height inside <form></form> tags
Maybe someone else has experienced this and has a work around.I have a site with a master page that has an iFrame the I load a dynamic URL into, all code works fine. In IE I have no problems but in firefox if the iFrame with the height as a % does NOT resize to the right height if the iframe is inside the <form></form> tags.I've copied the rendered html and put it in a plain html page and when I remove the form tags I have no problems. Has anyone encountered this?Below is my posted .aspx code I've put the style inline in the iFrame for ease of viewing, before it was in a ...

Is it possible to run custom controls in <title><meta> tags without placing the form tag at the start of the page?
Hi, I have created a group of custom controls to allow users/designers to edit the design of dynamic pages easily without doing any code, basically they get given the custom controls and can drop them into web pages and it pulls up the appropriate information when ran on my server (from the querystring/public properties etc), sounds great so far. But my problem is that I want them to be able to put the tags into other parts of the page outside of the body tag, including the pages metadata/title etc eg <title><mytag:pagename runat="server"></title> ...

Programmatic equivalent of <form runat="server"> </from>
When designing an ASPX page, WebControls must be contained into a tag <form runat="server"></form>.I am trying to achieve the same effect but in a programmatic manner within a .Net library (using HttpHandlers).Does anyone has an idea how to do that?Thanks in advance,JoannèsLokad.com, time-series forecasting  Actually, I might have succeeded to solve this issue, but I am not too sure if it's the "right" way to do it.public class MyPage : Page { protected override void CreateChildControls() { HtmlForm htmlForm = new HtmlForm(); Controls.Add(htmlF...

server controls need <form> tag?
hi i first desined aspx page in frontpage and then take it to VS.NET to add server controls , But it send the following error: "Control 'TextBox1' of type 'TextBox' must be placed inside a form tag with runat=server" i think it assume it as html control ,but i used form control,please help me Regards A.Doroudian Correct. All server controls must be enclosed in form tags: <form runat="server"> <!-- Your Controls --> </form>--Brian DesmondWindows Server MVP - Directory Serviceshttp://www.briandesmond.com You might have b...

Inserting <Object> before <form> tag when rendering control
I have an ActiveX object that must be delcared outside the default <form> tag of my web control. In other words, when the control renders and writes out the <form element>, I need to place an object tag BEFORE "<form>" is written. What happens now: <form VIEWSTATE= " ... " > <object> objectstuff </object> </form> what I need is: <object>objectstuff</object> <form VIEWSTATE= " ... " ></form> I have tried the RegisterClientScriptBlock method on a whim, but it places ...

Calling server function outside the form element messes up the hierarchy (like <title> <% myTitle %> <title> )
I'm pretty new to internet development, haven't done any prior to .net, so I might be missing something to obvious.. From what I understand Page.Controls is a collection of 3 elements - literal control, form & anoether litteral control I have a code like this "HtmlForm htmlForm =(HtmlForm) Page.Controls[1];" in my base page, which is inherrited by multiple pages. However, if I have a server side function call outside the <Form></Form> element (like this "<title> <% myTitle %> <title> ") I no longer have a collection of 3 elements...

Writing outside <form></form> ?
Is it possible to write characters outside the form tag? I know, you can't insert controls there, but is it just possible to insert ordinary ascii characters? Yes you can.  Normal HTML tags can be outside of the <Form> tag.  What do you have in mind in relation to this question? Of course I meant how to do that programmaticaly, with asp.net. I believe you can, but haven't tried it.  For example, using Page.Controls collection should be possible to achieve this since your Form resides in this collection.  Again, I haven't tried this so I'm not sure what problem...

Why does <form runat="server"> render <div> around viewstate hidden variable?
I can't figure out why asp.net thinks it needs to render a div around the viewstate hidden variable, or if there's any way to get it to stop doing it:<form name="aspnetForm" method="post" action="default.aspx" id="aspnetForm" class="mainform"><div><input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwULLTEwMDUyNjYzMjhkZA1/6gmEk+w4wUiViNwm8AqBxBo1" /></div> It screws up attempts to style pages in certain ways, and since there's no way to put an id or cl...

Help needed to remove <br> tags in between the <input> tags.
For a particular requirement of mine, I had to create checkboxes "by hand" and add them to a panel. I could not make use of the CheckboxList control.To ensure that each chkbox goes to a new line, I had to add a literalcontrol(<br>) after each chckbox that I added. On rendering the chkbox section of the page has this source - <input id="id0" type="checkbox" name="id0" /><label for="id0">ABC1</label><br><input id="id1" type="checkbox" name="id1" /><label for="id1"...

superreview granted: [Bug 307819] HTML <label for> not exposed as name for form controls not in <form> : [Attachment 195496] Simple 1 line patch
neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> has granted Aaron Leventhal <aaronleventhal@moonset.net>'s request for superreview: Bug 307819: HTML <label for> not exposed as name for form controls not in <form> https://bugzilla.mozilla.org/show_bug.cgi?id=307819 Attachment 195496: Simple 1 line patch https://bugzilla.mozilla.org/attachment.cgi?id=195496&action=edit ...

superreview requested: [Bug 307819] HTML <label for> not exposed as name for form controls not in <form> : [Attachment 195496] Simple 1 line patch
Aaron Leventhal <aaronleventhal@moonset.net> has asked neil@parkwaycc.co.uk <neil.parkwaycc.co.uk@myrealbox.com> for superreview: Bug 307819: HTML <label for> not exposed as name for form controls not in <form> https://bugzilla.mozilla.org/show_bug.cgi?id=307819 Attachment 195496: Simple 1 line patch https://bugzilla.mozilla.org/attachment.cgi?id=195496&action=edit ...

>>>> Heads up <<<<
I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus in it. The name is "VirusBurst" Luckily, I did not install this software and Norton's quarantined it so I could delte it, which I have done. Symantec has not completed analysis of this particular piece of garbage but it did catch the sig. If you have installed Pamela, you may be in trouble. Duffy wrote: > I just got a warning from Norton that "PamelaSetup-Basic.exe" has a virus > in it. The name is "VirusBurst" > > Luckily, I did not install...

<form></form>'s Default Button??
I need some serious help here. I know that an asp page can only have one form tag and for all intensive purposes it seems that the first button in the form gets the enter focus. This is rather cumbersome and I was wondering how I could go about changing this? View this thread This is a sample for ASP.Net to show, how easy it is to 'force' a default button for a textbox. You can even try for some third party control http://www.metabuilders.com/Tools/DefaultButtons.aspx~ Firoz AnsariPune, Indiahttp://www.firozansari.comWhy product testing is important? I just found a much easy ...

data controls that output <div> and not <span> or <table> tags
 hi are there any controls that can output <div>?or can someone show me how to build my own controls for displaying data in div format?  Hi,use a Repeater control. Probably, haven't tested it myself, in .NET 3.5 you could also use the ListView for this.Grz, Kris. Read my blog. Handy Firefox plugins for web developers.Workaround for non working Mark as answer buttons....

Viewstate <--> Methods; Session <--> Web Forms; Something?? <--> Email?
This is along shot but I'm cautiously optimistic someone has thought of it long before and possibly an simple answer does exist... If I want to move a thing between methods (I still call them subroutines) I can put the thing in a ViewState and then later take it out. If I want to move a thing between web forms, I can put the thing into a Session and then later take it out. Is there a somethingX that if I want to I can take the thing put it into a somethingX put the somethingX into a file and email the file take the somethingX out of the file read the somethingX into whatever it was before? I'm guessing this might be something  easy, it's just I need the name so I can go Google it. Thanks in advance for your help!  Larry Dechent - Sampson Coatingswww.wemakebetterpaint.com has 29 examples (C# & VB) to help beginners with ASP.NET.  Hi Larry,What you are asking is essentially serialize/deserialize an object. So you can write to an xml file or something. Then you can read that xml file back and construct the object. Here is a simple example. If you are not happy with it.. you should be able to find tons of examples in google.. Look for Serialization/Deserialization in .nethttp://www.codeguru.com/columns/dotnet/article.php/c5821 Kumar Reddi It looks like the question has been answered.  I'm going to try it right now.  My goal was, after an ArrayList was built, to be able to "package" and...

Custom Composite Control
Let's start with what I'm looking for: <controls:MyWrapper id="Blah" runat="server">     <content>         <controls:Exporter id="Blah1" runat="server"  {This control has an image button and some other controls} />         <controls:GridView {This is a fully functional GridView} />         <controls:CustomFooterDetailer id="Yadda" runat="server" />     </content> </controls:MyWrapper>  I know I need to create my control, inherits composite control, and create some templates and designers. I have yet to find an example online that explains how to get this particular functionality. I want to restrict the content to only be allowed to use the three controls I showed above, and those controls need to be able to reference the GridView control.   here is the basic start ...you will find more help making your custom appear realistic in design mode. public class Wrapper : CompositeControl {private GridView _grid = new GridView();public GridView Grid { get { return _grid; }set { _grid = value; } }protected override void CreateChildControls() {base.CreateChildControls();this.Controls.Add(_grid);   // add as many control as you want.... } }   I have no problem with the bas...

>>>> ROOT Exploit in SAMBA <<<<<<
"A flaw has been detected in the Samba main smbd code which could allow an external attacker to remotely and anonymously gain Super User (root) privileges on a server running a Samba server. This flaw exists in previous versions of Samba from 2.0.x to 2.2.7a inclusive. This is a serious problem and all sites should either upgrade to Samba 2.2.8 immediately or prohibit access to TCP ports 139 and 445." http://us3.samba.org/samba/samba.html Binaries are available from Samba for RedHat, and some other distributions. So far as I can tell, the RedHat update mirrors I norm...

this in vb.net: <% using Html.Form<ProductController>(p=>p.Update(ViewData.Product.ProductID))%>
How do I do this in VB.net:<% using Html.Form<ProductController>(p=>p.Update(ViewData.Produc t.ProductID))%>This is using a lambda for the form tag in c#, I searched everywhere for the correct vb.net syntax? I tried this with no luck:<% Using Html.Form(Of ProductController)(Function(p) p = ViewData.Product.ProductID)%>   VB.NET doesn't support Lambda expressions.   View My Blog Download My URL Rewriter and Reverse ProxyOnly $9.95/month, ASP.NET, 2GB & SQL 2005 alivemedia:Function(p) p = ViewData.Product.ProductID I think the proper syn...

Web resources about - Need Help With <form runat=server></form> Tags - asp.net.navigation-controls

Resources last updated: 3/10/2016 7:54:23 PM