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.
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.
A good workman is known by his tools.
Joined: May 18, 2007
subject: MS 70-528 Johnsson Northrup Chpt 3 page 102