Wrox Programmer Forums
|
BOOK: Beginning ASP.NET 1.0
This is the forum to discuss the Wrox book Beginning ASP.NET 1.0 with C# by Chris Goode, John Kauffman, Christopher L. Miller, Neil Raybould, S. Srinivasa Sivakumar, Dave Sussman, Ollie Cornes, Rob Birdwell, Matt Butler, Gary Johnson, Ajoy Krishnamoorthy, Juan T. Llibre, Chris Ullman; ISBN: 9780764543708
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP.NET 1.0 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 7th, 2003, 02:52 AM
Registered User
 
Join Date: Nov 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default ch03, holidaypage

I get the error message like "runat is missing in the formtag" or "site cannot be downloaded".
When I change the formtag into <form action="holidayresponse.aspx" runat="server"> and in the same time put the <script>-block from holidayresponse.aspx into holidaypage.aspx, everything works as I expect: all data are displayed in holidaypage.aspx (so I see the controls are working). I don't understand why the way to display the data in holidayresponse.aspx is not functioning the way it is discribed on page 129.
Who can give me some advice.
thanks
Ernst
 
Old November 7th, 2003, 06:37 AM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you ever get a solution to this?
This has been annoying me for ages. If you use a server side form then the only attribute that you can use is runat=server; the rest are ignored!
If you use a client side form then you cannot use the <asp:Textbox> tag!

Let me know if you get a solution.

Thanks
Nick

Quote:
quote:Originally posted by ernstG
 I get the error message like "runat is missing in the formtag" or "site cannot be downloaded".
When I change the formtag into <form action="holidayresponse.aspx" runat="server"> and in the same time put the <script>-block from holidayresponse.aspx into holidaypage.aspx, everything works as I expect: all data are displayed in holidaypage.aspx (so I see the controls are working). I don't understand why the way to display the data in holidayresponse.aspx is not functioning the way it is discribed on page 129.
Who can give me some advice.
thanks
Ernst
 
Old November 7th, 2003, 07:13 AM
Friend of Wrox
 
Join Date: May 2003
Posts: 229
Thanks: 0
Thanked 0 Times in 0 Posts
Default

What this code is trying to achieve is to post the data to a different page while using the server ASP.NET web form controls by defining the “runat=server” in the form tag.

If we are using this attribute with the form tag, the values of form will always be posted to the same page, you can check it by changing the “method=post” to “method=get”. There is no use of “action” attribute while using the “runat=server” attribute with the form tag. If you need to post the data to a different page you need to use HTML controls in ASP.NET. However I have modified the code for your convenience


<%@ Page Language="vb" %>
<script runat="server">

    Sub Page_Load()
     Response.Write ("<b>Name:</b> " + Request.Form("FullName") + "<br />")
     Response.Write ("<b>Address:</b> " + Request.Form("Address") + "<br />")
     Response.Write ("<b>************:</b> " + Request.Form("************") + "<br />")
     Response.Write ("<b>Destination:</b> " + Request.Form("Destination") + "<br />")
    End Sub

</script>
<html>
<head>
    <title>Holiday page</title>
</head>
<body>
    <form action="holidayresponse.aspx" runat="server">
        <h1>Feiertag Holidays
        </h1>
        Please enter your details here.
        <br />
        <br />
        Name:<asp:textbox id="FullName" runat="server"></asp:textbox>
        <br />
        <br />
        Address:<asp:textbox id="Address" runat="server" textmode="multiline" rows="5"></asp:textbox>
        <br />
        <br />
        ************ -
        <asp:radiobuttonlist id="************" runat="server">
            <asp:listitem value="Male" />
            <asp:listitem value="Female" />
        </asp:radiobuttonlist>
        Please select the destination you would like details on:
        <asp:dropdownlist id="Destination" runat="server">
            <asp:listitem value="Madrid" />
            <asp:listitem value="Barcelona" />
            <asp:listitem value="Lisbon" />
            <asp:listitem value="Oslo" />
            <asp:listitem value="Prague" />
        </asp:dropdownlist>
        <br />
        <br />
        <input type="submit" value="Submit Query" />
        <input type="reset" value="Reset" />
    </form>
</body>
</html>
 
Old November 7th, 2003, 11:57 AM
Registered User
 
Join Date: Nov 2003
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for a solution, but it is not what the example was trying to achieve. It was trying to display the results on the holidayrepsonse.aspx not on the holiday.aspx.
It was also demonstrating asp.net form controls.

I see that we can either diplay the results on the source page as shown below or not use the ASP.NET form controls, but not both.

On page 131 of the ASP.NET using c#, it states ""We've set the form but not used the runat="server" attribute. "Why?" .. Well setting the runat="sever" prohibits us from moving to another page....""

Well using the HTML form prevents us using ASP.NET forms. It is a blundering error in the text,a s far as I can see. Can we use 2 forms: 1 ASP.NET to enter the values and 1 HTML to submit the values?
Please someone put me right?
 
Old November 8th, 2003, 03:39 AM
Registered User
 
Join Date: Nov 2003
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default

thanks to all for the interesting discussion. What is an easy (or the best) way to get the data displayed on a new page using asp-controls ?
Ernst






Similar Threads
Thread Thread Starter Forum Replies Last Post
struts book -- ch03 maya89 Struts 3 January 8th, 2007 04:54 AM
Ch03 Listing3_18 smiller BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 1 September 25th, 2006 02:02 PM
Ch03 default.aspx under App_Code error kai BOOK: Professional ASP.NET 2.0 and Special Edition; ISBN: 978-0-7645-7610-2; ISBN: 978-0-470-04178-9 0 January 5th, 2006 12:28 AM
Problem with holidaypage.aspx (need help) sli ASP.NET 1.0 and 1.1 Basics 9 April 22nd, 2005 11:42 PM





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