2010-09-05 43 views

回答

1

方法正如该答案所示,您应该在用户控件中创建一个方法,该方法将公开您驻留在用户控件中的下拉列表的选定值。

在你WebUserControl(用户控件)的代码隐藏文件,你可以有这样的事情:

public string DropDownSelectedValue 
{ 
    get 
    { 
     return dropDown.SelectedValue; 
    } 
} 

现在你的网页上,你正在使用的用户控件,你应该叫这样的财产这个:

// Assuming you defined your usercontrol with the 'yourUserControl' ID 
string selectedValue = yourUserControl.DropDownSelectedValue; 

请确保您重建您的usercontrol代码(项目),以便这个新的属性可供您使用。