CSLA .NET

Vibrant discussion about CSLA .NET and using the framework to build great business applications.

Forum has moved

New location: CSLA .NET forum


CSLA .NET Resources:
  • CSLA .NET forum
  • CSLA .NET home page
  • A BindingSourceNode problem.

    rated by 0 users
    Not Answered This post has 0 verified answers | 0 Replies | 1 Follower

    Not Ranked
    1 Posts
    lanzhoulei posted on Fri, Aug 2 2013 3:17 PM

    hi, all.

    When I modify the sample ActionExtenderSample(C# ) solution. async save data. than throw DataGridView.IndexOutOfRangeException. I hope to get some help. Thank you.

    // field
    private OrderDetailCollection _details;
    // constructor
    _details = OrderDetailCollection.GetOrderDetailCollection();

    // BindUI method
    _BindingTree = BindingSourceHelper.InitializeBindingSourceTree(this.components, orderDetailCollectionBindingSource);
    _BindingTree.Bind(_details);
    // button click: delete item
    private void button1_Click(object sender, EventArgs e)
    {

        var data = orderDetailCollectionBindingSource.Current as OrderDetail;
        _details.Remove(data);

    }
    // toolSave click
    private void toolSave_Click(object sender, EventArgs e)
    {
        SaveAsync();
    }
    private void SaveAsync()
    {
    _BindingTree.Apply();
    var old = _details.Clone();
    // Raise Paint event. Here will throw exception: DataGridView.IndexOutOfRangeException
    // If I remove it, then no problem
    orderDetailListDataGridView.Width = 300;
    orderDetailListDataGridView.Height = 100;

    _details.BeginSave((o, r) =>
    {
    if (r.Error == null)
        _details = r.NewObject as OrderDetailCollection;
    else
        _details = old;
    _BindingTree.Bind(_details);
    });

    }
    Page 1 of 1 (1 items) | RSS

    Copyright (c) 2006-2014 Marimer LLC. All rights reserved.
    Email admin@lhotka.net for support.
    Powered by Community Server (Non-Commercial Edition), by Telligent Systems