Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
所以我有一个网格视图,我在 RowDataBound 上添加以下边框
For Each tc As TableCell In e.Row.Cells tc.Attributes("style") = "border-width:1px;" Next
奇怪的是,如果我在本地运行它,我不会看到边界,但是,一旦移动到服务器,它们就会正确呈现。有没有其他人遇到过这个问题?
编辑:我认为说明这是已转换为 4.0 的旧 2.0 应用程序可能会有所帮助
尝试
tc.Attributes.CssStyle.Add("border-width", "1px")
从您的原始代码中需要考虑的事情:
tc.Attributes("style") = "border-width:1px;"
这将仅使用您设置的边框宽度属性替换表格单元格可能存在的任何现有内联样式,如果需要这样做,这很好。
添加到 CssStyle 集合会将样式附加到现有的内联样式集。