CSDN博客

img bgu

[我的ASP.net学习历程]DataGrid(DataBind)(1)

发表于2004/9/21 19:45:00  701人阅读

<%@ Page Language="C#" AutoEventWireup="True" Debug="true" %>
<Script language="C#" runat="server">
void Page_Load(Object Sender,EventArgs e){
 Hashtable HT=new Hashtable();
 HT.Add("1234","Microsoft");
 HT.Add("5678","IBM");
 HT.Add("7895","SUN");
 HT.Add("0123","Orlce");
 
 MyDataGrid.DataSource=HT;
 MyDataGrid.DataBind();
}
</Script>
<form runat="server">
<asp:datagrid ID="MyDataGrid" runat="server" AutoGenerateColumns="false">
<columns>
 <asp:boundcolumn HeaderText="Book Code" DataField="Key"/>
 <asp:boundcolumn HeaderText="Book Title" DataField="Value"/>
 <asp:templatecolumn HeaderText="Information">
  <itemtemplate>
   <asp:checkbox ID="CheckBox" runat="server"/>
  </itemtemplate>
 </asp:templatecolumn>
</columns>
</asp:datagrid>
</form>
0 0

相关博文

我的热门文章

img
取 消
img