using System.Windows.Forms;
namespace testGridViewKeyPress
{
public partial class RadForm2 : Telerik.WinControls.UI.RadForm
{
private int count_;
public RadForm2()
{
InitializeComponent();
count_ = 0;
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
count_++;
radLabel1.Text = count_.ToString();
radGridView2.BeginUpdate();
radGridView2.Rows.Clear();
//I Want to Process Row Clear And Add
radGridView2.EndUpdate();
return true;
}
}
}
When I hold down the key, I want to clear the row of the GridView and add a new row.
However, when the number of columns increases, even if rows work is performed between BeingUpdate() and EndUpdate(),
All UI is not highlighted or updated.
If the control needs processing when in the press state like this, shouldn't I use gridview?
Or, if there is another solution, please let me know.
+What I want is for all UI to update and operate when a key is pressed.
+My telerik version 2021.3.914.40(Dev)
5 Answers, 1 is accepted
Hello Park,
I appreciate the provided project.
This stuck behavior comes from calling the BeginUpdate() and EndUpdate() methods of the RadGridView in the ProcessCmdKey() of the Form. At a specific point, the UI is not updated while the rows are still added. A better approach here will be to bind the RadGridView to a BindingList collection, for example. This way you won't need to call the BeginUpdate/EndUpdate method while working with the bound collection.
I have modified your project to demonstrate what I have in mind. In the current approach, both controls RadGridView and RadListView are bound to one and the same collection.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hello Dinko
This can be solved by using BindingList rather than adding directly to Rows. I will modify the Gridview data of the project I am using to manipulate the data using BindingList. thank you
Hello Park,
I appreciate the provided code snippet but I will need to clarify your scenario. Can you share which key press, the grid should be refreshed? If I have correctly understood your case, you want to rebind the grid with new data when a specific key is pressed. Using the BeginUpdate() and EndUpdate() methods is an appropriate way to update the control. However, I am not sure what you mean by the UI is not updated. Can you share more details regarding this?
As a side note, I would recommend to update the latest version of our controls. This way you can take advantage of new controls, new functionalities, bug fixes, etc.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
Hello Dinko
(The above gif is a gif in which the mouse is moved over the gridview control while the key is pressed, but it does not respond to the UI and the label is updated only when the key is released.)
I would like to add to what you said (the gif file was not uploaded :()
While pressing any key, the UI is not updated when the number of columns in the Gridview exceeds a certain number. Like the GIF, it does not respond to the mouse MOVE state and replaces the Count of radLabel with text, but this is also updated only when the key is released. We need to confirm whether this part is unavoidable.
Based on what you mentioned, I would like to inform you that upgrading the version is difficult in my situation. thank you
Hi Park,
Thank you for the additional information.
To test your case I have tried to isolate your steps in a sample project. So far I was able to observe the described behavior. I think that I am missing additional code from your implementation. Can you modify the attached project and send it back to me so that I can examine your code more closely?
I am looking forward to your reply.
Regards,
Dinko | Tech Support Engineer
Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.
(This is the attached project operation gif that works well when the UI freezes when a key is pressed and is just down.)
Hello Dinko
I've attached the project I'm having trouble with.
I wish the UI would be updated during keypressing. Not only the Gridview but also the ListView is not updated and the label is not updated when the key is pressed.
thank you please help me :(