Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 1.0 and 1.1 > ASP.NET 1.0 and 1.1 Basics
Password Reminder
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
ASP.NET 1.0 and 1.1 Basics ASP.NET discussion for users new to coding in ASP.NET 1.0 or 1.1. NOT for the older "classic" ASP 3 or the newer ASP.NET 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 1.0 and 1.1 Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 1st, 2003, 12:01 PM
Registered User
Join Date: Jul 2003
Location: Beirut, Beirut, Lebanon.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem with Posting an ASP .Net web form


I am reading the Biginning ASP.Net Using C# book. On page 128, I have attempted to try the Try it Out-The Business Example. In case the book is not available, I will breifly explain what I did:
1- Created a file using Visual Studio .Net (holidaypage.aspx)
2- On that web form I have placed some text boxes and option button to receive the user input. Note that all controls on the web form are server controls.
3- The book mention to write the form tag for holidaypage.aspx as follows:
        <form action="holidayresponse.aspx" method="post">
the book mention that by writing the form tag this way (removing runat="server") we will be able to redirect to holidayresponse.aspx

4- Created another file (holidayresponse.aspx) another page to receive the data from holidaypage.aspx and display the information in some lables.

The problem is that when I submit I get an error saying that the controls on the webform should be enclosed in a form tag that has the runat="server" available. If I specify this attribute the when I submit the form, the page holidaypage.aspx is reloaded and not the holidayresponse.aspx.

Anybody has any ideas

  #2 (permalink)  
Old August 1st, 2003, 12:05 PM
Authorized User
Join Date: Jul 2003
Location: Calgary, Alberta, Canada.
Posts: 28
Thanks: 0
Thanked 0 Times in 0 Posts

can you post your code?

  #3 (permalink)  
Old August 2nd, 2003, 09:54 AM
Registered User
Join Date: Jul 2003
Location: Beirut, Beirut, Lebanon.
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts

The code for holidaypage.aspx is as follows:

<%@ Page language="c#" Codebehind="HolidayPage.aspx.cs" AutoEventWireup="false" Inherits="FeiertagHolidays.HolidayPage" smartNavigation="True"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
        <meta content="Microsoft Visual Studio 7.0" name="GENERATOR">
        <meta content="C#" name="CODE_LANGUAGE">
        <meta content="JavaScript" name="vs_defaultClientScript">
        <meta content="http://schemas.microsoft.com/intellisense/ie5" name=" vs_targetSchema">
    <body MS_POSITIONING="GridLayout">
        <form action="HolidayResponse.aspx" method="post" runat="server">
        <asp:textbox id="txtName" runat="server"></asp:textbox>
        <asp:textbox id="txtAddress" runat="server"></asp:textbox>
        <asp:radiobuttonlist id="Radio1" runat="server">
            <asp:ListItem Value="Male">Male</asp:ListItem>
            <asp:ListItem Value="Female">Female</asp:ListItem>
        <asp:dropdownlist id="cboDestination" runat="server">
            <asp:ListItem Value="Madrid">Madrid</asp:ListItem>
            <asp:ListItem Value="Barcelona">Barcelona</asp:ListItem>
            <asp:ListItem Value="Lisbon">Lisbon</asp:ListItem>
            <asp:ListItem Value="Oslo">Oslo</asp:ListItem>
            <asp:ListItem Value="Prague">Prague</asp:ListItem>
        <INPUT type="submit" value="Submit">

The problem is that if I leave the Form tag as is, then when I submit the page does not move to holidayresponse.aspx. If I remove runat="server" attribute like the book suggested then I get an error saying that TextBox txtName must be enclosed in a runat="server" form.


  #4 (permalink)  
Old August 13th, 2003, 02:39 AM
Authorized User
Join Date: Jun 2003
Location: Quezon City, MM, Philippines.
Posts: 97
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to planeswalk


You can work around this by using the server controls under the System.Web.UI.HtmlControls namespace. These would be nothing more than the usual HTML elements that we normally use, except that they have the runat="server" attribute. An example would be:

  <input type="text" id="txtName" runat="server" />

which can replace your <asp:textbox> control. These elements do not require your form to have the runat attribute present, and their individual properties can still be accessed through your codebehind.


Marlon Villarama
Support Team
Web Burner Hosting
  #5 (permalink)  
Old September 11th, 2006, 02:59 AM
Registered User
Join Date: Sep 2006
Location: , , .
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts

hope it worked


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Posting asp form variables from child to parent aspless Javascript How-To 0 July 20th, 2007 10:36 AM
AJAX form posting problem. NisarAhamed Ajax 0 November 21st, 2006 01:09 AM
Store ? in Oracle9i using asp.net web form nandini_net_in ASP.NET 2.0 Professional 0 October 17th, 2006 12:42 AM
Detect Web Form Field Changes in ASP.NET. sand133 ASP.NET 2.0 Professional 1 August 22nd, 2006 10:15 AM
ASP.NET not posting form data sqzgnlib ASP.NET 1.0 and 1.1 Basics 2 May 10th, 2005 09:59 AM

All times are GMT -4. The time now is 10:25 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.