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 |
![]() |
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 |
![]() |
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 |
![]() |
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 |
![]() |
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 |
![]() |
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> <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 |
![]() |