servercontrols (webcontrols, htmlcontrols) or html elements?

Discussion in 'ASP .Net Web Controls' started by Dirk, Mar 27, 2006.

  1. Dirk

    Dirk Guest

    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
     
    Dirk, Mar 27, 2006
    #1
    1. Advertising

  2. Dirk

    Ward Bekker Guest

    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
     
    Ward Bekker, Mar 27, 2006
    #2
    1. Advertising

  3. 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!
    --
    Nathan Sokalski

    http://www.nathansokalski.com/

    "Dirk" <> wrote in message
    news:...
    > 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
    >
    >
     
    Nathan Sokalski, Mar 28, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Abhishek Srivastava

    WebControls and HtmlControls

    Abhishek Srivastava, May 12, 2004, in forum: ASP .Net
    Replies:
    0
    Views:
    382
    Abhishek Srivastava
    May 12, 2004
  2. Henri
    Replies:
    4
    Views:
    3,407
    Henri
    May 18, 2004
  3. news.microsoft.com

    Why is _ctl added to my servercontrols Id?

    news.microsoft.com, Jul 15, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    1,007
    Teemu Keiski
    Jul 15, 2004
  4. R.A.M.

    2.0: WebControls vs HtmlControls

    R.A.M., Jun 6, 2006, in forum: ASP .Net
    Replies:
    0
    Views:
    327
    R.A.M.
    Jun 6, 2006
  5. Replies:
    4
    Views:
    656
Loading...

Share This Page