【发布时间】:2010-11-16 01:59:51
【问题描述】:
我正在开发我的第一个网络部件。 我使用一些用户控件作为屏幕。我在这里遇到了麻烦。
第一个屏幕包含动态创建的选项列表(超链接)。用户通过点击做出决定后,我想更改屏幕并将一些参数传递给新屏幕。
-
我的决定是加载我在创建 webpart 时需要的所有控件。我现在不需要的控件我隐藏了。
SomeUserControl1 uc1 = (SomeUserControl1)Page.LoadControl("~/_controltemplates/SomeUserControl1.ascx"); SomeUserControl2 uc2 = (SomeUserControl2)Page.LoadControl("~/_controltemplates/SomeUserControl2.ascx"); uc2.Visible = false; Controls.Add(uc1); Controls.Add(uc2); 第一个用户控件中的选项实现为 LinkButtons(服务器端)。 OnClik 事件调用 webpart 类中的一个特殊方法,在这个方法中我改变了我的用户控件的可见性并将一些参数传递给 usercontrol2。
我不喜欢这种方法。是否有不同的方法来实现所描述的功能?
谢谢!
【问题讨论】:
标签: sharepoint user-controls web-parts