第十四篇
这段程序 无奈完成不了功能了
程序目的 把修旧数值放在TAG当中 然后还原
这段写在FORMLOAD中
foreach (Control aControl in layoutControl1.Controls)
{
if (aControl is BaseEdit)
{
//2010-07-25 初始Enabled false
aControl.Enabled = false;
((TextEdit)aControl).TextChanged += delegate(object sender2, EventArgs e2)
{
if (!(SheetID.Text == null || SheetID.Text.Equals("")))
{
hasDataChange = true;
barSaveItem.Enabled = barCancelItem.Enabled = true;
}
};
}
}
这段写在保存中
//step 4
foreach (Control aControl in layoutControl1.Controls)
{
BaseEdit edit = aControl as BaseEdit;
if (edit != null)
edit.IsModified = false;
}
这段写在取消中
foreach (Control aControl in layoutControl1.Controls)
{
if (aControl is BaseEdit)
{
BaseEdit edit = aControl as BaseEdit;
if (edit.IsModified)
edit.EditValue = edit.OldEditValue;
}
}
foreach (Control aControl in layoutControl1.Controls)
{
if (aControl is BaseEdit)
{
//2010-07-25 初始Enabled false
aControl.Enabled = false;
((TextEdit)aControl).TextChanged += delegate(object sender2, EventArgs e2)
{
if (!(SheetID.Text == null || SheetID.Text.Equals("")))
{
hasDataChange = true;
barSaveItem.Enabled = barCancelItem.Enabled = true;
}
};
}
}
这段写在保存中
//step 4
foreach (Control aControl in layoutControl1.Controls)
{
BaseEdit edit = aControl as BaseEdit;
if (edit != null)
edit.IsModified = false;
}
这段写在取消中
foreach (Control aControl in layoutControl1.Controls)
{
if (aControl is BaseEdit)
{
BaseEdit edit = aControl as BaseEdit;
if (edit.IsModified)
edit.EditValue = edit.OldEditValue;
}
}