I am using C# and .NET 4.0.
I have an ascx control which contains two drop down lists. ddList1 is parent to ddList2 (think Car Make - Car Model). I have a constructor that populates a private variable in this control with a reference back to the original invoking object. When I do an async postback on the control (caused by changing ddList1), the private variable which was populated originally by the constructor is now null.
How do I retain the reference to the original calling object?
Thanks!
Store the value of the variable in your ViewState, and retrieve it during the postback. The Web is stateless: you have to work around that fact, even in WebForms.
使用任何状态管理技术...例如会话或隐藏字段,以在回发之间存储引用
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.