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 pushbutton to grid bound to datatable

Hi, I''m having trouble with something I would have thought quite simple. I''m sure the answer is right in front of my nose. I am binding a grid to a datatable. However, I also need to add a push button to each row (in the first column). I can''t seem to get ''both'' happening simultaneously. One seems to clear the other. Can someone please point me in the right direction? Thanks in advance, DS

1 Reply

AD Administrator Syncfusion Team August 4, 2004 09:58 PM UTC

If by first column you mean the first column from your datatable (and not the row header column), then setting the CellType = "PushButton" does not display the CellValue property. A pushButton cell gets its display text from the style.Description. So, that is probably why you are seeing a push button with no text if that is in fact what you are seeing. One way you can try to handle this is to subscribe to the PrepareviewStyleInfo event. In the handler try code similar to
if(e.RowIndex > 0 && e.ColIndex == 1)
	e.Style.CellType = "PushButton";
	e.Style.Description = e.Style.Text;
This should display the pushbutton and use teh style.Text property for the Description. If it does not work form PrepareViewStyleInfo, try it from grid.Model.QueryCellInfo.

Live Chat Icon For mobile
Up arrow icon