Web Matrix Forms problem.. Need Expert Help Please!

Hello.. 

I'm new to ASP.NET and Web Matrix, and maybe I'm approaching something wrong, but need the experts help here..
I have a web site which is hosted at a remote hosting company.. I also have an SQL server hosted at the same company.. Well, I'm trying to write a form that will use the DB.. When ever I add a Web Control such as a Text Box or Label, etc.. I thought that Web Matrix would automatically put the "<Form runat="server"> around the web server controls, but it doesn't..</form>, so I did so.. Saved the page and since I'm using a remote host, I have to open the browser and type in the path to the page.. and can't use the start button or F5 which is fine, but when I go back to the "all view" my form tag is now re-arranged for me.. Instead of it being like I left it as in:
<form runat="server">
Some Text box control
Some Label Control, etc..
</form>
It's now like this
<Form runat ="server">
</Form>
Text box control,
Lable COntrol, etc..
Now when I try to refresh the page, of course I get an error saying that the controls have to be surrounded by a form tag.. Of course I know this, but the darn editor is doing this to me.. I don't know why.. Any help would be appreciated greatly.. I tried looking at the preferences in Web Matrix and turned off about everything, but nothign really seemed to say "Wrap my controls with a form tag" or anything like that.. Is there something I am missing?
Thanks and you are welcome to respond via email to timAThtonline.net (Replace the AT with the correct email at symbol..)
Thanks
Tim
0
DotNetTim
11/30/2003 11:52:11 PM
asp.net.getting-started 91979 articles. 3 followers. Follow

6 Replies
480 Views

Similar Articles

[PageSpeed] 52

Even though you're on a remote host, you should be able to run pages locally because the SQL server doesn't care if the page is running at your house or at your ISP as long as you're providing valid SQL login information (unless they told you to use localhost in your configuration...which means the SQL server is running off the same box that's serving pages in which case I'd look for a new host).

But anyway, does it garble a simple page like this?

<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" encType="multipart/form-data" runat="server">
&nbsp; <INPUT id="myFile" type="file" name="myFile" runat="server">
<br>
<asp:button id="btnUpload" runat="server" Text="Upload!"></asp:button><br>
<asp:label id="lblMessage" runat="server"></asp:label><br>
<asp:label id="lblMessage2" runat="server"></asp:label></form>
</body>
0
JakeJeck
12/1/2003 1:24:03 AM
The hosting is excellent, and I've not even been able to check the database connection / my code to do a query because it changes my forms.. Web forms.. It doesn't do anything that I can tell except move my Form tag which is really weird if you ask me.. It (Web Matrix Editor / IDE) only moves the <form runat="server"> tag if I go to the design view and then back to the "All view" where I coded the page in the first place.. See below before and after code 


<%@ Page Explicit="True" Language="VB" Debug="True" %>
<html>
<head>
<title>Article / Admin Section</title>
</head>
HERE IS THE FORM BEFORE I VIEW IN THE DESIGN VIEW AS SEEN IN THE ALL VIEW
<form runat="server">
<body id="ArticleInput" text="black" bottommargin="0" vlink="purple" link="blue" bgcolor="white" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div align="left">
<blockquote> <blockquote> <blockquote> <blockquote><font face="Tahoma" size="6">Add
Articles</font>
</blockquote></blockquote></blockquote></blockquote>
</div>
<div align="left">
<table cellspacing="5" cellpadding="5" width="500" align="left">
<tbody>
<tr>
<td width="150">
<p align="right">
<font face="Verdana" size="2">Title of Article:</font>
</p>
</td>
<td>
<asp:TextBox id="txtArticleTitle" runat="server" MaxLength="200" Width="350px" ToolTip="Enter Article Text here!"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<p align="right">
<font face="Tahoma" size="2">Article Text: </font>
</p>
</td>
<td>
<asp:TextBox id="txtArticleText" runat="server" MaxLength="200" Width="350px" ToolTip="Enter Article Text here!" TextMode="MultiLine" Rows="10"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button id="Button1" runat="server" Text="Add this article!"></asp:Button>
&nbsp;</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ControlToValidate="txtArticleTitle" ErrorMessage="You must enter a title!"></asp:RequiredFieldValidator>
&nbsp;<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ControlToValidate="txtArticleText" ErrorMessage="You must enter the Article text!"></asp:RequiredFieldValidator>
&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</blockquote>
</body>
</form>
</html>


NOW HERE IS THE CODE AFTERWARDS WHICH IS CAUSING ME ALL THE GRIEF? Any help would be most appreciated.. Sorry for the caps but was wanting to make sure I drew your attention to the beggining and end of code, etc..
Tim


