css - 将此 CSS 样式应用于 gridview

标签 css asp.net .net gridview html-table

我有这张手动创建的表格,我想使用 gridview 生成数据而不是使用表格,表格的四个 Angular 都有圆 Angular 。

<table border="0"  id="rounded-corner">
<thead>
<tr>

<th scope="col" class="rounded-company">#</th>
<th>RegNum</th>
<th class="rounded-q4">Actions</th>
</tr>
</thead>
<tfoot>
<tr>
<td class="rounded-foot-left">Summary</td>
<td>10</td>
<td  class="rounded-foot-right">some text</td>
</tr>
</tfoot>

是否可以使用 gridview 并仍然获得我想要的表格外观?

编辑

这是表格的 CSS:

/* table */
#rounded-corner
{
    font-family: "Lucida Sans Unicode", "Lucida Grande", Sans-Serif;
    font-size: 12px;    margin: 10px;   width: 571px;
    text-align: left;   border-collapse: collapse;
}
#rounded-corner thead th.rounded-company
{
    background: #b9c9fe url('images/left.png') left -1px no-repeat;
}
#rounded-corner thead th.rounded-q4
{
    background: #b9c9fe url('images/right.png') right -1px no-repeat;
}
#rounded-corner th
{
    padding: 8px;   font-weight: normal;
    font-size: 13px;    color: #039;
    background: #b9c9fe;
}
#rounded-corner td
{
    padding: 8px;   background: #e8edff;
    border-top: 1px solid #fff;     color: #669;
}
#rounded-corner tfoot td.rounded-foot-left
{
    background: #e8edff url('images/botleft.png') left bottom no-repeat;
}
#rounded-corner tfoot td.rounded-foot-right
{
    background: #e8edff url('images/botright.png') right bottom no-repeat;
}
#rounded-corner tbody tr:hover td 
{
    background: #d0dafd;
}

最佳答案

使用转发器

<table border="0"  id="rounded-corner">
<thead>
<tr>
<th scope="col" class="rounded-company">#</th>
<th>RegNum</th>
<th class="rounded-q4">Actions</th>
</tr>
</thead>

<tbody>
    <asp:Repeater runat="server" id="rpt_table1">
    <ItemTemplate>
    <tr>
        <td><%# Eval("foo1")%></td>
        <td><%# Eval("foo2")%></td>
        <td><%# Eval("foo3")%></td>
        <td><asp:Button CommandArgument='<%# Eval("id") %>' OnCommand="btnedit_command" ID="btnedit" Text="Edit" /></td>
    </tr>
    </ItemTemplate>
    </asp:Repeater>
</tbody>

<tfoot>
<tr>
<td class="rounded-foot-left">Summary</td>
<td>10</td>
<td  class="rounded-foot-right">some text</td>
</tr>
</tfoot>

</table>

关于 .cs 背后的代码

    protected void btnedit_command(object sender, CommandEventArgs e)
    {
        // this is command argument value (ID) --> e.CommandArgument
    }

关于css - 将此 CSS 样式应用于 gridview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10173620/

相关文章:

c# - 接受空 Lambda 表达式的函数的定义原型(prototype)

c# - 不是那个懒惰的正则表达式匹配吗?

html - 组织树形图 CSS 拉伸(stretch)时固定宽度

.net - ASP.NET 验证控件和 Javascript 确认框

c# - 从方法返回 <list> 值

c# - 我的 asp.net Web 应用程序中使用 C# 的 mysql 出现超时过期错误?

.net - 每个版本(1.0、1.1、2.0、3.0、3.5),.NET 框架中有多少个类?

javascript - 在 Windows/Linux 机器(设备像素比 < 2)的 Canvas 中渲染时提高线条清晰度?

jquery - 如何选择 :hover that's not in a certain selector

jquery - Bootstrap 3 带子菜单的导航