html table tag,HTML table tag with col, colgroup, tbody, and thea

本文介绍了如何解决在ASP.NET 4.5中遇到的服务器端HTML表格编译错误。提供了将网站转换为Web应用程序、检查服务器端代码以及修改表格结构等解决方案。建议评估转换工作量,并考虑其对测试和代码管理的益处。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Uninstall Visual Studio 2012 and .NET 4.5. Reference: Server side HTML table with tbody not compiling in ASP.NET 4.5

I realize that this is not necessarily an ideal solution, but if none of the other solutions below can be implemented easily, you may end up with no other choice. Also, just because this is the first entry, it is not what I am recommending as the primary solution. It's just an option.

Convert your web site into a web application. The table with runat="server" appears to compile file when using a web application.

There are additional benefits to doing this conversion, such as making it easier to write unit tests against the code inside your web application. However, you will need to evaluate the work involved with converting from a web site to a web application, and you will need to convince your bosses and fellow coworkers that you need to make this change.

Check the server side code (code behind page/control) for the table. Are you using the control in the server side code? If not, remove runat="server". The page then compiles just fine.

Sample header 1Sample header 2

Sample cell 1Sample cell 2Sample cell 3Sample cell 4

You are using the control in the server side code. Remove the col and colgroup tags and move the column stylings into the td or th cells of the first row of the table. (Column width and stylings inherit from the first row down the table, so setting width="40%" on the first cell, for example, makes all cells in that column have width="40%".) Remove the thead tag and change all td cells in the table to th (table header) cells. Remove the tbody tag.

Sample header 1Sample header 2
Sample cell 1Sample cell 2
Sample cell 3Sample cell 4

Convert to using the

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值