110,499
社区成员
发帖
与我相关
我的任务
分享
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
this.QueryAllAndBind();
}
this.gvBaseInfoTypeList.Templates.EditForm = new BaseInfoTypeManagerTemplate();
}
class BaseInfoTypeManagerTemplate : ITemplate
{
public void InstantiateIn(Control container)
{
GridViewEditFormTemplateContainer editFormTemplateContainer = container as GridViewEditFormTemplateContainer;
BaseInfoTypeManagerEditor _editForm = new UserControl().LoadControl("HR/Person/WebControl/BaseInfoTypeManagerEditor.ascx") as BaseInfoTypeManagerEditor;
_editForm.ID = "BaseInfoTypeManagerEditor";
editFormTemplateContainer.Controls.Add(_editForm);
//这里做了一些数据库的操作
if (editFormTemplateContainer.Grid.IsNewRowEditing)
{
_editForm.CurrntEntity = new BaseInfoTypeEntity();
}
else if (editFormTemplateContainer.Grid.IsEditing)
{
_editForm.CurrntEntity = new BaseInfoTypeBL().GetBaseInfoTypeByKey(editFormTemplateContainer.KeyValue.ToString());
_editForm.SetValue();
}
}
}
<dxe:ASPxButton ID="btnSave" runat="server" Text="保存" ValidationGroup="Save" Width="80px">
<Image Url="~/Images/HR/save.gif" />
<ClientSideEvents Click="function(s, e) {aspxGVUpdateEdit('gvBaseInfoTypeList');e.processOnServer=false;}" />
</dxe:ASPxButton>