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
close icon

adding celltype during runtime...

Hi all, I have created griddatabound to bind the dataset. there are columns created in PrepareViewStyleInfo event. tt column added is of celltype checkbox. so when i trigger the checkbox event, i will need to add pushbutton. however this pushbutton just can''t display out. is it i can''t add pushbutton during runtime? or in a event?

4 Replies

AD Administrator Syncfusion Team August 6, 2004 06:33 AM UTC

You cannot set a style property (other than CellValue (or Text which is essentially the same property as CellValue)) on an individaul cell in a GridDataBoundGrid. When you say you are setting a pushbutton in your checkbox click event, is this what you mean? If so, you cannot just set gridDataBoundGrid[row, col].CellType = "PushButton". Instead, what you can do is to handle the grid.Model.QueryCellInfo event. There if e.RowIndex > 0 and e.ColinDex points to the column where you want to maybe set the pushbutton, you should check the value of grid[e.RowIndex, checkBoxColumnIndex].CellValue to see if it is true. If so, then set e.Style.CellType = "PushButton". Here is a little sample that changes a cell to a pushbutton when a checkbox in another cell is checked. It uses QueryCellInfo as described above, and also uses CurrentCellChanged to make sure the pushbutton cell gets redrawn when teh checkbox changes. PushButtonOnCheck_2126.zip


ZH zh August 11, 2004 12:47 AM UTC

thank you so much. however, it is possible to show me in .vb version? i coding in vb.net. and somehow i could not find the querycellinfo event... sorry to trouble you... thank you...


AD Administrator Syncfusion Team August 11, 2004 06:34 AM UTC

QueryCellInfo is a member of gridDataBoundGrid.Model. Here is a VB version of the previous sample. PushButtonOnCheck_1999.zip


ZH zh August 12, 2004 03:30 AM UTC

thank you so much... hope this time it can work...

Loader.
Live Chat Icon For mobile
Up arrow icon