void drp_DataBinding(object sender, EventArgs e) { DropDownList drp = (DropDownList)sender; GridViewRow gr = (GridViewRow)drp.NamingContainer; BLL.T_UsersInfo_BLL Ubll = new DigiPower.Onlinecol.Standard.BLL.T_UsersInfo_BLL(); DataSet ds = Ubll.GetAllList(); for (int i = 0; i < ds.Tables[0].Rows.Count; i++) { ListItem item = new ListItem(); item.Text = ds.Tables[0].Rows[i]["UserName"].ToString(); item.Value = ds.Tables[0].Rows[i]["UserID"].ToString(); drp.Items.Add(item); } //关键位置 //使用DataBinder.Eval绑定数据 //ProName,MyTemplate的属性.在创建MyTemplate实例时,为此属性赋值(数据源字段) string ArlistID = DataBinder.Eval(gr.DataItem, "FileListID").ToString(); BLL.T_FileList_BLL Abll = new DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL(); Model.T_FileList_MDL Amodel = new DigiPower.Onlinecol.Standard.Model.T_FileList_MDL(); Amodel = Abll.GetModel(Common.ConvertEx.ToInt(ArlistID)); if (Amodel != null) { drp.SelectedValue = Amodel.OperateUserID.ToString(); } }
/// <summary> /// 绑定页面 /// </summary> /// <param name="ID"></param> private void BindPage(string ID) { Model.T_FileList_MDL model = new DigiPower.Onlinecol.Standard.Model.T_FileList_MDL(); BLL.T_FileList_BLL bll = new DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL(); model = bll.GetModel(Convert.ToInt32(ID)); if (model != null) { DigiPower.Onlinecol.Standard.Web.Comm.SetValueToPage(model, this.tbl); } }
protected void btnSave_Click(object sender, EventArgs e) { DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL documentbll = new DigiPower.Onlinecol.Standard.BLL.T_FileList_BLL(); DigiPower.Onlinecol.Standard.Model.T_FileList_MDL model = documentbll.GetModel(Common.ConvertEx.ToInt(ID)); model = (Model.T_FileList_MDL)Comm.GetValueToObject(model, tbl); if (model != null) { model.qssj = DateTime.Now; model.zzsj = DateTime.Now; model.lrsj = DateTime.Now; model.shsj_1 = DateTime.Now; model.shsj_2 = DateTime.Now; model.shsj_3 = DateTime.Now; model.aipdate = DateTime.Now; //model.pssj = DateTime.Now; model.CreateDate = DateTime.Now; documentbll.Update(model); } Common.MessageBox.CloseLayerOpenWeb(this.Page); }