且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

难倒使用自定义属性的用户控件

更新时间:2022-06-05 02:56:06

它看起来像问题可能是时间/事件相关。

It looks like the issue might be timing/event related.

当您设定℃的财产;%#%> ,该值被分配到控件的数据绑定事件中的财产。如果您在的Page_Load()时间寻找它,它不会是那里。

When you set a property with <%# %>, the value is assigned to the property during the Control's databinding event. If you look for it at Page_Load() time, it won't be there yet.

如果你改变code,检查在 preRender 事件中的价值,它应该在那里。

If you change your code to check the value in the PreRender event, it should be there.