Hello Admins,
I want to develop a Responsive DataGrid Record insertion.
Like When I have to add Data from List<Objects>.
- I want to Show RowByRow insertion.
- How can i show waiter control while loading the data From the List.
What will be Best Solution can be applied in both scenarios.
9 Answers, 1 is accepted
Hello, Kashif,
If you need to add row by row in RadGridView and this behavior to be noticeable for the end user, I would suggest you to use a timer. Please refer to the below code snippet which result is illustrated in the attached gif file:
BindingList<Item> items = new BindingList<Item>();
public RadForm1()
{
InitializeComponent();
this.radGridView1.DataSource = items;
this.radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
}
private void timer1_Tick(object sender, EventArgs e)
{
items.Add(new Item(items.Count, "Item" + items.Count));
}
public class Item
{
public int Id { get; set; }
public string Name { get; set; }
public Item(int id, string name)
{
this.Id = id;
this.Name = name;
}
}
private void radButton1_Click(object sender, EventArgs e)
{
if (!this.timer1.Enabled)
{
this.timer1.Start();
}
else
{
this.timer1.Stop();
}
}
As to the waiting indicator, you can use RadWaitingBar which allows you to associate it to any control indicating its load time. The following help article demonstrates a sample approach: https://docs.telerik.com/devtools/winforms/controls/track-and-status-controls/waitingbar/associated-control
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
thank you very much. Your example help me a lot.
Can u provide code used in WaitingIndicator.gif.
thank you
Hello, Kashif,
I have attached my sample project for your reference.
I hope it would be helpful.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Using Associated Control with ONE control is working fine.
Can we Use associated control property for the whole form, including other controls(like buttons, textboxes etc) on the form.
Or there will any other method for doing this.
I would suggest you to use a RadPanel as an associated control for the waiting bar. Thus, you can place different controls in the panel and the waiting indication will be shown over all the controls that are hosted in the panel.
I hope this information helps.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik
Thank you for the suggestion.
Using waiting bar in timer control is working perfectly.
Now an other requirement.
I'm Assigning DataTable to GridView Data Source Property.
How to show progress/WaitingBar while form is Fetching the Data in the Data table and assigning it to Gridview.DataSource
For long-lasting operations like extracting data from the database for example, it is suitable to use a BackgroundWorker. Thus, the main UI thread won't be busy with this operation.
I would recommend you to have a look at the following help article which demonstrates how to show a waiting bar while a background operation is being executed: https://docs.telerik.com/devtools/winforms/controls/track-and-status-controls/waitingbar/using-waitingbar-with-a-background-worker
I hope this information helps. If you need any further assistance please don't hesitate to contact me.
Regards,
Dess | Tech Support Engineer, Sr.
Progress Telerik