servercontrols (webcontrols, htmlcontrols) or html elements?

D

Dirk

Hi,

Suppose an application where the user has to chose an id-number in a
'select'. Data connected to that id-number must be fetched from a table and
undergo heavy calculations and finally displyed into several textboxes.

In order to minimize transfer between server and client, is it not better to
use simple html elements instead of servercontrols?
With servercontrols, the chosen value must be sent to the server, then the
data fetched and sent back to the client in order to be perform the
calculations (could happen on the server but risk for overload), then sent
back to the server to put the value into the textboxes and finally sent to
the client for display. Total = 4 transferts.
With simple html-elements, one tranfert from client to server with the
selected value, then transfert from server to client with the data, then
calculations on client and display in texboxes.Total = 2.

If I'm right, can anyone explain me when using servercontrols, taking into
account the balance between client and server.
Thanks
Dirk
 
W

Ward Bekker

Hi Dirk,

I think they main point here is if you should do the heavy calculation
server side or client side, because server controls are OK to use as
long as you make sure their viewstate size is reasonable.

If it's a real heavy calculation, I would not bother the client with it
because client side scripts javascript is much slower than compiled c#
on the server. And it might be not very pragmatic from a developer point
of view to do it client side when you need for example use a lot of
database info as input for the calculations.

If you are afraid that your server might blow up from the calculations,
you might want to check if your calculation is efficient enough. If it
is, you might want to buy a server that's more up to the task.

--
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com

"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspx
 
N

Nathan Sokalski

The best answer to a question like that is that there are sometimes other
factors. Sometimes these include things such as:

Some pages are easier to update when using Server Controls
If there are a large quantity of choices, it may be more efficient to use
Server Controls so that the page is more dynamic
Even though it is true that all output sent to the browser can be generated
without Server Controls, if you compare how much work you would need, there
is a big difference

One thing that people don't always do for situations like yours is use
Client-Side JavaScript to do as much as possible to minimize the number of
transfers. This isn't always a solution, but depending on the situation it
can help (a good example is the validation controls). But you are right, in
some situations regular HTML elements are more appropriate. It's hard to say
until you've seen the actual code and purpose, so I'm not going to try and
tell you which one is better for your situation, but see if what I've said
helps you determine that for yourself. Good Luck!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,754
Messages
2,569,521
Members
44,995
Latest member
PinupduzSap

Latest Threads

Top