Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8033339
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:40:15+00:00 2026-06-05T01:40:15+00:00

I’ve just started a new job and inherited a nightmare WebForms .net 4.0 project

  • 0

I’ve just started a new job and inherited a nightmare WebForms .net 4.0 project that’s going wrong in lots of places.

I’ve got a user control that is storing a DataTable in ViewState. The code is referencing the columns throughout the code by index number which is making it totally unreadable. I know I can reference columns by name to make it more readable but I’d prefer to break it out into a List.

The previous developer is storing the list in ViewState because changes can’t be persisted back to the database, we read in data, sales people can make modifications to pricing and then the information is then pushed into XML format to generate a sales order form in PDF. So we need a mechanism for storing temporarily.

If I had the luxury of starting from scratch I’d pull the data down in JSON and do it all client side but I don’t have that luxury just yet.

  1. It’s been a long, long time since I worked with DataTables and I’m
    pretty sure it’s not good to be placing this in ViewState, am I
    correct? What kind of load would it be placing on the ViewState;
    we’re looking at 44 columns and normally around 25 rows. :s

  2. Secondly, if there a big difference between placing a List in
    ViewState as opposed to a DataTable or are they both as bad as each
    other – in which case I’m doing no harm from my current position to
    switch out?

  3. Third question, updates to rows are automatically updated in the
    ViewState DataTable, would that be the same with a List?

  4. Last one, more probing for advice. Where would the best place to
    store this information (preferably the List) server side – would
    Session or Cache be better?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T01:40:16+00:00Added an answer on June 5, 2026 at 1:40 am
    1. You are correct. It’s a terrible idea to store the DataTable in ViewState.

    2. Storing a List in ViewState is still bad and perhaps marginally better than storing a DataTable.

    3. It’s not clear what you mean by “updates occur automatically on the DataTable.” Unless you retrieve the DataTable from ViewState and apply any updates programmatically, I doubt that this is the case. You’d have to do the same if you use a List.

    4. Session is probably better but then you may run into scalability issues. Frankly, I would store it in Session but would opt for using one of the Out of Proc state providers. This way your serialized Datatable is not sent to the client on every request making your page size horrendously big while giving you the option to store this serialized data on different places, SQL server or ASP.NET State Server, for example.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have just tried to save a simple *.rtf file with some websites and
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
I have a French site that I want to parse, but am running into
I am doing a simple coin flipping experiment for class that involves flipping a
I need a function that will clean a strings' special characters. I do NOT

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.