且构网

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

动态添加时用户控件无法正常工作

更新时间:2022-06-01 04:04:05

马修,

因为您要在每个Page_Load上添加usercontrol,所以不会触发usercontrol的事件。解决这个问题的第一步是检查请求是否是回发( Page.IsPostBack )。

Because you are adding your usercontrol on each Page_Load, the events of the usercontrol aren't being fired. First step to fix this is check to see if the request is a postback (Page.IsPostBack).

您的问题是
多次寻址
,祝你好运!

Your issue has been addressed multiple times, good luck!

希望这有帮助

编辑:

哦,顺便说一句:


  • 我会将ScriptManager放在页面上在UserControl上。
  • ScriptMananager应该是页面上的第一个控件