aspnet网站开发实例 ASP.NET MVC 4框架揭秘:MVP(1)[2]
ASP.NET MVC 4框架揭秘:MVP(1)[2]
正确的接口和实现该接口的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
{
this DropDownListDepartments DataSource = value;
this DropDownListDepartments DataBind()
}
}
public string SelectedDepartment
{
get { return this DropDownListDepartments SelectedValue;}
}
public IEnumerable<Employee> Employees
![aspnet网站开发实例 ASP.NET MVC 4框架揭秘:MVP(1)[2]](http://img.zhputi.com/uploads/797b/797b4eedf56ae1fd659e082555bb776742247.jpg)
{
set
{
this GridViewEmployees DataSource = value;
this GridViewEmployees DataBind()
}
}
}
返回目录ASP NET MVC 框架揭秘
编辑推荐
Java程序性能优化 让你的Java程序更快 更稳定
Visual C++音频/视频技术开发与实战
lishixinzhi/Article/program/net/201311/16128