[![](http://1.bp.blogspot.com/-BbJDYNJ9yJQ/UNu49lR8hFI/AAAAAAAAAeA/ETeG2o2Gs4M/s640/111.png)](http://1.bp.blogspot.com/-BbJDYNJ9yJQ/UNu49lR8hFI/AAAAAAAAAeA/ETeG2o2Gs4M/s1600/111.png)
建立VisualWebPart(後面簡稱vwp)後會產生以下檔案結構
[![](http://4.bp.blogspot.com/-sj79ZvE6lH4/UNu5jeqCYrI/AAAAAAAAAeI/stuhIeBL11k/s1600/111.png)](http://4.bp.blogspot.com/-sj79ZvE6lH4/UNu5jeqCYrI/AAAAAAAAAeI/stuhIeBL11k/s1600/111.png)
**.XML檔中可以設定vwp佈署後歸類在哪個群組裡面**
[![](http://4.bp.blogspot.com/-Vv3Q5WgnzGo/UNu68vKX92I/AAAAAAAAAeg/l0j6pcw1oLY/s640/111.png)](http://4.bp.blogspot.com/-Vv3Q5WgnzGo/UNu68vKX92I/AAAAAAAAAeg/l0j6pcw1oLY/s1600/111.png)
[![](http://4.bp.blogspot.com/-8K_6ifqFwTw/UNu7eFJb4gI/AAAAAAAAAeo/uMqpnmtiMNc/s320/111.png)](http://4.bp.blogspot.com/-8K_6ifqFwTw/UNu7eFJb4gI/AAAAAAAAAeo/uMqpnmtiMNc/s1600/111.png)
**VWP的CS檔中可以增加可設定的參數**
```csharp
namespace ScinoPharm.EIP.vwpSurveys
{
[ToolboxItemAttribute(false)]
public class vwpSurveys : WebPart
{
//增加可設定的參數
[Category("MySetting"),
Personalizable(PersonalizationScope.Shared), //共用設定
WebBrowsable(true), //是否顯示在面板上
WebDisplayName("來源清單名稱"),
WebDescription("請填寫Survey資料來源的清單名稱") //描述
]
public string ListName{get;set;}
//當您變更視覺 Web 組件專案項目時,Visual Studio 可能會自動更新此路徑
private const string _ascxPath = @"~/_CONTROLTEMPLATES/ScinoPharm.EIP/vwpSurveys/vwpSurveysUserControl.ascx";
protected override void CreateChildControls()
{
Control control = Page.LoadControl(_ascxPath);
ControlSkin.Add(control);
}
}
}
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 <div class="separator" style="clear: both; text-align: left;">** **</div><div class="separator" style="clear: both; text-align: center;">[![](http://4.bp.blogspot.com/-vNWquvR2rzs/UNu9Aq_nY_I/AAAAAAAAAe4/lNd-Ro9x2Z4/s1600/111.png)](http://4.bp.blogspot.com/-vNWquvR2rzs/UNu9Aq_nY_I/AAAAAAAAAe4/lNd-Ro9x2Z4/s1600/111.png)</div><div class="separator" style="clear: both; text-align: left;"> </div><div class="separator" style="clear: both; text-align: left;"> </div>**在UserControl中要抓到VWP的參數設定,需要透過以下的方法** ```csharp public vwpSurveys SurveyParameter; protected void Page_Load(object sender, EventArgs e) { if (!Page.IsPostBack) { SurveyParameter = this.Parent as vwpSurveys; } }
** **