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>