All articles(网络文学目录) All Pictures(图片目录) All Softwares(软件目录)

 
asp.net绑定label的示例代码_[Asp.Net教程]

Writer: 归海一刀 Article type: Programming skills(编程技巧) Time: 2014/1/30 1:23:29 Browse times: 374 Comment times: 0

asp.net绑定label的示例代码_[Asp.Net教程]


Head photo

Go homepage
Upload pictures
Write articles

asp.net绑定label的示例代码_[Asp.Net教程] 前台页面:
’>


’>


’>


’>

后台代码:
IDictionary Dic = new Dictionary();
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}
public string GetName(object index)
{
//如果运算符的左边是非空的就返回左边,否则是右边!
index = index ?? " ";
int key;
int.TryParse(index.ToString(), out key);

return Dic[key];
}
public void BindData()
{
Dic.Add(1, "胡果");
Dic.Add(2, "胡磊");
Dic.Add(3, "俊文");
Dic.Add(4, "刘皮");
DataBind();
}




There are 0 records,
Comment:
Must be registered users to comment(必须是注册用户才能发表评论)

Disclaimer Privacy Policy About us Site Map
Copyright ©2011-
uuhomepage.com, Inc. All rights reserved.