[我的ASP.net学习历程]Hashtable(DataBind)
2004-09-21 19:55
459 查看
<%@ Page Language="C#" AutoEventWireup="True" Debug="true" %>
<Script language="C#" runat="server">
void Page_Load(Object Sender,EventArgs e){
Hashtable HT_values=new Hashtable();
HT_values.Add("1234","Microsoft");
HT_values.Add("3210","IBM");
HT_values.Add("4321","SUN");
HT_values.Add("5623","Orlce");
MyDownList.DataSource=HT_values;
MyDownList.DataValueField="Key";
MyDownList.DataTextField="Value";
MyListBox.DataSource=HT_values;
MyListBox.DataValueField="Key";
MyListBox.DataTextField="Value";
MyDataGrid.DataSource=HT_values;
Page.DataBind();
}
</Script>
<form id="Form_1" runat="server">
<asp:dropdownlist ID="MyDownList" runat="server"></asp:dropdownlist><br>
<asp:listbox ID="MyListBox" runat="server"></asp:listbox><br>
<asp:datagrid ID="MyDataGrid" runat="server" AutoGenerateColumns="false">
<columns>
<asp:boundcolumn HeaderText="Key" DataField="Key"/>
<asp:boundcolumn HeaderText="Value" DataField="Value"/>
</columns>
</asp:datagrid>
</form>
<Script language="C#" runat="server">
void Page_Load(Object Sender,EventArgs e){
Hashtable HT_values=new Hashtable();
HT_values.Add("1234","Microsoft");
HT_values.Add("3210","IBM");
HT_values.Add("4321","SUN");
HT_values.Add("5623","Orlce");
MyDownList.DataSource=HT_values;
MyDownList.DataValueField="Key";
MyDownList.DataTextField="Value";
MyListBox.DataSource=HT_values;
MyListBox.DataValueField="Key";
MyListBox.DataTextField="Value";
MyDataGrid.DataSource=HT_values;
Page.DataBind();
}
</Script>
<form id="Form_1" runat="server">
<asp:dropdownlist ID="MyDownList" runat="server"></asp:dropdownlist><br>
<asp:listbox ID="MyListBox" runat="server"></asp:listbox><br>
<asp:datagrid ID="MyDataGrid" runat="server" AutoGenerateColumns="false">
<columns>
<asp:boundcolumn HeaderText="Key" DataField="Key"/>
<asp:boundcolumn HeaderText="Value" DataField="Value"/>
</columns>
</asp:datagrid>
</form>
相关文章推荐
- [我的ASP.net学习历程]DataGrid(DataBind)(1)
- [我的ASP.net学习历程]DataGrid(DataBind)(2)
- [我的ASP.net学习历程]DataList(DataBind)(1)
- [我的ASP.net学习历程]DataList(DataBind)(2)
- ASP.NET 学习历程
- [我的ASP.net学习历程]编码转换
- [我的ASP.net学习历程]DataBase Settion(4)
- [我的ASP.net学习历程]编码转换http://www.21tx.com/dev/2004/09/21/12011.html
- [我的ASP.net学习历程]DataReader(2)
- [我的ASP.net学习历程]服务器环境检测
- [我的ASP.net学习历程]DataBase Settion(5)
- [我的ASP.net学习历程]有关于.dll文件的迷惑
- [我的ASP.net学习历程]DropDownList
- [我的ASP.net学习历程]类型转换
- [我的ASP.net学习历程]DataBase Settion(6)
- [ASP.net学习历程]调用类库函库的简单加密方法
- ASP.NET 学习历程
- asp.net ajax学习历程(一)
- [我的ASP.net学习历程]ImageStream图像数据流
- [我的ASP.net学习历程]数据梆定