正确的接口和实现该接口的View(一个Web页面)应该采用如下的定义方式Presenter通过对属性Departments和Employees赋值进而实现对相应DropDownList和GridView的数据绑定通过属性SelectedDepartment得到用户选择的筛选部门为了尽可能让接口只暴露必需的信息我们特意将对属性的读/写作了控制
public interface IEmployeeSearchView
{
IEnumerable<string> Departments { set; }
string SelectedDepartment { get; }
IEnumerable<Employee> Employees { set; }
}
public partial class EmployeeSearchView: Page IEmployeeSearchView
{
//其他成员
public IEnumerable<string> Departments
{
set
{
thisDropDownListDepartmentsDataSource = value;
thisDropDownListDepartmentsDataBind()
}
}
public string SelectedDepartment
{
get { return thisDropDownListDepartmentsSelectedValue;}
}
public IEnumerable<Employee> Employees
{
set
{
thisGridViewEmployeesDataSource = value;
thisGridViewEmployeesDataBind()
}
}
}
返回目录ASPNET MVC 框架揭秘
编辑推荐
Java程序性能优化让你的Java程序更快更稳定
Visual C++音频/视频技术开发与实战
[] []