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

PopulateValues - Why doesn't this work?

I'm trying to fill a grid with data on a row by row basis using the PopulateValues method of the grid. However, only the first column gets text put in it, the other columns of each row are left blank. Dim x(4) As String x(0) = "test1" x(1) = "test2" x(2) = "test3" x(3) = "test4" grdTest.PopulateValues(GridRangeInfo.Cells(1, 1, 1, UBound(x)), x) This code leaves only the first column with the text "test1", but the other columns are blank.

1 Reply

Administrator March 11, 2003 05:50 PM UTC

If you try this code, you would see your data populate column 1. grdTest.PopulateValues(GridRangeInfo.Cells(1, 1, UBound(x), 1), x) The method only populates across a row if there are two indices in the datasource. If there is only a single index in the datasource, it thinks you want to change rows with each new index. But is is straight-forward (and ver quick) to use SetCellInfo to populate across a row by looping through the row and calling SetCellInfo on each item. (This is what PopulateCells does).
'loop through this code
Dim style as GridStyleInfo = New GridStyleInfo()
style.CellValue = X(i)
grdTest.SetCellInfo(row, i, sfstyle, Syncfusion.Styles.StyleModifyType.Override)
Live Chat Icon For mobile
Up arrow icon