Hi There,
Im very ;) new to Csla and tried an example from the book. It works fine when im using a standard windows forms button, but when im using a toolbarbutton the last field i entered will be cleared after the save operation. I hope im not nr gazilion asking this question.
Best Regards,
Laurens
public partial class InvoiceView : UserControl, ISave
{
public InvoiceView()
{
InitializeComponent();
invoice = Invoice.NewInvoice();
BindUI();
}
private Invoice invoice = null;
private BindingSourceNode _bindingTree = null;
private void BindUI()
{
_bindingTree = BindingSourceHelper.InitializeBindingSourceTree(this.components, invoiceBindingSource);
_bindingTree.Bind(invoice);
}
public void Save()
{
if(SaveObject())
MessageBox.Show("Object saved..");
}
public bool SaveObject()
{
bool ret = false;
_bindingTree.Apply();
try
{
invoice = invoice.Save();
ret = true;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
BindUI();
return ret;
}
private void button1_Click(object sender, EventArgs e)
{
SaveObject();
}
}
Hi Tetranz,
That's it. Thanks a lot!!
Best Regards,
Laurens
Copyright (c) Marimer LLC