• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MS 70-528 Johnsson Northrup Chpt 3 page 102

 
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could someone help me to understand the following alinea in the self paced training kit


Chapter 3 Exploring Specialized Server Controls

If you need to programmatically add rows and cells to a table at run time, the Table control may be the right choice, but TableRow and TableCell objects that are added to the Table control need to be programmatically re-created when PostBack occurs.



Why do they have to be recreated?

If you need the rows and cells to survive PostBacks, you may want to consider using the DataList or GridView control.



And why here they do not?
The alinea concludes with:

As a result, the Table control is usually considered to be best suited for control developers who use the table as part of a custom control that they build.



Mmmm. Ok if you say it. But it does not yet make much sence to me.
 
pie sneak
Posts: 4727
Mac VI Editor Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Why do they have to be recreated?
When the Table component gets saved to ViewState, apparently the programatically added rows and cells don't get saved with it. When a PostBack request comes through, the page gets rerendered based on what is saved in ViewState. Since your dynamic stuff isn't in ViewState, you'd have to add it again.

And why here they do not?
I guess these components save to the ViewState better.

Mmmm. Ok if you say it. But it does not yet make much sence to me.
Table would be a good base starting point for creating your own component. I don't know how you'd make your component save off like the DataList or GridView but the book implies that it's possible.
 
Marc Wentink
Ranch Hand
Posts: 142
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Marc
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic