Hashtable list = new Hashtable(); list.Add("ltp", "李天平"); list.Add("zs", "张三"); list.Add("ls", "李四"); this.DataList1.DataSource = list; this.DataList1.DataBind();
<asp:DataList ID="DataList1" runat="server"> <HeaderTemplate> <table width="200"> <tr> <td width="100"> ENGLISH </td> <td> 中文 </td> </tr> </table> </HeaderTemplate> <ItemTemplate> <table width="200"> <tr> <td width="100"> <%# ((DictionaryEntry)Container.DataItem).Key %> </td> <td> <%# ((DictionaryEntry)Container.DataItem).Value %> </td> </tr> </table> </ItemTemplate> </asp:DataList>