Rows.Count = 0 But SelectedRows.Count =1 Is there a bug?

2 posts, 0 answers
  1. Vicent
    Vicent avatar
    9 posts
    Member since:
    Mar 2015

    Posted 26 Feb Link to this post

    I'm using static BindingList as DataSource:

    public class Items
    {
        public static DateTime FechaTrabajo = DateTime.Today;
        public static MyBindingList<Pedidos> pedidos = new MyBindingList<Pedidos>();
        public static async Task Load(DateTime fechaTrabajo)
        {
            try
            {
                pedidos.Clear();
                FechaTrabajo = fechaTrabajo;
                pedidos.Add(await SSEService.Instance.GetPedidos(fechaTrabajo));
                pedidos.ListUpdated();
            }
            catch (Exception) { }
        }
    }

     

    Where MyBindingList extends BindingList and ListUpdated is like:

    public void ListUpdated()
    {
        this.OnListChanged(new ListChangedEventArgs(ListChangedType.Reset, 0));
    }

     

    I'm using Items.pedidos as datasource for the Grid and all is working perfect, grid is updating data when needed, but when I need selectedrows, if Items.pedidos has had data and now is empty. When I call:

    private void bNuevoPalet_Click(object sender, EventArgs e)
    {
        int rows = this.radGridView1.Rows.Count;
        int srows = this.radGridView1.SelectedRows.Count;
        if (this.radGridView1.SelectedRows.Count > 0)
        {
            Pedidos ped = this.radGridView1.SelectedRows[0].DataBoundItem as Pedidos;
            if (ped != null)
            {
                fPedido.ShowMe(ped);
            }
        }
    }

     

    rows = 0

    but srows = 1

     

  2. Nadya
    Admin
    Nadya avatar
    389 posts

    Posted 28 Feb Link to this post

    Hello Vicent,

    The provided detailed is greatly appreciated. I reproduced the described issue on my end and I confirm this is a bug. This is why I have logged it in our feedback portal by creating a public thread on your behalf. You can track its progress, subscribe for status changes and add your comments on the following link - feedback item.

    I have also updated your Telerik Points as a reward.

    To workaround this you can use the suggested solution:

    Private Sub radButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
        While Me.pedidos.Count > 0
            Me.pedidos.RemoveAt(0)
        End While
    End Sub

    I hope this helps. Do not hesitate to contact us if you have other questions.

    Regards,
    Nadya
    Progress Telerik

    Get quickly onboarded and successful with your Telerik and/or Kendo UI products with the Virtual Classroom free technical training, available to all active customers. Learn More.
Back to Top