Question

I have gridview which contains merged cell and columns. I am trying to devide one cell in to separate sections but had no luck. Basically below image show what I am trying to achieve.

enter image description here

Currently I have the first picture structure and I want it to be like second picture. (In image I have only separated the columns in first 2 rows only, but I expect it to be in whole grid.)

Basically from column 2 and other will contain a date as heading. So I want the the difference of two days to be split in to separate sections.

eg

Col2(1/1/2012)         | Col3(7/1/2012)
This col will split    |
in to 6 sections (7-1) |

Any help is appreciate!!

Thanks

Was it helpful?

Solution 2

I have achieved it by merging the row data for the first row.

I have added new columns according to the date difference and for one set of date difference, I added the same column header which will merge them together.

OTHER TIPS

Option 1" you can build a html string in table format and bind it to the grid. do this in the code behind.

  sb.Append("<table style=\"width: 100%;\"> ");


for (int i = 0; i < cnt;i++)
        {
            col1="";
            col2="";
            col3="";

            String fmt= @"<tr>
                            <td style='width: 33%;' >
                                <b>{0}</b>
                            </td>
                            <td style='width: 33%;'>
                                {1}
                            </td>
                            <td style='width: 33%;' >
                                {2}
                            </td>
                        </tr>";

            col1 = row[i].col1 ;
            col2 = row[i].col2 ;
            col3 = row[i].col3 ;

            sb.AppendFormat(fmt, col1,col2,col3);
        }
        sb.Append("</table>");

Option 2: (Or you can have a table format in gridview in aspx page)

<ItemTemplate>

<div class="innerTable">
 <table>
    <tr >
       <td ></td>
       <td ></td>
    </tr>
    <tr>
       <td></td>
       <td></td>
   </tr>
</table>
</div>
</ItemTemplate>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top