asp.net实现非常实用的自定义页面基类(附源码)(2)

using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Text; using System.Threading; namespace WebTest { using DotNet.Common.WebForm; using DotNet.Common.Model; using EntCor.Hrm.Model; public partial class _Default : BasePage { protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { Employee employee = new Employee { ID = 1, UserName = "jeff wong", Address = "北京", IsLeave = false, RealName = "测试用户", State = "2" }; this.SetFormData(employee); //给页面控件赋值 } } } }

3、使用反射给对象赋值

点击”测试”按钮,将页面控件(runat=server)的值赋给实体对象:

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wjwfyp.html