Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > As expected?

Reply
Thread Tools

As expected?

 
 
Evertjan.
Guest
Posts: n/a
 
      05-28-2004
I did not expect this to work as expected:

<%
function a()
%>ha !<br><%
end function

a
a
a
a
a
%>

So, why do we use so much response.writes?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
 
Patrice
Guest
Posts: n/a
 
      05-28-2004
Mixing HTML and VBScript code is generally considered as less easier to
read. For example if you want to use a variable instead of ! you'll have
something like :

Sub a(ByVal Mark)
%><!--ha--><%=Mark%><br><%
End Sub

Opposed to :

Sub a(ByVal Mark)
Response.Write("ha ")
Response.Write(Mark)
Response.Write("<br>")
End Sub



Patrice

"Evertjan." <(E-Mail Removed)> a écrit dans le message de
news:Xns94F7589DDE5AEeejj99@194.109.133.29...
> I did not expect this to work as expected:
>
> <%
> function a()
> %>ha !<br><%
> end function
>
> a
> a
> a
> a
> a
> %>
>
> So, why do we use so much response.writes?
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)



 
Reply With Quote
 
 
 
 
Aaron Bertrand [MVP]
Guest
Posts: n/a
 
      05-28-2004
I agree with Patrice, it's easier to read.

In some projects I have used a shortcut function like this:

function rw(s)
response.write s
end function

rw "Hello"
rw "Goodbye"

I have also used wl, which mimicked writeline (adding carriage returns /
<br> etc. so I didn't have to think about putting the HTML into the text).

I think another factor is that many people are in the habit of avoiding
context switching because IIS *used* to be a bit inefficient with it.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Evertjan." <(E-Mail Removed)> wrote in message
news:Xns94F7589DDE5AEeejj99@194.109.133.29...
>I did not expect this to work as expected:
>
> <%
> function a()
> %>ha !<br><%
> end function
>
> a
> a
> a
> a
> a
> %>
>
> So, why do we use so much response.writes?
>
> --
> Evertjan.
> The Netherlands.
> (Please change the x'es to dots in my emailaddress)



 
Reply With Quote
 
Michael D. Kersey
Guest
Posts: n/a
 
      05-28-2004
Evertjan. wrote:
> I did not expect this to work as expected:
>
> <%
> function a()
> %>ha !<br><%
> end function
>
> a
> a
> a
> a
> a
> %>
>
> So, why do we use so much response.writes?
>

Some Microsoft URLs term the above a "render function", e.g.,:
"Migrating to ASP.NET: Key Considerations" by Jim Kieley:
http://msdn.microsoft.com/library/de...migrissues.asp

According to that Microsoft article and others, "render functions" are
not allowed in ASP.NET, which is unfortunate. Personally I think they're
kinda cute and handy, yet another reason to use ASP instead of ASP.NET.
 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments