Click here to Skip to main content
15,038,237 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
I want to merge table cells because i want to display the heading of the table is nearly together how to do it in asp.net

Please help

Thanks in advance

Happy Christmas and Happy New year all of you
Posted
Comments
uspatel 26-Dec-11 4:03am
   
same to you.......

hi frnd,

you can use below example for merge 2 cell:

For HTML

<table>
     <tr>
        <td colspan="2">
        merge Cell Display header here
        </td>
     </tr>
     <tr>
       <td>Cell 1</td>
       <td> Cell2</td>
     </tr>
   </table>


ColSpan: if you want to merge N Cells then Colspan Attribute value = N ie. for merge 10 cells, ColSpan attribute value = 10.

For ASP.net Table Control

<asp:table runat="server" xmlns:asp="#unknown">
    <asp:tablerow>
       <asp:tablecell columnspan="2">

         Merge cell : display Header here
       </asp:tablecell>
    </asp:tablerow>
    <asp:tablerow>
      <asp:tablecell>Cell1</asp:tablecell>
      <asp:tablecell>Cell2</asp:tablecell>
    </asp:tablerow>
  </asp:table>


here we have ColumnSpan attribute for merge the cells
   
   
Uses rowspan tag, you can do it.and You can try this url....................http://www.hscripts.com/tutorials/html/rowspan.php[^]
   
XML
<table>
     <tr>
        <td colspan="2">
        merge Cell Display header here
        </td>
     </tr>
     <tr>
       <td>Cell 1</td>
       <td> Cell2</td>
     </tr>
   </table>
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900