<%@ Page Explicit="True" Language="VB" Debug="True" %>
<html>
<head>
<title>Article / Admin Section</title>
<form runat="server">
</form>
</head>
<body id="ArticleInput" text="black" bottommargin="0" vlink="purple" link="blue" bgcolor="white" leftmargin="0" topmargin="0" rightmargin="0" marginwidth="0" marginheight="0">
<blockquote dir="ltr" style="MARGIN-RIGHT: 0px">
<div align="left">
<blockquote> <blockquote> <blockquote> <blockquote><font face="Tahoma" size="6">Add
Articles</font>
</blockquote></blockquote></blockquote></blockquote>
</div>
<div align="left">
<table cellspacing="5" cellpadding="5" width="500" align="left">
<tbody>
<tr>
<td width="150">
<p align="right">
<font face="Verdana" size="2">Title of Article:</font>
</p>
</td>
<td>
<asp:TextBox id="txtArticleTitle" runat="server" MaxLength="200" Width="350px" ToolTip="Enter Article Text here!"></asp:TextBox>
</td>
</tr>
<tr>
<td>
<p align="right">
<font face="Tahoma" size="2">Article Text: </font>
</p>
</td>
<td>
<asp:TextBox id="txtArticleText" runat="server" MaxLength="200" Width="350px" ToolTip="Enter Article Text here!" TextMode="MultiLine" Rows="10"></asp:TextBox>
</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:Button id="Button1" runat="server" Text="Add this article!"></asp:Button>
&nbsp;</td>
</tr>
<tr>
<td>
</td>
<td>
<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ControlToValidate="txtArticleTitle" ErrorMessage="You must enter a title!"></asp:RequiredFieldValidator>
&nbsp;<asp:RequiredFieldValidator id="RequiredFieldValidator2" runat="server" ControlToValidate="txtArticleText" ErrorMessage="You must enter the Article text!"></asp:RequiredFieldValidator>
&nbsp;</td>
</tr>
</tbody>
</table>
</div>
</blockquote>
</body>
</html>

0
DotNetTim
12/1/2003 1:50:18 AM
Almost forgot.. Here's the error message I get in the browser when I'm trying to debug.. 

Server Error in '/' Application.
--------------------------------------------------------------------------------
Control 'txtArticleTitle' of type 'TextBox' must be placed inside a form tag with runat=server.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Web.HttpException: Control 'txtArticleTitle' of type 'TextBox' must be placed inside a form tag with runat=server.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:

[HttpException (0x80004005): Control 'txtArticleTitle' of type 'TextBox' must be placed inside a form tag with runat=server.]
System.Web.UI.Page.VerifyRenderingInServerForm(Control control) +152
System.Web.UI.WebControls.TextBox.AddAttributesToRender(HtmlTextWriter writer) +40
System.Web.UI.WebControls.WebControl.RenderBeginTag(HtmlTextWriter writer) +17
System.Web.UI.WebControls.TextBox.Render(HtmlTextWriter writer) +17
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) +72
System.Web.UI.Control.Render(HtmlTextWriter writer) +7
System.Web.UI.Control.RenderControl(HtmlTextWriter writer) +243
System.Web.UI.Page.ProcessRequestMain() +1929


--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573
0
DotNetTim
12/1/2003 1:52:08 AM
In your before code your <form> opening tag is appearing before your <body> tag.  This is incorrect.

Is it doing that when you create a blank page also?
0
JakeJeck
12/1/2003 2:25:27 AM
Hello .. 

Thanks for letting me know it's not supposed to be before the body tag.. I've not tried it on the blank page? Why would I may I ask? I guess I don't understand your question about the blank page.. I'm going to try again with the form tag after the body tag and see what happens.. It would seem to me that when web matrix allows me to drag a web server control in the design mode that it would automatically insert the "form" tag for me.. or should.. I'd think.. ?
Just what rules are there about where the form tag is supposed to appear? How many forms can one have on a web forms page?
Thanks
Tim
0
DotNetTim
12/1/2003 3:48:04 AM
Well I think what's happening is that the Web Matrix is seeing the initial <form> tag and then sees an overlapping <body> tag and says, "Whoops we have overlapping tags here, I need to clean this up" and therefore it bumps the </form> tag above the <body> tag which messes things up.

I don't use the Web Matrix, I use visual studio.net so what I was trying to ask was, when you create a blank page using the web matrix, doesn't it put in some basic tags for you?
For example when I create a new page VS.NET has this code in it:

