Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can't find the file?! 3

Status
Not open for further replies.

andym0908

Programmer
Feb 25, 2008
19
GB
Hi

I have VERY simple project right now.

But, strange thing happened - I created a new ASPX page (and it's associative .cs code behind file). For some reason, the application can't find the page. The file is in the normal place (root) of the project!! Very odd... Why on earth would the application not be able to see the page?

I can open and edit the file in VS2008 but, it's not showing when I browse to it. In my web.config file, I have set the custom errors on, but when I try to see the page, the custom error page comes up (so at least that works).

The file is called 'login.aspx' and is below (it doesn't do anything yet obviously) - and the code behind file hasn't been touched.

Code:
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="login.aspx.cs" Inherits="login" Title="Login" %>

<asp:Content ID="loginContent" ContentPlaceHolderID="pageBody" Runat="Server">
    <div style="width:200px;height:640px">
        <form id="loginform" runat="server">
            Username: <asp:textbox id="txtUsername" runat="server" />
            Password: <asp:textbox id="txtPassword" runat="server" TextMode="Password" />
            <asp:button id="btnSubmit" Text="Login" runat="server" />
        </form>
    </div>
</asp:Content>
 
maybe the file was excluded from the project?
 
Hi
No it wasn't excluded.
I just figured out that the page had a <form> tag in it, and the master page has a <form> tag too. What's the deal with form tags? I wanted to have a content page with a login area, and for this, wouldn't I need a separate form tag??
 
You can only have one form tag on one page. So if you are using MasterPages, the FORM tag on the MasterPage will suffice. Just make sure all your Content Placeholders are within that FORM tag.
 
technically you can have muiltple forms on a page. i'm not sure about server side form controls though. this may only allow 1 form. It also may be that forms cannot be nested.

for example if you look at MVC front controler examples. this is accecptable:
Code:
<form id="form1" action="gosomewhere" method="post">
   <input type="text" id="foo" />
   <input type="submit" value="go" />
</form>
<form id="form2" action="gosomewhere" method="post">
   <input type="text" id="foo" />
   <input type="submit" value="go" />
</form>
<form id="form3" action="gosomewhere" method="post">
   <input type="text" id="foo" />
   <input type="submit" value="go" />
</form>

Jason Meckley
Programmer
Specialty Bakers, Inc.
 
The Server side controls like to throw error messages if there is more than one Form tag on a page.
 
The Server side controls like to throw error messages if there is more than one Form tag on a page.
That only happens if you have more than one form tag which have the runat="server" tag set. As long as only one form has this, then you can have as many forms as you like (as per Jason's example and explanation above).


-------------------------------------------------------

Mark,
[URL unfurl="true"]http://aspnetlibrary.com[/url]
[URL unfurl="true"]http://mdssolutions.co.uk[/url] - Delivering professional ASP.NET solutions
[URL unfurl="true"]http://weblogs.asp.net/marksmith[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top