This is a migrated thread and some comments may be shown as answers.

Add New RowPosition Bottom causes UserAddedRow event not to fire...

5 Answers 169 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Bobby Ross
Top achievements
Rank 1
Bobby Ross asked on 04 Feb 2012, 04:44 PM
I think I found a bug in the latest realease 2011.3.11.1219 that causes the UserAddedRow event not to fire..  Found this after upgrading a large project and critical events that occur after a user completes adding a new row no longer fired.

This is not confined to my project as it can be reproduced easily in new projects.

To reproduce you just need a bound grid with the new row position set to bottom, then hook the UserAddingRow event.  The event will never fire.  Change the new row position back to default (Top) and the event fires.

This doesn't appear to affect any other events including the UserAddingRow event, only UserAddedRow.

// Change new row position to bottom
this.radGridView1.AddNewRowPosition = SystemRowPosition.Bottom;
// Add an event for UserAddedRow
this.radGridView1.UserAddedRow += new GridViewRowEventHandler(radGridView1_UserAddedRow);
 
// Event will not fire
 void radGridView1_UserAddedRow(object sender, GridViewRowEventArgs e)
        {
            throw new NotImplementedException();
        }

5 Answers, 1 is accepted

Sort by
0
Richard Slade
Top achievements
Rank 2
answered on 06 Feb 2012, 11:08 AM
Hello,

I haven't been able to replicate this issue. Please can you try the sample below and let me know if this works for you.

Form1 Designer
namespace RadControlsWinFormsApp1
{
    partial class Form1
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components;
 
        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }
 
        #region Windows Form Designer generated code
 
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.radGridView1 = new Telerik.WinControls.UI.RadGridView();
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).BeginInit();
            this.SuspendLayout();
            //
            // radGridView1
            //
            this.radGridView1.Dock = System.Windows.Forms.DockStyle.Fill;
            this.radGridView1.Location = new System.Drawing.Point(0, 0);
            this.radGridView1.Name = "radGridView1";
            this.radGridView1.Size = new System.Drawing.Size(284, 262);
            this.radGridView1.TabIndex = 0;
            this.radGridView1.Text = "radGridView1";
            this.radGridView1.UserAddedRow += new Telerik.WinControls.UI.GridViewRowEventHandler(this.radGridView1_UserAddedRow);
            //
            // Form1
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 262);
            this.Controls.Add(this.radGridView1);
            this.Name = "Form1";
            this.Text = "Form1";
            ((System.ComponentModel.ISupportInitialize)(this.radGridView1)).EndInit();
            this.ResumeLayout(false);
 
        }
 
        #endregion
 
        private Telerik.WinControls.UI.RadGridView radGridView1;
    }
}

Form 1
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls.UI;
namespace RadControlsWinFormsApp1
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
 
            List<Person> people = new System.Collections.Generic.List<Person>();
            people.Add(new Person(1, "Richard",5));
            people.Add(new Person(2, "Chris", 10));
            people.Add(new Person(3, "Pete", 7));
 
            radGridView1.DataSource = people;
 
            this.radGridView1.AddNewRowPosition = Telerik.WinControls.UI.SystemRowPosition.Bottom;
 
  
  
        }
 
        private void radGridView1_UserAddedRow(object sender, Telerik.WinControls.UI.GridViewRowEventArgs e)
        {
            MessageBox.Show(e.Row.Cells[1].Value.ToString());
        }
    }
 
    public class Person
    {
        public Person(int userId, string userName, int totalStuff)
        {
            UserId = userId;
            UserName = userName;
            TotalStuff = totalStuff;
        }
 
        public Person()
        { }
 
        public int UserId
        {
            get;
            set;
        }
 
        public string UserName
        {
            get;
            set;
        }
 
        public int TotalStuff
        {
            get;
            set;
        }
    }
}

hope that helps, but let me know if you have any questions
Richard
0
Bobby Ross
Top achievements
Rank 1
answered on 06 Feb 2012, 08:00 PM
Exact same results...  No firing of UserRowAdded event using the example you provided when the row is positioned at the bottom of the grid.  I ran this project on other machines and verified that all References were to the correct versions.  I cannot figure this out...

Have tried it on XP, .NET 4 and 3.5 with the same results.  Just installed this version the other day and it broke, prior to that everything worked fine...

Also I just to make sure, this was built using the latest Q3 build? 2011.3.11.1219
0
Richard Slade
Top achievements
Rank 2
answered on 07 Feb 2012, 10:18 AM
Hello,

Ok - I have found that the UserAddedRow event does fire when it's on the bottom if you press enter on the last cell. If you tab through the last cell then the event does not fire. I'll see if I can provide a workaround for this, but in the long term, Telerik will need to address this in a release in my view.

Richard
0
Richard Slade
Top achievements
Rank 2
answered on 07 Feb 2012, 01:22 PM
Hello,

I've looked in the Public Issue Tracking System for this issue and it appears that (analmost identical) issue is already known about. Please refer to this issue ticket 
Looks like this is scheduled to be fixed in Q2 2012.
Hope this helps
Richard
0
Stefan
Telerik team
answered on 08 Feb 2012, 04:25 PM
Hi guys,

Thank you for writing.

I can confirm that when the new row is at the bottom and you tab through the cells, the UserAddedRow event is not fired. This issue is different from the one in the PITS item mentioned by Richard and this is why I will log it in PITS as a new item and we will do our best to fit it in our plans for the upcoming release (without making any certain promises). Here is a link to the item, where you can add your vote for it and also you can track its status updates: http://www.telerik.com/support/pits.aspx#/public/winforms/9640.

@Bobby, I have updated your Telerik points for this report.

If you guys find any other case when the event is not fired, do not hesitate to write back.
 
Kind regards,
Stefan
the Telerik team
Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Tags
GridView
Asked by
Bobby Ross
Top achievements
Rank 1
Answers by
Richard Slade
Top achievements
Rank 2
Bobby Ross
Top achievements
Rank 1
Stefan
Telerik team
Share this question
or