Hello,
I have an UltraWinGrid control which is bound to a DataTable.
A new row is inserted to this DataTable upon an user action.
The new row is inserted into the grid and appears successfully.
My problem now is that I want to be notified by an UltraGrid event of this row insertion.
The AfterRowInsert event does not fire in this case. I guess it only does when rows are inserted explicitely to the grid. As the row was inserted into the DataTable, UltraGrid does not fire this event.
It might trigger another one, but I have not found which yet?
Some people may probably advise me to detect this inside the DataTable itself, but it is not possible in my case because I'm encapsulating this specific grid' logic in my own class derived from UltraGrid, where I override methods like OnAfterInsert, etc.
This means I do not have access to the DataTable, declared a level above.
Here is a simplified example showing the issue.
I believe there must be an event or property to change to make the AfterRowInsert event trigger?
Thanks in advance.
namespace WindowsFormsApplication1 { using System; using System.Data; using System.Windows.Forms; public partial class Form1 : Form { public Form1() { InitializeComponent(); } DataTable dt = new DataTable(); private void Form1_Load(object sender, EventArgs e) { dt.Columns.Add("FirstName", typeof(string)); dt.Columns.Add("LastName", typeof(string)); dt.Rows.Add("Bill", "Clinton"); dt.Rows.Add("George", "Bush"); ultraGrid1.DataSource = dt; } private void button1_Click(object sender, EventArgs e) { dt.Rows.Add("Barack", "Obama"); } private void ultraGrid1_AfterRowInsert(object sender, Infragistics.Win.UltraWinGrid.RowEventArgs e) { MessageBox.Show("I got a new row. <- This never fires."); } } }
Hi,
There is no event for this in the WinGrid. In this case, the grid is not initiating the action, the grid is responding to notifications from the BindingManager, so it's a consumer of an event, not the originator of one.
You could hook into the notifications on the DataTable's IBindingList imlpementation, which is essentially what the grid does.
Thanks Mike,
I understand and that's what I assumed but I think it would be useful to have a way to get the grid to notify.
I mean, a new row was inserted in the grid (even though I agree it is the data source that actually changed) so the grid should be able to trigger an event when that happens.
I would prefer to write my grid-centric code without relying on the data-source's implementation detail at all. The code I want to perform is grid-related so I don't think replying to the datasource's event is the best place for this kind of code.
Maybe new methods like OnAfterDataSourceRowInserted, etc could be useful? Or a property to allow the existing events to trigger in such a case?
My
Is this event ''AfterDataSourceRowInserted' already been implemented...... We need it. It's quite useful. Thanks.
Thanks,
Chirag
After some research, the "Ability to have a notification event 'AfterDataSourceRowInserted' has been determined to be a new product idea. I have sent your idea directly to our product management team.
Our product team chooses new ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested features, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time.
Your reference number for this product idea is PI12040098.
If you would like to follow up on your request at a later point, you may contact Developer Support management via email. Please include the reference number of your product idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.
I understand what you mean. It would probably be easier if the grid had such an event, but it does not. You can Submit a feature request to Infragistics and perhaps a new event will be added in a future release. :)