一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

asp.net中的一些数据绑定啦

时间:2008-01-18 编辑:简简单单 来源:一聚教程网

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
namespace net2
{
///
/// WebForm5 的摘要说明。
///

public class WebForm5 : System.Web.UI.Page
{ //protected 保护类型。 要想在aspx哪个页面访问的时候就必须用到保护类型以上的 private估计是不行的
protected System.Web.UI.WebControls.DropDownList DropDownList1;
protected System.Web.UI.WebControls.ListBox ListBox1;
protected System.Web.UI.WebControls.RadioButtonList RadioButtonList1;
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Label Label3;
protected System.Web.UI.WebControls.Label Label4;
protected System.Web.UI.WebControls.CheckBoxList CheckBoxList1;

private void Page_Load(object sender, System.EventArgs e)
{
// 在此处放置用户代码以初始化页面
//一些WEB控件,如果没有选择它的值。然后又要取出它的值。那么它就会出错了
if (! IsPostBack)
{
//第一个是数组了
string[] str1 = new string[3]{"*","**","***"};//还有一个定义数组的方法 string[] str1= new string[3];str1[0]="";在初值化
//搞不懂是不是数组的意思。 中文也是可以在这边使用的
ArrayList 选项 = new ArrayList();
选项.Add("第一个");
选项.Add("第二个");
选项.Add("第三个");
选项.Add("第四个");
选项.Add("第五个");
//Hashtable 是不可以用排序的!
Hashtable HT = new Hashtable();
HT.Add("1","A");
HT.Add("2","B");

热门栏目