Hi ,
Can anyone assist me with the issue?
I have a column in a grid that will have a 'add' button. upon clicking it will allow to select a file. After adding the column mustt have the file name and the add button both in one column?
Is there property that can assist? I am new to ultragrid.
Hi,
Placing a button in a WinGrid cell is very easy. Just set the Style property of the column to EditButton.
The ClickCellButton event of the grid will fire when the button it clicked and then you can show any dialog you want (like a FileDialog) and set the value of the cell accordingly.
Thanks Mike for the prompt reply!! will do that.. but i have a another question.. once the event is triggered and the file is selected, can i hide the button in the column and fill it with filename... and also i dont want the button to occupy the whole column.. it should occupy only half of it.. thanks in advance mike ...
In the EditButton style, the button is pretty small and doesn't fill the whole cell. There is another Style called Button which will fill the whole cell.
I don't think you can control the exact width of the button, but if you need finer control over the button or if you want to display Text on the button, you will need to use an Editor, like UltraTextEditor, for that.
You can hide the button by setting the Style on the cell (that's the cell and not the column). The normal Style, with no button, is the Edit style. So you could set the column's Style to EditButton and then override that on the cells. The InitializeRow event is usually a good place to do this.
So when the user picks a File, you could update the cell's Value with the filename and in the InitializeRow event, you could check the Value of the cell - if it's empty, you set the Style to EditButton, if not you set it to Edit.