2
我有幾列,我想在左邊和右邊有一些像這樣的邊框:爲每列自定義GridView列邊框
| column1 column2 | column3 column4 |
如果我在ItemStyle
指定邊框,它顯示了在兩側,並且不會使沒有1列2和列3和4
任何建議之間的列?
我有幾列,我想在左邊和右邊有一些像這樣的邊框:爲每列自定義GridView列邊框
| column1 column2 | column3 column4 |
如果我在ItemStyle
指定邊框,它顯示了在兩側,並且不會使沒有1列2和列3和4
任何建議之間的列?
風格在你的CSS像創建樣式:
<style type="text/css">
td.column_style_left
{
border-left: 1px solid black;
}
td.column_style_right
{
border-right: 1px solid black;
}
</style>
然後將其分配給TemplateField
:
<asp:TemplateField>
<ItemStyle CssClass="column_style_left" />
<ItemTemplate>
<!-- whatever you want here -->
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle CssClass="column_style_right" />
<ItemTemplate>
<!-- whatever you want here -->
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<!-- whatever you want here -->
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemStyle CssClass="column_style_right" />
<ItemTemplate>
<!-- whatever you want here -->
</ItemTemplate>
</asp:TemplateField>
將產生:
| column1 column2 | column3 column4 |
你可以改變風格,以配合您需要什麼樣的右側,左側或頂部,等...
只是做一個獨特的風格爲每列那不同。