Featured post
asp.net - What's the official Microsoft way to track counts of dynamic controls to be reconstructed upon Postback? -
when creating dynamic controls based on data source of arbitrary , changing size, official way to track how many controls need rebuilt page's control collection after postback operation (i.e. on server side during asp.net page event lifecycle) point @ dynamic controls supposed rebuilt? arity stored retrieval , reconstruction usage?
by "official" mean microsoft way of doing it. there exist hacks session storage, etc want know bonafide or @ least microsoft-recommended way. i've been unable find documentation page stating information. code samples work set of dynamic controls of known numbers. it's if doing otherwise tougher.
update: i'm not inquiring user controls or static expression of declarative controls, instead dynamically injecting controls code-behind, whether mine, 3rd-party or built-in asp.net controls.
this depends on problem @ hand, , type of controls you're recreating. simple text boxes or various different complex custom user controls. main thing here is: if want dynamic control regain state after post-back, have re-create in init phase of page life-cycle.
anyway. there's nothing microsoft way or microsoft recommended way basically. when you're dynamically adding several simple controls of same type hidden field count trick, when have several complex controls other ways have used. still hidden fields , save control's full type strings in them (ie. system.web.ui.webcontrols.textbox) , re-instantiate them. think of more complex example of putting various controls on different parts in page... , initializing them specific state. bit more challenging. hence no microsoft way... recommended way recreate in init phase. , that's it.
everything can solved, 1 took wrong direction in ui , things done easier using different approach.
additional explanation
this state-full technique of viewstate
asp.net uses considered worse culprit web developers in general. that's why asp.net mvc developers think new framework bliss since more suited state-less http protocol. me being 1 of them. :d
- Get link
- X
- Other Apps
Comments
Post a Comment