⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asp-datagrid-format-item.aspx

📁 ASP.NET Web Forms Techniques
💻 ASPX
字号:
<%@Page Language="C#"%>
<html>
<body>

<asp:datagrid  id="dgrTest" runat="server"
               autogeneratecolumns="false"
               forecolor="#000000"
               backcolor="#ffffff"
               cellpadding="3"
               gridlines="none"
               width="50%"
               font-name="tahoma,arial,sans-serif">
  <headerstyle forecolor="#ffffff"
               backcolor="#808080"
               font-name="tahoma,arial,sans-serif"
               font-size="12px"
               font-bold="true"
               wrap="false" />
  <itemstyle   font-name="tahoma,arial,sans-serif" />
  <alternatingitemstyle font-name="tahoma,arial,sans-serif"
               backcolor="#ffff00" />

  <columns>
    <asp:boundcolumn headertext="Key" datafield="Key" dataformatstring="<font size='4'>{0}</font>" />
    <asp:boundcolumn headertext="Value" datafield="Value" dataformatstring="<font size='1'>${0:f2}</font>" />
  </columns>

</asp:datagrid>

</body>
</html>

<script Language="C#" runat="server">

void Page_Load() {

   // create a HashTable of values to bind to
   Hashtable tabValues = new Hashtable(4);
   tabValues.Add("Microsoft", 49.56);
   tabValues.Add("Sun", 28.33);
   tabValues.Add("IBM", 55);
   tabValues.Add("Compaq", 20.74);
   tabValues.Add("Oracle", 41.1);

   // set the DataSource property of the control to the
   // hashtable and bind it to display the values
   dgrTest.DataSource = tabValues;
   dgrTest.DataBind();

}

</script>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -