Merge columns programmatically

2 posts, 0 answers
  1. Bert
    Bert avatar
    29 posts
    Member since:
    May 2012

    Posted 30 Sep 2016 Link to this post


    I am working on a report that should contains multiple tables with four columns. Each table is bound to a collection of the following data:
        public string item1 {get; set;}
        public string item2 {get; set;}
        public string Description1 {get; set;}
        public string Description2 {get; set;}

    The cells of the first and second column should be merged when Item2 is an empty string. The same for the Description columns. I tried to adjust the TexBox sizes using the ItemDataBound events but this does not work. The column is rendered as wide as the largest text box.

    The output should look like this:
    Item1   Item2   Description1   Description2
    Item11111111   Description11111111111111
    Item1   Item2   Description1   Description2
    Item1   Item2   Description1   Description2
    Item11111111   Description11111111111111

    Any help would be appreciated.

  2. Katia
    Katia avatar
    760 posts

    Posted 04 Oct 2016 Link to this post

    Hi Bert,

    Merging of the cells for a particular row is not supported. As the Table item is generated dynamically, when you merge two cells all the rows in the table will have those cells merged.

    You can use bindings to change the BorderStyle of the cells dynamically. For example, when the data field is an empty string the BorderStyle can be changed to None which will imitate the merged cells. However, the text will remain in its original place.

    I hope this approach will help.

    Telerik by Progress
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Feedback Portal and vote to affect the priority of the items
Back to Top