<%@ Page Language="vb" AutoEventWireup="false" Codebehind="WebForm4.aspx.vb" Inherits="MediaTracking.WebForm4"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>WebForm4</title>
<meta name="GENERATOR" content="Microsoft Visual Studio.NET 7.0">
<meta name="CODE_LANGUAGE" content="Visual Basic 7.0">
<meta name=vs_defaultClientScript content="JavaScript">
<meta name=vs_targetSchema content="http://schemas.microsoft.com/intellisense/ie5">
</head>
<body MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
</form>
</body>
</html>

I believe you manually moved the form tag above the body tag by mistake somehow.
0
JakeJeck
12/1/2003 2:42:37 PM
Reply:

Similar Artilces:

Desperate Visual Studio .NET problem with Web Forms, please help
Hi, I've posted in the past about this problem and got no response, but now I'm desperate so have to try again. In Visual Studio .NET 2003, with .NET Framework 1.1, all web form controls (in fact all controls in the toolbar) are disabled. I create a webform.aspx page, I am in design view, but when I go to the "web forms" toolbar, I cannot drag anything to the page. I solved this last time by completely wiping my drive and spending three days reinstalling and updating everything. Everything in Visual Studio worked as expected for a few days, and now yet again everything is disabled. Can s...

Problem with XML in Web Matrix
I'm facing a problem with generating XML . i have used XmlTextWriter to generate an XML , then it is displayed using Response.Write().What happens now is that following HTML tags get added at the end of the XML<html><head></head><body></body></html> As a result i get the following error :"Only one top level element is allowed in an XML document. Error processing resource"How do i remove this error..... Please help  I don't believe that you should be using Response.Write to output XML.  You should use the XmlTextWriter.Flush method instead.&nb...

Help getting started with a dynamic web form
I'm new to .NET so I was hoping someone could point me in the right direction. I have a form that needs to be dynamically created based on the contents of a XML file. The XML contains data for each 'row' to be created and what type of fields (textbox, custom select box, etc) should be displayed. The number of each type of field will vary from time to time. Using ASP I would have either used XSL to create a form or DOM to walk through the contents of the XML and display/name the proper fields. Using .NET I'm not sure what the proper method is to accomplish my goal. I can use XML c...

Web Matrix Getting Started Tour
Hi guys, my first time on the forum here so please be gentle :) I downloaded WebMatrix just 2 days ago and I have been doing the WebMatrix walk throughs with gusto the last couple of days. I was runing through this project "Build an End-to-End Application (with VB.NET)" with everything running perfectly every step of the way until the very last page. At first the login page just kept returning to itself no matter what I did... and then a few tests and re-inspections later I started to get this error in my browser -> "Unable to find script library '/a...

Please Help!! web parts and .net forms
This is a two part question. 1. i have a simple .net form that captures users input and i want to post to another form to show users input and data from a database into a data grid. In keep posting back to the first form. I have action and method set correctly on my first form, no idea why it post to same form. i even have a response.redirect in the click event of the button on the first form. 2. Does anyone know of any good site/web cast that step you through a basic web part for sharepoint 2007 i am using both visual studio 2005 and 2008. I heard that it is like a 12 step ...

Web Deployment problem ... please, need help.
 Hello,I am using VS 2008 and and just downloaded Web Deployment Projects:http://connect.live.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=319288I need the connection string in my web site Web.config file to be replaced.So I created a new file named ConnectionStrings.config that contains only the following:<connectionStrings>  <add name = "MyConn" connectionString = "Provider = Microsoft.Jet.OLEDB.4.0; Data Source = C:\MyDomain\\wwwroot\App_Data\DB.mdb; User Id=; Password=;" providerName = "System.Data.OleDb" /></connectionStri...

Problem with web forms in subdirectories
Here's my problem: I have a web app that is made up of a few different forms. The directory structure is pretty simple. My root directory is called maintenance and there is another directory underneath it called admin. I have some web forms in each directory. The plan is to use a separate web.config file in the admin subdirectory so I can perform Windows authentication on any files in the admin directory. I have both the maintenance and admin directories setup in IIS as applications, and I have a simple web.config file in the admin directory that looks like this (for testing purpose...

Problem getting started with AJAX, help please [:$]
Hello, I am new to AJAX, to be honest I'm new to most ASP.net stuff.I have created an online form that uses a webservice to do address lookups. It all works fine.I thought it would be nice to add a little "Loading..." animation to the page as it can take a while to do a postcode search. The problem i'm having is when I add the AXJA web.config file details to the existing web.config file it stops working. The "Loading...." animation appears, stays for about the length of time i would expect, then disappears, however the dropdown list I populate with the a...

