We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

ProgressBar cell in GridDataBoundGrid

I''ve used a GridDataBoundGrid in my project, and one of the GridBoundColumn''s CellType is ProgressBar. The progressbar''s value is dynamically changed when the dataset''s value is changed. When the program runs, the progressbar seems ok at the begining, but it will become a mass when redrawing. Another question: If I set the ProgressBar''s TextStyle to Custome, how can I set the Text of the ProgressBar. Thanks. the code is as below: private void usptoGrabProgressGridDataBoundGrid_PrepareViewStyleInfo(object sender, Syncfusion.Windows.Forms.Grid.GridPrepareViewStyleInfoEventArgs e) { if(e.RowIndex == 0 || e.ColIndex == 0) return; int randomNumber = rng.Next(8, 12) * 100000; // this is used to simulate dynamically changed data // all rows should have a 100% filled progressbar, but they don''t, why? e.Style.ProgressBar.ProgressValue = e.Style.ProgressBar.Maximum = randomNumber; }

1 Reply

AD Administrator Syncfusion Team November 15, 2004 03:12 AM

PrepareViewStyleInfo is only hit for a cell when that cell is being redrawn. If you do not do something to trigger the redraw when the underlying progress value changes (like call RefreshRange), then the cell will not change what is displayed. Here is a little sample that has a column of progressbars. It uses a timer to change the underlying value, and when it does, it also calls grid.RefreshRange so the cell is redrawn using the new values. It uses mode.QueryCellInfo to provide the value (instead of PrepareViewStyleInfo, but I think both should work). If you continue to have problems with PrepareViewStyleInfo, you could move your code to a Model.QueryCellInfo event handler to see if that will work better. GDBGProgressBar5018_9433.zip

Loader.
Live Chat Icon For mobile
Up arrow icon