简体   繁体   中英

Tradeoffs with client vs server side postback handling

I have a ListView that contains a large collection of rows with textboxes that users can optionally fill out. These textboxes are not databound. When the user clicks "next" i need to iterate over the rows and determine which fields the user has filled out, and then update a sort of "cart" with the data and move to a confirmation page ("you have selected a, g, v, zz, is this correct?" sort of thing).

  1. I can think of two ways to deal with this. The first is, server side, to walk the items in the listview, get the control ID's, save this data to a list, then save it to a database cart table for the next screen to read.

  2. I can use jquery to collect all the values client side, then pass it back to the form in a hidden field and use something like Newton.Json to get the data into a similar list.

What are the tradoffs of these two approaches? And can you think of a better way to do it?

Keep in mind that i'm on a very tight deadline, so need to do the option that i can implement the fastest.

I would say both are equally fast to implement, at least to me.

Do what you feel most comfortable with, and it looks to me that option 1 is something you know how to do, so that would probably be your choice if time is of essence.

Performance wise the an ajax call in option 2 sends less data compared to the viewstate in option 1.

If the number of fields are not too high, I don't think either solution is a trade-off. It's more a matter of where do you put your logic, and are you comfortable with putting it on the client.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM