Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C#WEb应用程序列表视图格式_C#_Asp.net - Fatal编程技术网

C#WEb应用程序列表视图格式

C#WEb应用程序列表视图格式,c#,asp.net,C#,Asp.net,在这里构建一个web应用程序,我希望能够替换我的ListView行。有人能给我一些示例代码来实现这一点吗?VS2010中的3个标准版本很差劲,我希望能够给它一些与我的网络应用程序方案相一致的东西。第1行=蓝色,第2行=灰色,第3行=蓝色,等等 谢谢在模板中设置颜色: 编辑以添加 我可以想象头部是在LayoutTemplate中构建的,因此可以在那里加粗(请参见我添加的代码)。您可能希望使用CSS—在单独的CSS文件中将所需的各种样式定义为类,并在需要时分配类以保存多余的键入 <asp:Li

在这里构建一个web应用程序,我希望能够替换我的ListView行。有人能给我一些示例代码来实现这一点吗?VS2010中的3个标准版本很差劲,我希望能够给它一些与我的网络应用程序方案相一致的东西。第1行=蓝色,第2行=灰色,第3行=蓝色,等等


谢谢

在模板中设置颜色:

编辑以添加 我可以想象头部是在LayoutTemplate中构建的,因此可以在那里加粗(请参见我添加的代码)。您可能希望使用CSS—在单独的CSS文件中将所需的各种样式定义为类,并在需要时分配类以保存多余的键入

<asp:ListView id="ListView1" runat="server">
  <LayoutTemplate>
      <table>
          <tr>
              <td style="font-weight:bold;">header</td>
              <td style="font-weight:bold;">header</td>
          </tr>
          <asp:PlaceHolder id="itemPlaceHolder" runat="server" />
      </table>
  </LayoutTemplate>
  <ItemTemplate>
    <tr style="background-color:blue;">
        <td></td>
    </tr>
  </ItemTemplate>
  <AlternatingItemTemplate>
     <tr style="background-color:gray;">
         <td></td>
     </tr>
  </AlternatingItemTemplate>
</asp:ListView>

标题
标题

我对代码做了相当大的简化,但它应该能让你想去哪里就去哪里。

我相信他想要三种交替的颜色。使用这种方法可能吗?OP的问题是:
第1行=蓝色,第2行=灰色,第3行=蓝色,等等。类似于这种效果的东西。
看起来只有两种颜色交替使用。我认为你必须更具创造性地使用2个以上的球。头球呢?如果我想的话,我在哪里可以把它改成粗体加下划线呢?这可能是类似的情况,但我认为是针对WinForms的。WinForm ListView(System.Windows.Forms.ListView)与System.Web.UI.WebControl.ListView不相似。