更改gridview的外观

时间:2013-05-14 09:33:41

标签: asp.net grid asp.net-controls

我在DB中有一个包含(id,title,body)字段的新闻表 现在我想将这些新闻显示在news.aspx页面中 我可以使用网格视图来显示它们,但我想更改网格视图的外观,如下图所示。我可以做到吗?或者对此有任何想法。
enter image description here

提前感谢。

2 个答案:

答案 0 :(得分:0)

您可以使用Listview实现如下:

 <asp:ListView ID="lvNewsContent" runat="server">
     <LayoutTemplate>
      <div style="border:1px solid black; border-top:2px solid black; text-align:center; width:200px; height:60px;">
        <%#Eval("NewsTitle") %>
      </div>
      <div style="border:1px solid black; width:200px; text-align:center; display:block;">
          <div style="margin-right:auto; margin-left:auto; text-align:center;">
            <%#Eval("NewsDetail") %>
        </div>
        <div style="width:60px; height:20px; float:right; margin-right:20px;">
            More info
        </div>
    </div>
 </LayoutTemplate>
 </asp:ListView>

之后设置Listview的数据源,然后绑定它。

答案 1 :(得分:0)

DataGridView控件能够displaying images for customize appearance通过使用KetticGridView中的一些属性来指示网格行的状态。