Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_beginners thread: 2S questions about asp.net (Simple and Stupid)


Message #1 by "Chong Kim" <rimuris@h...> on Thu, 20 Mar 2003 18:45:49
I just got into ASP.NET, so everything is just NEW for me!!

Anyway, i have two dumb questions.

1. IS it impossible to use asp or php code in the aspx?

for exmaple, 

<script language="VB" runat="server">
Sub Page_Load()
	Dim number as integer
	Dim Counter as Integer
	
	If request.Form("numberAttendees") <> "" then
		number = Request.Form("numberAttendees") 
		Message1.Text = ""
		For counter = 1 to number
			Message1.Text = Message1.text & "Attendee Name 
_____________________ <br><br>" & _
									
	   "Attendee Age ______________________ <br><br><hr><br>"
		Next counter
	End If
End Sub
</script>

<html>
<head>
<title> Loop Example </title>
</head>

<body>
<form runat="server">
Enter the Number of attendaees (Max 6) :
<br>
<br>
<asp:dropdownlist id="numberAttendees" runat="server">

<%
Dim loopcounter as integer

for loopcounter = 1 to 6
Response.write ("<asp:listitem>" & loopcounter & "</asp:listitem>")
next loopcounter

%>


</asp:dropdownlist>
<br>
<br>
<input type="submit">
<br>
<br>
<asp:label id="message1" runat="server"  />

</form>
</body>
</html>

2. Why we have to use form control, instead of simple html form element?
for example, <form runat="server"> 
once you click submit button, it is not forward to the other page, i mean, 
we can't 
use runat="server" and action=....aspx" together.

then, what's the meaning of using form control if those form data can't be 
transfer to other page?  
(Well, there is a way Server.Transfer("031802.aspx"), but complicated 
still)

Yes, those two are my stupid question, but I'm just brend new guy for 
asp.net.

Thank you, and i'm waiting your answer & help.

Message #2 by "Jerry Lanphear" <jerrylan@q...> on Thu, 20 Mar 2003 11:58:37 -0700
You can add whatever you wish to the aspx file.  However, your addition will
no longer be utilizing the power of ASP.NET.   Its like a machine which can
carve a wooden statue for you.  If you take out a knife and carve additional
features into the wood after you take it out of the machine, you no longer
have a model which can be created mechanically.

Regards
----- Original Message -----
From: "Chong Kim" <rimuris@h...>
To: "aspx_beginners" <aspx_beginners@p...>
Sent: Thursday, March 20, 2003 6:45 PM
Subject: [aspx_beginners] 2S questions about asp.net (Simple and Stupid)


> I just got into ASP.NET, so everything is just NEW for me!!
>
> Anyway, i have two dumb questions.
>
> 1. IS it impossible to use asp or php code in the aspx?
>
> for exmaple,
>
> <script language="VB" runat="server">
> Sub Page_Load()
> Dim number as integer
> Dim Counter as Integer
>
> If request.Form("numberAttendees") <> "" then
> number = Request.Form("numberAttendees")
> Message1.Text = ""
> For counter = 1 to number
> Message1.Text = Message1.text & "Attendee Name
> _____________________ <br><br>" & _
>
>    "Attendee Age ______________________ <br><br><hr><br>"
> Next counter
> End If
> End Sub
> </script>
>
> <html>
> <head>
> <title> Loop Example </title>
> </head>
>
> <body>
> <form runat="server">
> Enter the Number of attendaees (Max 6) :
> <br>
> <br>
> <asp:dropdownlist id="numberAttendees" runat="server">
>
> <%
> Dim loopcounter as integer
>
> for loopcounter = 1 to 6
> Response.write ("<asp:listitem>" & loopcounter & "</asp:listitem>")
> next loopcounter
>
> %>
>
>
> </asp:dropdownlist>
> <br>
> <br>
> <input type="submit">
> <br>
> <br>
> <asp:label id="message1" runat="server"  />
>
> </form>
> </body>
> </html>
>
> 2. Why we have to use form control, instead of simple html form element?
> for example, <form runat="server">
> once you click submit button, it is not forward to the other page, i mean,
> we can't
> use runat="server" and action=....aspx" together.
>
> then, what's the meaning of using form control if those form data can't be
> transfer to other page?
> (Well, there is a way Server.Transfer("031802.aspx"), but complicated
> still)
>
> Yes, those two are my stupid question, but I'm just brend new guy for
> asp.net.
>
> Thank you, and i'm waiting your answer & help.
>
>
>

Message #3 by "Robert Sindall" <rsindall@z...> on Thu, 20 Mar 2003 19:16:50 -0000
why why why are you trying to use php?

and why why why are you trying to use .net when u want to use php?

have you done any OO programming? (would be useful for .net)

do you know anything about .net? (if not. best to get a book)

use orginal ASP if you don't want to use webcontrols.

and try and stick to MS.NET best practices... eg. code behinded in a
separate file...etc.

and DO NOT do this: (unless you want to use PHP or orginal ASP)

<asp:dropdownlist id="numberAttendees" runat="server">

<%
Dim loopcounter as integer

for loopcounter = 1 to 6
Response.write ("<asp:listitem>" & loopcounter & "</asp:listitem>")
next loopcounter

%>

</asp:dropdownlist>

if you want be seen to be programming in .net... but don't want to
programming in .net
then change the file extensions of your php files to aspx and change the
filter in IIS to run aspx files through your php compiler..

or

learn abnout .net principles & OO principles & microsoft best practices.


  Return to Index