Monday, March 26, 2012

Performance-related questions about an ASP.NET page...

1- Is it better to use TABLEs or DIVs in an HTML/ASP.NET page? Why?
2- Is it better to form your response (HTML page) result from your ASP.NET
page mostly using server side controls, or HTML controls. For example, if
you want to display the word "Welcome" is it better to use an asp:label
control or just type it using a P tag?

Thank you.Sammy:
The table/div issue has nothing to do with ASP.Net...it's more a general
html question...a nice thing about tables is how well they let you structure
data using server-side controls via the Table, TableRow and TableCell
controls. If you do a google search for "Table vs Div" you'll get a lot of
results. The main issue i believe is accessibility...

Your second question is loaded, but i'll answer it as best as possible.
First off, it's pretty obvious that

#1
<p>Hello World</p
is going to be faster than

#2
<Asp:label id="blah" runat="server" />
...
OnPage_Load
blah.text = "hello world"
end sub

in the first example you are simply sending it as plain text to the browser
to render. In the 2nd example, ur doing the same thing, but before that you
are creating an object on the server and doing some other magic.

The real point though is that it shouldn't matter. The debate is purely
speculative...the microsecond (literally) that you'll save in one way
doesn't equate much compared to the flexibility you gain the other. If the
flexiliby isn't, and never will be needed, then do it the first way..

Karl

--
MY ASP.Net tutorials
http://www.openmymind.net/

"Sammy" <sammy@.picostation.com> wrote in message
news:%23ySlri1EFHA.1012@.TK2MSFTNGP14.phx.gbl...
> 1- Is it better to use TABLEs or DIVs in an HTML/ASP.NET page? Why?
> 2- Is it better to form your response (HTML page) result from your ASP.NET
> page mostly using server side controls, or HTML controls. For example, if
> you want to display the word "Welcome" is it better to use an asp:label
> control or just type it using a P tag?
> Thank you.
Thank you!

"Karl Seguin" <karl REMOVE @. REMOVE openmymind REMOVEMETOO . ANDME net>
wrote in message news:ux0CJU2EFHA.1564@.TK2MSFTNGP09.phx.gbl...
> Sammy:
> The table/div issue has nothing to do with ASP.Net...it's more a general
> html question...a nice thing about tables is how well they let you
> structure
> data using server-side controls via the Table, TableRow and TableCell
> controls. If you do a google search for "Table vs Div" you'll get a lot
> of
> results. The main issue i believe is accessibility...
> Your second question is loaded, but i'll answer it as best as possible.
> First off, it's pretty obvious that
> #1
> <p>Hello World</p>
> is going to be faster than
> #2
> <Asp:label id="blah" runat="server" />
> ...
> OnPage_Load
> blah.text = "hello world"
> end sub
> in the first example you are simply sending it as plain text to the
> browser
> to render. In the 2nd example, ur doing the same thing, but before that
> you
> are creating an object on the server and doing some other magic.
> The real point though is that it shouldn't matter. The debate is purely
> speculative...the microsecond (literally) that you'll save in one way
> doesn't equate much compared to the flexibility you gain the other. If
> the
> flexiliby isn't, and never will be needed, then do it the first way..
> Karl
> --
> MY ASP.Net tutorials
> http://www.openmymind.net/
>
> "Sammy" <sammy@.picostation.com> wrote in message
> news:%23ySlri1EFHA.1012@.TK2MSFTNGP14.phx.gbl...
>> 1- Is it better to use TABLEs or DIVs in an HTML/ASP.NET page? Why?
>> 2- Is it better to form your response (HTML page) result from your
>> ASP.NET
>> page mostly using server side controls, or HTML controls. For example, if
>> you want to display the word "Welcome" is it better to use an asp:label
>> control or just type it using a P tag?
>>
>> Thank you.
>>
>>

0 comments:

Post a Comment