Skip to content

Merging two columns in ultragrid

New Discussion
Binu
Binu asked on Aug 9, 2013 11:19 AM

In VB.Net, is it possible with ultragrid, to merge two columns?

 If it is so, Please let me know how to do this.

Sign In to post a reply

Replies

  • 0
    Mike Saltzman
    Mike Saltzman answered on Jul 23, 2008 3:18 PM

     It depends on what you mean by "merge two columns".

    • 0
      Binu
      Binu answered on Jul 24, 2008 5:45 AM

      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.

      • 0
        Mike Saltzman
        Mike Saltzman answered on Jul 24, 2008 3:37 PM

        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? 

      • 0
        Binu
        Binu answered on Jul 24, 2008 4:43 PM

        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.

         

      • 0
        Mike Saltzman
        Mike Saltzman answered on Jul 25, 2008 3:52 PM

        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. 

      • 0
        Sutha Raghavan
        Sutha Raghavan answered on Aug 9, 2013 10:59 AM

        Reg: Infragistics cell merge
        Here i'm having 5 rows like
        Month Amount1 Amount2

        Jan 2109 1111
        Jan 2109 1111
        Feb 2109 1111
        Feb 2109 1111

        Here i need to merge cells of amount1 and amount2 based month
        For
        Jan 2109 1111
        Feb 2109 1111

        like this but it should be in two rows with merged cells
        suppose if the month is same but amount is diff menas should not merge
        like

        Jan 2109 1111
        2345 4566

        Feb 2109 1111
        2345 4566
        Like this should be there.

        plz help me

      • 0
        Sutha Raghavan
        Sutha Raghavan answered on Aug 9, 2013 11:16 AM

        Reg: Infragistics cell merge
        Here i'm having 4 rows like
        Month Amount1 Amount2

        Jan 2109 1111
        Jan 2109 1111
        Feb 2109 1111
        Feb 2109 1111

        Here i need to merge cells of amount1 and amount2 based month
        For
        Jan 2109 1111
        Feb 2109 1111

        like this but it should be in two rows with merged cells
        suppose if the month is same but amount is diff means should not merge
        like

        Jan 2109 1111
        2345 4566

        Feb 2109 1111
        2345 4566
        Like this should be there.

        plz help me

      • 0
        Sutha Raghavan
        Sutha Raghavan answered on Aug 9, 2013 11:19 AM

        kindly find file attachment

  • You must be logged in to reply to this topic.
Discussion created by
Favorites
Replies
Created On
Last Post
Discussion created by
Binu
Favorites
0
Replies
8
Created On
Aug 09, 2013
Last Post
13 years, 1 month ago

Suggested Discussions

Tags

Created by

Created on

Aug 9, 2013 11:19 AM

Last activity on

Aug 9, 2013 11:19 AM