ASP.Net: User controls added to placeholder dynamically cannot retrieve values

前端 未结 8 1759
攒了一身酷
攒了一身酷 2021-02-09 02:53

I am adding some user controls dynamically to a PlaceHolder server control. My user control consists of some labels and some textbox controls.

When I submit the form

8条回答
  •  伪装坚强ぢ
    2021-02-09 03:41

    We have experienced the same thing and have handled it by using ghost controls on page_load that have the exact same .ID and then the post back picks up the events and the data. As others said it's the dynamic adding of the control after the init stages that the state is built already and controls added after aren't stored.

    Hope this helps a bit.

提交回复
热议问题