ASP style in .NET

  • Thread starter Thread starter Piyush Bhatt
  • Start date Start date
P

Piyush Bhatt

Hello,

I remember reading somewhere that using ASP style in ASP.NET is not
recommended.

For example, there is following situation:

<% If x = y %>
Some ASP.NET controls
<% End IF %>

V/s.

<panel id=mypanel runat=server>
Some ASP.NET controls
</panel>

And then code behind can turn 'mypanel' on or off!.

Now, is the 1st and 2nd are same from processing point of view or they
are different? I read somewhere that 2nd one has some advantage. But I
dont remember what!

Can you help!

Thanks,
Piyush
 
The second version would create another object (which needs GC etc.) whereas
the first would not.
From a runtime perspective, you probably save a cycle with the first
version. From a design/maintenance
perspective you mingle code with your markup, which most people consider not
the best style
(think developer/designer separation).
 
The major difference is that the first example is procedural in nature,
while ASP.Net, and the second example are object-oriented. The advantages of
object-oriented versus procedural programming are too numerous to mention
here.

--
Kevin Spencer
..Net Developer
Microsoft MVP
Big things are made up
of lots of little things.
 
Back
Top