Need help getting a form to work please
Hi,I am essentially a comnplete novice at web programming - I am building a website using a template downloaded from MS as a starting point and then playing with the html and css until it works as I want it!I am trying to integrate RomanCart into a website I am bulding with Visual Studio Express.The theory is that having created some product info on the online cart, it generates some code that I can simply cut and paste into my website.My problem appears to be that it generates an html form and the application I am building is a .aspx app that needs me to have server side code to generate ...

need help please web matrix driving me crazy
ok i'm new to all this web matrix stuff i look so stupid right now but any way.... i'm tring to create a new mobile page or mobile user control page and it tels me all the time unable to open the document specified cast is not valid any idea?? Hi , Hope this helps: view post 251669 Regards,...

Docking controls to a web form
Hi, With a windows application it is possible to dock and anchor controls to the form. I'm creating a web app and wish to dock and anchor webgrids, panels etc to my webform. I.e. I’ve created a masterpage (template) and want to dock a webgrid to the bottom of it so every webform i create that is based on it has a docked webgrid at the bottom of the webform.  I've tried using the following (I’m using Infragisitics controls but have tried it with VS web controls with no success): UltraWebGrid1.Dock = Dockstyle.bottom I realise that both dock and anchor are members of the...

getting start with vb.net and crystal repots(web form)
I use Crystal Report9 in Visual Studio.NET 2003..... Example at Northwind database I want a application that.....a form include a combobox that contain CustomerID.....If I choose one CustomerID and click OK button....a Report will display information about this Customer......I think that must use Paramater.....how to do that ???? (How do I start to coding --please step by step or sample) please help me !!! Thank you so much!!! very good I have Dropdownlist when I choose the 'month'--> the all data of this field will show I use this Private Sub ddlMonth_Sel...

VS.NET Web App messing up form authentication? Help, please?
Does anyone know of any problems with creating a VS.NET Web App in a forms authenticated subfolder? I created a Web App "pics" with VS.NET as a subfolder of wwwroot, and the Request.ServerVariables("AUTH_USER") is always blank on all the pages in this subfolder wwwroot/pics. I deleted the VS.NET premade Web.Config file so that there is only the one file at wwwroot, but that didn’t help. Are there any other files created by VS.NET that could be messing this up? I made other ASPX subfolders outside of VS.NET and they all continue the session just fine, it's like this ...

Web Matrix Master Detail Data Page
I've tried to follow the Master Data Grid tutorial - http://www.asp.net/webmatrix/tour/section9/createdefaultpage.aspx but with no luck. I was just wondering if anyone had any other web tutorials they could post here for me please. All I want is to have two tables and when the user clicks on one of the fields in one table it expands another datagrid and displays further results from the other table. Thanks   Problem solved...

Web resources about - Web Matrix Forms problem.. Need Expert Help Please! - asp.net.getting-started

Is–ought problem - Wikipedia, the free encyclopedia
The is–ought problem in meta-ethics as articulated by Scottish philosopher and historian David Hume (1711–76) is that many writers make claims ...

Corporate Australia's real problem: ancient companies
Our biggest companies are pretty aged, compared to the dynamic corporate giants that power the world's biggest economy.

Dick’s Sporting Goods athleisure problem - Business Insider Deutschland
Dick's Sporting Goods has sold athletic apparel for decades. But now, the retailer faces more competition than ever.

November 2015: Unofficial Problem Bank list declines to 255 Institutions
This is an unofficial list of Problem Banks compiled only from public sources. Here is the unofficial problem bank list for November 2015. Changes ...

Tri-Valley has no problem against Auburn to win 2A title
... form Search 39° Navigation Home Blackhawks Bulls Cubs White Sox Bears Fire Notre Dame Preps More Tickets Shop Watch Tri-Valley has no problem ...

This week in the war on workers: Rising federal taxes aren't the problem for the middle class
Turns out, federal taxes on the middle class aren’t so high these days: Note that the figure includes all federal taxes—the income tax rate ...

The 'Design Sprint' Approach To Solving Problems In Your Organization
Innovation is a goal for many organizations, but how do you actually get people in a room, constructively and innovatively solving problems? ...

Family evicted, building deemed unlivable: Landlord cannot fix problems, he was murdered
... A Milwaukee family has been forced to leave their apartment. Their building has been declared unlivable. The landlord was required to fix problems ...

Another Common Core Math Problem Has Parents Baffled
A baffled parent shared a picture of their child's Common Core-style math test.

French president in Moscow: Is Putin or Erdogan the problem? (part 1)
The French president is in Moscow this Thursday. Forget sanctions over Ukraine: François Hollande is calling for a grand coalition following ...

Resources last updated: 11/30/2015 1:50:08 PM