11,578 questions
Progress bar is stuck and stops moving when setting devexpress gridview datasource and styles
Thakur, Apurva [EMR/SYSS/PSS/PUNE]
0
Reputation points
private async void frmCyberSecurity_Load(object sender, EventArgs e)
{
try
{
DataTable headersTable = new DataTable();
await Task.Run(() =>
{
Logger.Info("frmCyberSecurity_Load starts....");
string csvFilePath = Path.Combine(TempFolderPath, "Temp", "Master Policies.csv");
dtMainPolicyTable = BusinessLogic.BusinessLogic.LoadCsv(csvFilePath);
//DataTable headersTable = mainTable.Clone();
headersTable.Columns.Add("Setting", typeof(string));
// Add the rest of the boolean columns from mainTable
foreach (DataColumn column in dtMainPolicyTable.Columns)
{
if (column.DataType == typeof(bool))
{
headersTable.Columns.Add(column.ColumnName, typeof(bool));
}
}
ReadAdmxFile.ParseAdmxFiles(admxDirectory, skippedFiles, out policies, out categories,
out Global.DropDownList);
});
this.BeginInvoke(new Action(() =>
{
gridViewPolicy.BeginUpdate();
gridControlPolicy.DataSource = dtMainPolicyTable;
gridViewPolicy.EndUpdate();
gridViewHeader.BeginUpdate();
gridControlHeader.DataSource = headersTable;
gridViewHeader.EndUpdate();
SetGridviewStyle();
panelProgress.Visible = false;
progressPanel1.Visible = false;
EnableTableLayoutPanelControls(tblMain);
}));
}
catch (Exception ex)
{
Logger.Error($"frmCyberSecurity_Load \r\nMESSAGE : {ex.Message} \r\nSOURCE : {ex.Source} \r\nINNER EXCEPTION :{ex.InnerException} \r\nSTACK TRACE : {ex.StackTrace}", ex);
}
}
I'm facing an issue where the progress bar freezes when I set the DataSource
of the grid and apply GridView styles. It only starts updating again once the data binding and styling are complete. I tried commenting out gridControlPolicy.DataSource = dtMainPolicyTable;
and the progress bar runs smoothly, so the problem seems related to the data binding. I want the progress bar to run continuously on the UI while the data is being bound and styled in the background, and then stop once that operation is complete.
Developer technologies | C#
Sign in to answer