In VB.Net, is it possible with ultragrid, to merge two columns?
If it is so, Please let me know how to do this.
It depends on what you mean by "merge two columns".
I am using UltraGrid on my .Net forms, where it is not possible to have checkbox along with Text or value in the same cell. So what I did is, I put checkbox in one cell, and inserted value in the adjuscent cell, both belongs to the same row, but different column.
Now I need these two columns to be merged, so that it will be look like a single column.
So is it possible to merge two columns. If it is So help me with the code.
The grid has no support for merging cells in this way.
But you probably can have a CheckBox and text in the same cell if that's what you need.
Do you need to have different text in each row? Or do you just want a CheckBox in the cell with the same text on each row?
Okay, you lost be a bit at the end there regarding maintaining the original value. The grid can't do that for you, but you could use an unbound colunn to store it.
Anyway, to get a cell in the grid to display both text and a CheckBox, you would use an Editor. What you do is place an UltraCheckEditor control on the form with the grid and set the grid column's EditorControl property to the UltraCheckEditor.
This will give you a boolean column in the grid where the value of the cell is the value of the CheckBox and the text in the cell comes from the UltraCheckEditor control. This is clearly not very useful, since every cell has the same text.
To change the text in the cell, you need to use a CreationFilter. What I would do is add an unbound Column to the grid and populate this unbound string colunn with the text I want displayed in the CheckBox column. Then the CreationFilter traps for the TextUIElement inside the CheckBox cell and sets the text to the value of the unbound column. You could, of course, also examine the value of the CheckBox cell and conditionally set the text to en empty string or whatever you want.
I whipped up a small sample project to demonstrate this approach and I have attached it here.
One small issue you may notice is that the autosizing of the CheckBox column will not work correctly. The grid cannot detect that change in text in the element, it uses the editor to determine the width of the column. So if you double-click on the right edge of the CheckBox column, it will size as though it still says "ultraCheckEditor1" in it. If this matters to you, you would have to work around it by setting the Text on the editor to the longest string you are using.
Yes, I have, 'n' number of chechboxes and 'n' number of different values, alternatively, n the same row.
(i.e., for example : one cell will contain checkbox, and adjuscent cell in the same row will contain a value and so on)
The thing is, I need to do some operation in that say, if I tick one checkbox, then the future columns value present in the same row has to get added to the exact cell, where I put tick mark, and should make the future columns value to null. And if I uncheck then the old values should get retained to their respective cells accordingly.